コード例 #1
0
        //
        // Private implementation methods
        //

        private void ParseDtdFromParserContext()
        {
            Debug.Assert(_parserContext != null);
            Debug.Assert(_coreReaderImpl.DtdInfo == null);

            if (_parserContext.DocTypeName == null || _parserContext.DocTypeName.Length == 0)
            {
                return;
            }

            IDtdParser dtdParser = DtdParser.Create();

            XmlTextReaderImpl.DtdParserProxy proxy = new XmlTextReaderImpl.DtdParserProxy(_coreReaderImpl);
            IDtdInfo dtdInfo = dtdParser.ParseFreeFloatingDtd(_parserContext.BaseURI, _parserContext.DocTypeName, _parserContext.PublicId,
                                                              _parserContext.SystemId, _parserContext.InternalSubset, proxy);

            _coreReaderImpl.SetDtdInfo(dtdInfo);

            ValidateDtd();
        }
コード例 #2
0
        private void ParseDocumentType(XmlDocumentType dtNode, bool bUseResolver, XmlResolver?resolver)
        {
            _doc = dtNode.OwnerDocument;
            XmlParserContext  pc = new XmlParserContext(null, new XmlNamespaceManager(_doc !.NameTable), null, null, null, null, _doc.BaseURI, string.Empty, XmlSpace.None);
            XmlTextReaderImpl tr = new XmlTextReaderImpl("", XmlNodeType.Element, pc);

            tr.Namespaces = dtNode.ParseWithNamespaces;
            if (bUseResolver)
            {
                tr.XmlResolver = resolver;
            }

            IDtdParser dtdParser = DtdParser.Create();

            XmlTextReaderImpl.DtdParserProxy proxy = new XmlTextReaderImpl.DtdParserProxy(tr);

            IDtdInfo dtdInfo = dtdParser.ParseFreeFloatingDtd(_doc.BaseURI, dtNode.Name, dtNode.PublicId, dtNode.SystemId, dtNode.InternalSubset, proxy);

            LoadDocumentType(dtdInfo, dtNode);
        }