#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("version")) { version = tempreader.Value; } //get encoding info if (tempreader.MoveToAttribute("encoding")) { encoding = tempreader.Value; } //get standalone info if (tempreader.MoveToAttribute("standalone")) { standalone = tempreader.Value; } } finally { tempreader.Close(); } }
#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); }
public override bool Read() { return(_impl.Read()); }