简体   繁体   中英

Saxon .NET custom uri resolving in C++

I am using Visual Studio 2022 , and I'm on Windows 11


Saxon .NET uses a System::Xml::XmlUrlResolver to resolve the uri's in a xslt of a transformation.

What's even better about Saxon .NET , is it allows you to inherit from System::Xml::XmlUrlResolver so you can create your own resolver so that you can resolve the uri's yourselves.


If you want to inherit from it then you need to override two functions:

  1. System::Uri^ ResolveUri(System::Uri^ baseUri, System::String^ relativeUri)

  2. System::Object^ GetEntity(System::Uri^ absoluteUri, System::String^ role, System::Type^ ofObjectToReturn)

The referenced uri gets passed to ResolveUri() and the returned value gets passed to GetEnity() which then returns a stream object that contains the referenced file .


I needed that functionality so I switched to C++ /CLI so I can use Saxon .NET , but now its giving me C++ problems, that I can't overcome .

The reason why I want to have a custom xml resolver is because I am storing xslts as embedded resources . All these xslts reference other xslts that could be files on the filesystem or other embedded resources .

Using Saxon .NET I can do that, but I don't know if there a way in a Saxon/C where I can do something like that.

Thank you

I'm pretty sure the SaxonC product doesn't expose it's own resolver API. It does come packaged with the XML Resolver catalog resolver, however, which might help you accomplish your goal.

What are the embedded resources embedded in ? Could they be put in ZIP files, for example, or is it critical that they be part of the compiled executable (in, for example .NET assemblies)?

This feature has been implemented in SaxonC 12.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM