当前位置: 首页>>代码示例>>C#>>正文


C# XmlReader.Create方法代码示例

本文整理汇总了C#中System.Xml.XmlReader.Create方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.Create方法的具体用法?C# XmlReader.Create怎么用?C# XmlReader.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlReader的用法示例。


在下文中一共展示了XmlReader.Create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XmlReaderSettings

XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;
XmlReader reader = XmlReader.Create("books.xml", settings);
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:5,代码来源:XmlReader.Create

示例2: XmlReaderSettings

// Set the reader settings.
XmlReaderSettings settings = new XmlReaderSettings();
settings.IgnoreComments = true;
settings.IgnoreProcessingInstructions = true;
settings.IgnoreWhitespace = true;
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:5,代码来源:XmlReader.Create

示例3: XmlUrlResolver

// Create a resolver with default credentials.
  XmlUrlResolver resolver = new XmlUrlResolver();
  resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;

  // Set the reader settings object to use the resolver.
  settings.XmlResolver = resolver;

  // Create the XmlReader object.
  XmlReader reader = XmlReader.Create("http://ServerName/data/books.xml", settings);
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:9,代码来源:XmlReader.Create

示例4: XmlTextReader

XmlTextReader txtReader = new XmlTextReader("bookOrder.xml");
XmlReaderSettings settings = new XmlReaderSettings();
settings.Schemas.Add("urn:po-schema", "PO.xsd");
settings.ValidationType = ValidationType.Schema;
XmlReader reader = XmlReader.Create(txtReader, settings);
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:5,代码来源:XmlReader.Create

示例5: XmlReaderSettings

XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.DTD;
XmlReader inner = XmlReader.Create("book.xml", settings); // DTD Validation
settings.Schemas.Add("urn:book-schema", "book.xsd");
settings.ValidationType = ValidationType.Schema;
XmlReader outer = XmlReader.Create(inner, settings);  // XML Schema Validation
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:6,代码来源:XmlReader.Create

示例6: NameTable

string xmlFrag ="<item rk:ID='abc-23'>hammer</item> " +
                        "<item rk:ID='r2-435'>paint</item>" +
                        "<item rk:ID='abc-39'>saw</item>";

// Create the XmlNamespaceManager.
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
nsmgr.AddNamespace("rk", "urn:store-items");

// Create the XmlParserContext.
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);

// Create the reader. 
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
XmlReader reader = XmlReader.Create(new StringReader(xmlFrag), settings, context);
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:16,代码来源:XmlReader.Create

示例7: XmlDocument

// Create the XmlNodeReader object.
XmlDocument doc = new XmlDocument();
doc.Load("books.xml");
XmlNodeReader nodeReader = new XmlNodeReader(doc);

// Set the validation settings.
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
settings.Schemas.Add("urn:bookstore-schema", "books.xsd");
settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);

// Create a validating reader that wraps the XmlNodeReader object.
XmlReader reader = XmlReader.Create(nodeReader, settings);
// Parse the XML file.
while (reader.Read());
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:15,代码来源:XmlReader.Create

示例8: StringReader

string xmlData ="<item productID='124390'>" +
                        "<price>5.95</price>" +
                        "</item>";

// Create the XmlReader object.
XmlReader reader = XmlReader.Create(new StringReader(xmlData));
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:6,代码来源:XmlReader.Create

示例9: FileStream

FileStream fs = new FileStream(@"C:\data\books.xml", FileMode.OpenOrCreate, 
                                                                    FileAccess.Read, FileShare.Read);

// Create the XmlReader object.
XmlReader reader = XmlReader.Create(fs);
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:5,代码来源:XmlReader.Create

示例10: XmlReaderSettings

// Set the validation settings.
XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Parse;
settings.ValidationType = ValidationType.DTD;
settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
 
 // Create the XmlReader object.
XmlReader reader = XmlReader.Create("itemDTD.xml", settings);

// Parse the file. 
while (reader.Read()) {}
开发者ID:.NET开发者,项目名称:System.Xml,代码行数:11,代码来源:XmlReader.Create


注:本文中的System.Xml.XmlReader.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。