Class XmlUtil.InternalResolver
XmlResolver subclass that resolves uri's to corresponding xml nodes without going through temporary files.
Namespace: SuperOffice.Util
Assembly: SoCore.dll
Syntax
public class InternalResolver : XmlResolver
Constructors
InternalResolver(KeyValuePair<String, XmlNode>[])
Construct a resolver and set its content. This is equivalent to passing an empty parameter list and calling the Add method.
Declaration
public InternalResolver(params KeyValuePair<string, XmlNode>[] elements)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<String, XmlNode>[] | elements | Array of KeyValuePairs that map an URI terminal component name to an XmlNode |
Examples
public static string Merge( XmlNode first, XmlNode second)
{
XmlDocument stylesheet = new XmlDocument();
stylesheet.LoadXml( _mergeXSLT );
XsltSettings settings = new XsltSettings( true, false );
XslCompiledTransform transform = new XslCompiledTransform( true );
transform.Load( stylesheet, settings, new XmlUrlResolver() );
string mergeDriver = "<merge xmlns=\"http://informatik.hu-berlin.de/merge\">" +
"<file1>first.xml</file1>" +
"<file2>second.xml</file2>" +
"</merge>";
StringWriter stringWriter = new StringWriter();
XmlWriterSettings writerSettings = new XmlWriterSettings();
writerSettings.ConformanceLevel = ConformanceLevel.Auto;
XmlWriter writer = XmlWriter.Create( stringWriter, writerSettings );
InternalResolver res = new InternalResolver( new KeyValuePair<string,XmlNode>( "first.xml", first ),
new KeyValuePair<string,XmlNode>( "second.xml", second ) );
transform.Transform( XmlReader.Create( new StringReader( mergeDriver ) ), null, writer, res );
Properties
Credentials
Required override, does nothing
Declaration
public override ICredentials Credentials { set; }
Property Value
Type | Description |
---|---|
ICredentials |
Methods
Add(KeyValuePair<String, XmlNode>)
Add a name / XmlNode element to those handled by this resolver instance
Declaration
public void Add(KeyValuePair<string, XmlNode> element)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<String, XmlNode> | element | KeyValuePair that maps an URI terminal component name to an XmlNode |
GetEntity(Uri, String, Type)
Resolve an URI, override from base class. If the last part of the uri matches the name of an element passed to the constructor, this element is returned; otherwise null.
Declaration
public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
Parameters
Type | Name | Description |
---|---|---|
Uri | absoluteUri | URI from calling system |
String | role | Not used |
Type | ofObjectToReturn | Not used |
Returns
Type | Description |
---|---|
Object | Matching XmlNode or null |
Extension Methods
EnumUtil.MapEnums<From, To>(From)