本文整理汇总了C#中XmlResolver类的典型用法代码示例。如果您正苦于以下问题:C# XmlResolver类的具体用法?C# XmlResolver怎么用?C# XmlResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlResolver类属于命名空间,在下文中一共展示了XmlResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public void Load(IXPathNavigable stylesheet, XmlResolver resolver)
{
if (stylesheet == null)
{
throw new ArgumentNullException(nameof(stylesheet));
}
Load(stylesheet.CreateNavigator(), resolver);
}
示例2: XmlDTDParserInput
// Initialize this dtd reader.
public void Init
(XmlParserInput input,
XmlResolver resolver)
{
base.ErrorHandler = input.ErrorHandler;
this.input = new XmlDTDParserInput(input, context.NameTable);
this.resolver = resolver;
}
示例3: Load
public void Load(Compiler compiler, object stylesheet, XmlResolver xmlResolver)
{
Debug.Assert(compiler != null);
_compiler = compiler;
_xmlResolver = xmlResolver ?? XmlNullResolver.Singleton;
XmlReader reader = stylesheet as XmlReader;
if (reader != null)
{
_readerSettings = new QueryReaderSettings(reader);
Load(reader);
}
else
{
// We should take DefaultReaderSettings from Compiler.Settings.DefaultReaderSettings.
string uri = stylesheet as string;
if (uri != null)
{
// If xmlResolver == null, then the original uri will be resolved using XmlUrlResolver
XmlResolver origResolver = xmlResolver;
if (xmlResolver == null || xmlResolver == XmlNullResolver.Singleton)
origResolver = new XmlUrlResolver();
Uri resolvedUri = origResolver.ResolveUri(null, uri);
if (resolvedUri == null)
{
throw new XslLoadException(SR.Xslt_CantResolve, uri);
}
_readerSettings = new QueryReaderSettings(new NameTable());
using (reader = CreateReader(resolvedUri, origResolver))
{
Load(reader);
}
}
else
{
IXPathNavigable navigable = stylesheet as IXPathNavigable;
if (navigable != null)
{
reader = XPathNavigatorReader.Create(navigable.CreateNavigator());
_readerSettings = new QueryReaderSettings(reader.NameTable);
Load(reader);
}
else
{
Debug.Fail("Should never get here");
}
}
}
Debug.Assert(compiler.Root != null);
compiler.StartApplyTemplates = f.ApplyTemplates(nullMode);
ProcessOutputSettings();
foreach (AttributeSet attSet in compiler.AttributeSets.Values)
{
CheckAttributeSetsDfs(attSet); // Check attribute sets for circular references using dfs marking method
}
}
示例4: Execute
/// <summary>
/// Default document as XPathNavigator.
/// </summary>
public override void Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) {
if (results == null)
throw new ArgumentNullException(nameof(results));
if (contextDocument != null)
Execute(contextDocument.CreateNavigator(), dataSources, argumentList, results, false);
else
Execute(null, dataSources, argumentList, results, false);
}
示例5: Load
public void Load(XPathNavigator stylesheet, XmlResolver resolver) {
if (stylesheet == null) {
throw new ArgumentNullException("stylesheet");
}
if (resolver == null) {
resolver = new XmlNullResolver();
}
Compile(stylesheet, resolver, /*evidence:*/null);
}
示例6: Load
public void Load(Compiler compiler, object stylesheet, XmlResolver xmlResolver) {
Debug.Assert(compiler != null);
this.compiler = compiler;
this.xmlResolver = xmlResolver ?? XmlNullResolver.Singleton;
XmlReader reader = stylesheet as XmlReader;
if (reader != null) {
readerSettings = new QueryReaderSettings(reader);
LoadStylesheet(reader, /*include:*/false);
} else {
// We should take DefaultReaderSettings from Compiler.Settings.DefaultReaderSettings.
string uri = stylesheet as string;
if (uri != null) {
// If xmlResolver == null, then the original uri will be resolved using XmlUrlResolver
XmlResolver origResolver = xmlResolver ?? new XmlUrlResolver();
Uri resolvedUri = origResolver.ResolveUri(null, uri);
if (resolvedUri == null) {
throw new XslLoadException(Res.Xslt_CantResolve, uri);
}
readerSettings = new QueryReaderSettings(new NameTable());
using (reader = CreateReader(resolvedUri, origResolver)) {
LoadStylesheet(reader, /*include:*/false);
}
} else {
IXPathNavigable navigable = stylesheet as IXPathNavigable;
if (navigable != null) {
reader = XPathNavigatorReader.Create(navigable.CreateNavigator());
readerSettings = new QueryReaderSettings(reader.NameTable);
LoadStylesheet(reader, /*include:*/false);
} else {
Debug.Fail("Should never get here");
}
}
}
Process();
}
示例7: Validate
internal XmlReader Validate(XmlReader reader, XmlResolver resolver, XmlSchemaSet schemaSet, ValidationEventHandler valEventHandler) {
if (schemaSet != null) {
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.ValidationType = ValidationType.Schema;
readerSettings.Schemas = schemaSet;
readerSettings.ValidationEventHandler += valEventHandler;
return new XsdValidatingReader(reader, resolver, readerSettings, this);
}
return null;
}
示例8: Evaluate
/// <devdoc>
/// <para>
/// Executes the query by accessing datasources via the XmlResolver and using
/// run-time parameters as provided by the XsltArgumentList. The default document
/// is mapped into the XmlResolver with the provided name. The results are returned
/// as an IList.
/// </para>
/// </devdoc>
public abstract IList Evaluate(XmlReader contextDocument, XmlResolver dataSources, XsltArgumentList argumentList);
示例9: Execute
/// <devdoc>
/// <para>
/// Executes the query over the provided XPathNavigator with the given XsltArgumentList
/// as run-time parameters. The results are output to the provided Stream.
/// </para>
/// </devdoc>
public abstract void Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, Stream results);
示例10: Evaluate
/// <summary>
/// Executes the query by accessing datasources via the XmlResolver and using
/// run-time parameters as provided by the XsltArgumentList. The default document
/// is mapped into the XmlResolver with the provided name. The results are returned
/// as an IList.
/// </summary>
public override IList Evaluate(XmlReader contextDocument, XmlResolver dataSources, XsltArgumentList argumentList) {
XmlCachedSequenceWriter seqwrt = new XmlCachedSequenceWriter();
Execute(contextDocument, dataSources, argumentList, seqwrt);
return seqwrt.ResultSequence;
}
示例11: Add
private XmlSchema Add(string ns, SchemaInfo schemaInfo, XmlSchema schema, bool compile, XmlResolver resolver) {
int errorCount = 0;
if (schema != null) {
if (schema.ErrorCount == 0 && compile) {
if (!schema.CompileSchema(this, resolver, schemaInfo, ns, validationEventHandler, nameTable, true)) {
errorCount = 1;
}
ns = schema.TargetNamespace == null ? string.Empty : schema.TargetNamespace;
}
errorCount += schema.ErrorCount;
}
else {
errorCount += schemaInfo.ErrorCount;
//ns = ns == null? string.Empty : NameTable.Add(ns);
ns = NameTable.Add(ns); //Added without checking for ns == null, since XDR cannot have null namespace
}
if (errorCount == 0) {
XmlSchemaCollectionNode node = new XmlSchemaCollectionNode();
node.NamespaceURI = ns;
node.SchemaInfo = schemaInfo;
node.Schema = schema;
Add(ns, node);
return schema;
}
return null;
}
示例12: XmlDTDReader
// Constructor.
public XmlDTDReader(XmlParserContext context)
: base(null)
{
this.context = context;
this.input = null;
this.resolver = null;
}
示例13: Parser
public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler) {
this.schemaType = schemaType;
this.nameTable = nameTable;
this.schemaNames = schemaNames;
this.eventHandler = eventHandler;
this.xmlResolver = System.Xml.XmlConfiguration.XmlReaderSection.CreateDefaultResolver();
processMarkup = true;
dummyDocument = new XmlDocument();
}
示例14: Parser
public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler) {
this.schemaType = schemaType;
this.nameTable = nameTable;
this.schemaNames = schemaNames;
this.eventHandler = eventHandler;
this.xmlResolver = new XmlUrlResolver();
processMarkup = true;
dummyDocument = new XmlDocument();
}
示例15: Parser
public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
{
_schemaType = schemaType;
_nameTable = nameTable;
_schemaNames = schemaNames;
_eventHandler = eventHandler;
_xmlResolver = null;
_processMarkup = true;
_dummyDocument = new XmlDocument();
}