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


C# XmlTextReaderImpl.Read方法代码示例

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


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

示例1: CreateInnerXmlReader

 private XmlReader CreateInnerXmlReader(string xmlFragment, XmlNodeType nt, XmlParserContext context, XmlDocument doc)
 {
     XmlNodeType fragType = nt;
     switch (fragType)
     {
         case XmlNodeType.Entity:
         case XmlNodeType.EntityReference:
             fragType = XmlNodeType.Element;
             break;
     }
     XmlTextReaderImpl reader = new XmlTextReaderImpl(xmlFragment, fragType, context) {
         XmlValidatingReaderCompatibilityMode = true
     };
     if (doc.HasSetResolver)
     {
         reader.XmlResolver = doc.GetResolver();
     }
     if (!doc.ActualLoadingStatus)
     {
         reader.DisableUndeclaredEntityCheck = true;
     }
     XmlDocumentType documentType = doc.DocumentType;
     if (documentType != null)
     {
         reader.Namespaces = documentType.ParseWithNamespaces;
         if (documentType.DtdSchemaInfo != null)
         {
             reader.SetDtdInfo(documentType.DtdSchemaInfo);
         }
         else
         {
             IDtdParser parser = DtdParser.Create();
             XmlTextReaderImpl.DtdParserProxy adapter = new XmlTextReaderImpl.DtdParserProxy(reader);
             IDtdInfo newDtdInfo = parser.ParseFreeFloatingDtd(context.BaseURI, context.DocTypeName, context.PublicId, context.SystemId, context.InternalSubset, adapter);
             documentType.DtdSchemaInfo = newDtdInfo as SchemaInfo;
             reader.SetDtdInfo(newDtdInfo);
         }
     }
     if ((nt == XmlNodeType.Entity) || (nt == XmlNodeType.EntityReference))
     {
         reader.Read();
         reader.ResolveEntity();
     }
     return reader;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:45,代码来源:XmlLoader.cs

示例2: ParseXmlDeclarationValue

#pragma warning restore 618

        internal static void ParseXmlDeclarationValue(string strValue, out string version, out string encoding, out string standalone)
        {
            version = null;
            encoding = null;
            standalone = null;
            XmlTextReaderImpl tempreader = new XmlTextReaderImpl(strValue, (XmlParserContext)null);
            try
            {
                tempreader.Read();
                //get version info.
                if (tempreader.MoveToAttribute(nameof(version)))
                    version = tempreader.Value;
                //get encoding info
                if (tempreader.MoveToAttribute(nameof(encoding)))
                    encoding = tempreader.Value;
                //get standalone info
                if (tempreader.MoveToAttribute(nameof(standalone)))
                    standalone = tempreader.Value;
            }
            finally
            {
                tempreader.Close();
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:26,代码来源:XmlLoader.cs

示例3: CreateInnerXmlReader

#pragma warning disable 618
        // Creates a XmlValidatingReader suitable for parsing InnerXml strings
        private XmlReader CreateInnerXmlReader(String xmlFragment, XmlNodeType nt, XmlParserContext context, XmlDocument doc)
        {
            XmlNodeType contentNT = nt;
            if (contentNT == XmlNodeType.Entity || contentNT == XmlNodeType.EntityReference)
                contentNT = XmlNodeType.Element;

            XmlTextReaderImpl tr = new XmlTextReaderImpl(xmlFragment, contentNT, context);
            tr.XmlValidatingReaderCompatibilityMode = true;
            if (doc.HasSetResolver)
            {
                tr.XmlResolver = doc.GetResolver();
            }
            if (!(doc.ActualLoadingStatus))
            {
                tr.DisableUndeclaredEntityCheck = true;
            }
            Debug.Assert(tr.EntityHandling == EntityHandling.ExpandCharEntities);

            XmlDocumentType dtdNode = doc.DocumentType;
            if (dtdNode != null)
            {
                tr.Namespaces = dtdNode.ParseWithNamespaces;
                if (dtdNode.DtdSchemaInfo != null)
                {
                    tr.SetDtdInfo(dtdNode.DtdSchemaInfo);
                }
                else
                {
                    IDtdParser dtdParser = DtdParser.Create();
                    XmlTextReaderImpl.DtdParserProxy proxy = new XmlTextReaderImpl.DtdParserProxy(tr);

                    IDtdInfo dtdInfo = dtdParser.ParseFreeFloatingDtd(context.BaseURI, context.DocTypeName, context.PublicId, context.SystemId, context.InternalSubset, proxy);

                    // TODO: Change all of XmlDocument to IDtdInfo interfaces
                    dtdNode.DtdSchemaInfo = dtdInfo as SchemaInfo;
                    tr.SetDtdInfo(dtdInfo);
                }
            }

            if (nt == XmlNodeType.Entity || nt == XmlNodeType.EntityReference)
            {
                tr.Read(); //this will skip the first element "wrapper"
                tr.ResolveEntity();
            }
            return tr;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:48,代码来源:XmlLoader.cs

示例4: ParseXmlDeclarationValue

 internal static void ParseXmlDeclarationValue(string strValue, out string version, out string encoding, out string standalone)
 {
     version = null;
     encoding = null;
     standalone = null;
     XmlTextReaderImpl impl = new XmlTextReaderImpl(strValue, null);
     try
     {
         impl.Read();
         if (impl.MoveToAttribute("version"))
         {
             version = impl.Value;
         }
         if (impl.MoveToAttribute("encoding"))
         {
             encoding = impl.Value;
         }
         if (impl.MoveToAttribute("standalone"))
         {
             standalone = impl.Value;
         }
     }
     finally
     {
         impl.Close();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:XmlLoader.cs


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