/// <include file='doc\XmlParserContext.uex' path='docs/doc[@for="XmlParserContext.XmlParserContext3"]/*' /> public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr, String docTypeName, String pubId, String sysId, String internalSubset, String baseURI, String xmlLang, XmlSpace xmlSpace, Encoding enc) { if (nsMgr != null) { if (nt == null) { _nt = nsMgr.NameTable; } else { if ( (object)nt != (object) nsMgr.NameTable ) { throw new XmlException(Res.Xml_NotSameNametable); } _nt = nt; } } else { _nt = nt; } _nsMgr = nsMgr; _docTypeName = (null == docTypeName ? String.Empty : docTypeName); _pubId = (null == pubId ? String.Empty : pubId); _sysId = (null == sysId ? String.Empty : sysId); _internalSubset = (null == internalSubset ? String.Empty : internalSubset); _baseURI = (null == baseURI ? String.Empty : baseURI); _xmlLang = (null == xmlLang ? String.Empty : xmlLang); _xmlSpace = xmlSpace; _encoding = enc; }
internal XPathDocument() { this.space = XmlSpace.Default; this.root = new XPathRoot(); this.root.topNamespace = new XPathNamespace( "xml", "http://www.w3.org/XML/1998/namespace", ++ documentIndex ); this.nt = new NameTable(); this.baseURI = string.Empty; }
internal XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr, DTDObjectModel dtd, string baseURI, string xmlLang, XmlSpace xmlSpace, Encoding enc) { this.namespaceManager = nsMgr; this.nameTable = nt != null ? nt : nsMgr != null ? nsMgr.NameTable : null; if (dtd != null) { this.DocTypeName = dtd.Name; this.PublicId = dtd.PublicId; this.SystemId = dtd.SystemId; this.InternalSubset = dtd.InternalSubset; this.dtd = dtd; } this.encoding = enc; this.BaseURI = baseURI; this.XmlLang = xmlLang; this.xmlSpace = xmlSpace; contextItems = new ArrayList(); }
public override void WriteEndElement() { if (element_count-- == 0) { throw new InvalidOperationException("There was no XML start tag open."); } if (state == WriteState.Attribute) { WriteEndAttribute(); } // Comment+EndElement does not exist bool needExplicitEndElement = buffer.Position == 0 || !SupportsCombinedEndElementSupport(buffer.GetBuffer() [0]); ProcessPendingBuffer(true, !needExplicitEndElement); CheckState(); AddMissingElementXmlns(); if (needExplicitEndElement) { writer.Write(BF.EndElement); } element_ns = element_ns_stack.Pop(); xml_lang = xml_lang_stack.Pop(); xml_space = xml_space_stack.Pop(); int cur = namespaces.Count; ns_index = ns_index_stack.Pop(); namespaces.RemoveRange(ns_index, cur - ns_index); open_start_element = false; Depth--; }
internal XmlEntityReader(XmlScanner scanner, XmlNameTable nt, XmlNamespaceManager nsMgr, XmlNodeType node, String entityName, int depth, Encoding encoding, String baseURI, bool isExternal, bool isAttributeText, bool standAlone, String originalBaseURI) : base((scanner == null ? new XmlScanner(new StringReader("a"), nt) : scanner), nt, nsMgr, node, depth, encoding, baseURI, isExternal, standAlone) { if (scanner == null) { _IsScanner = false; _AttributeTextToken = new XmlNSAttributeTokenInfo(_Scanner, _NsMgr, XmlNodeType.Text, Normalization, _XmlNs); _AttributeTextToken.Value = String.Empty; _AttributeTextToken.Depth = depth + 1; } else { _IsScanner = true; } _IsExternal = isExternal; //We only need to return the EndEntity token when EntityHandling = ExpandCharEntity _EndEntityToken = new XmlNameValueTokenInfo(_Scanner, _NsMgr, XmlNodeType.EndEntity, depth - 1, String.Empty, false); _EndEntityToken.Name = entityName; _EndEntityEncoding = encoding; _IsAttributeText = isAttributeText; _PrevXmlSpace = XmlSpace.None; _PrevXmlLang = String.Empty; _OriginalBaseUri = originalBaseURI; }
public XmlParserContext(XmlNameTable?nt, XmlNamespaceManager?nsMgr, string?docTypeName, string?pubId, string?sysId, string?internalSubset, string?baseURI, string?xmlLang, XmlSpace xmlSpace) : this(nt, nsMgr, docTypeName, pubId, sysId, internalSubset, baseURI, xmlLang, xmlSpace, null) { // Intentionally Empty }
/// <include file='doc\XmlParserContext.uex' path='docs/doc[@for="XmlParserContext.XmlParserContext1"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr, String docTypeName, String pubId, String sysId, String internalSubset, String baseURI, String xmlLang, XmlSpace xmlSpace) : this(nt, nsMgr, docTypeName, pubId, sysId, internalSubset, baseURI, xmlLang, xmlSpace, null) { // Intentionally Empty }
public XPathNavigator CreateNavigator(int nodeQuota, XmlSpace space) { if (nodeQuota <= 0) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("nodeQuota", SR.GetString(SR.FilterQuotaRange))); return new SeekableMessageNavigator(this.CreateMessage(), nodeQuota, space, true, true); }
internal XmlContext() { xmlSpace = XmlSpace.None; xmlLang = string.Empty; defaultNamespace = string.Empty; previousContext = null; }
/// <summary> /// Create a new document from "reader", with whitespace handling controlled according to "space". /// </summary> public XPathDocument(XmlReader reader, XmlSpace space) { if (reader == null) throw new ArgumentNullException(nameof(reader)); LoadFromReader(reader, space); }
private XPathNavigator GetXPathDocumentNavigator(XmlNode node, XmlSpace space) { XmlNodeReader xr = new XmlNodeReader(node); xpathDocument = new XPathDocument(xr, space); return(xpathDocument.CreateNavigator()); }
public XmlParserContext(XmlNameTable?nt, XmlNamespaceManager?nsMgr, string?docTypeName, string?pubId, string?sysId, string?internalSubset, string?baseURI, string?xmlLang, XmlSpace xmlSpace, Encoding?enc) { if (nsMgr != null) { if (nt == null) { _nt = nsMgr.NameTable; } else { if ((object)nt != (object?)nsMgr.NameTable) { throw new XmlException(SR.Xml_NotSameNametable, string.Empty); } _nt = nt; } } else { _nt = nt; } _nsMgr = nsMgr; _docTypeName = (null == docTypeName ? string.Empty : docTypeName); _pubId = (null == pubId ? string.Empty : pubId); _sysId = (null == sysId ? string.Empty : sysId); _internalSubset = (null == internalSubset ? string.Empty : internalSubset); _baseURI = (null == baseURI ? string.Empty : baseURI); _xmlLang = (null == xmlLang ? string.Empty : xmlLang); _xmlSpace = xmlSpace; _encoding = enc; }
private void AddSpaceControls(XmlQualifiedName[] names, XmlSpace result, XPathNavigator styleElem) { foreach (XmlQualifiedName key in names) { this.spaceControls[key] = result; } }
public XmlParserContext( XmlNameTable nt, XmlNamespaceManager nsMgr, string docTypeName, string pubId, string sysId, string internalSubset, string baseURI, string xmlLang, XmlSpace xmlSpace) : this( nt, nsMgr, docTypeName, pubId, sysId, internalSubset, baseURI, xmlLang, xmlSpace, null ) { }
internal XmlContext(XmlContext previousContext) { this.xmlSpace = previousContext.xmlSpace; this.xmlLang = previousContext.xmlLang; this.defaultNamespace = previousContext.defaultNamespace; this.previousContext = previousContext; }
/// <summary> /// Initializes a new instance of the XPathDocument class from the XML data in the file specified with the white space handling specified. /// </summary> /// <param name="uri">The path of the file that contains the XML data.</param> /// <param name="space">An XmlSpace object.</param> /// <returns>A new instance of the XPathDocument class.</returns> public static XPathDocument CreateXPathDocument(string uri, XmlSpace space) { using (XmlReader xr = XmlReader.Create(uri, SafeXmlFactory.defaultSettings)) { return(CreateXPathDocument(xr, space)); } }
private void AddSpaceControls(QName [] names, XmlSpace result, XPathNavigator styleElem) { // XSLT 3.4 - This implementation recovers from errors. foreach (QName name in names) { spaceControls [name] = result; } }
public XPathDocument(XmlReader reader, XmlSpace space) { if (reader == null) { throw new ArgumentNullException("reader"); } this.LoadFromReader(reader, space); }
// Constructors. public XmlParserContext (XmlNameTable nt, XmlNamespaceManager nsMgr, String xmlLang, XmlSpace xmlSpace) : this(nt, nsMgr, null, null, null, null, "", xmlLang, xmlSpace, null) { }
public XPathNavigator CreateNavigator(int nodeQuota, XmlSpace space) { if (nodeQuota <= 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("nodeQuota", System.ServiceModel.SR.GetString("FilterQuotaRange"))); } return(new SeekableMessageNavigator(this.CreateMessage(), nodeQuota, space, true, true)); }
internal void Set(string prefix, string localName, string namespaceUri, int prevNSTop) { this.prevNSTop = prevNSTop; this.prefix = prefix; this.namespaceUri = namespaceUri; this.localName = localName; this.xmlSpace = (System.Xml.XmlSpace)(int)-1; this.xmlLang = null; }
public static XPathDocument CreateXPathDocument(XmlReader reader, XmlSpace space) { if (reader.Settings != null && reader.Settings.DtdProcessing != DtdProcessing.Prohibit) { throw new XmlDtdException(); } return(new XPathDocument(reader, space)); }
internal XmlElementReference(XmlContainerReference parent, SourceContext sourceContext, SourceContext startTagContext, bool beginTracking) : base(parent, parent.TextBuffer, sourceContext, beginTracking) { if (beginTracking && startTagContext.EndCol > startTagContext.StartCol) { this.startTagRange = XamlSourceContext.ToTextRange(this.TextBuffer, startTagContext); } this.xmlSpace = parent.XmlSpace; }
/// <summary> /// Create a new document from "reader", with whitespace handling controlled according to "space". /// </summary> public XPathDocument(XmlReader reader, XmlSpace space) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } LoadFromReader(reader, space); }
internal void Set(string prefix, string localName, string namespaceUri, int prevNSTop) { this.prevNSTop = prevNSTop; this.prefix = prefix; this.namespaceUri = namespaceUri; this.localName = localName; this.xmlSpace = (System.Xml.XmlSpace)(int) - 1; this.xmlLang = null; }
/// <summary> /// Attribute objects are reused during parsing to reduce memory allocations, /// hence the Reset method. /// </summary> public void Reset(string name, XmlNodeType nt, string value) { this.Value = value; this.Name = name; this.NodeType = nt; this.Space = XmlSpace.None; this.XmlLang = null; this.IsEmpty = true; this.attributes.Count = 0; this.DtdType = null; }
internal bool mixed; // whether to pretty print the contents of this element. internal void Init( int nsTop ) { name = null; defaultNs = String.Empty; defaultNsState = NamespaceState.Uninitialized; xmlSpace = XmlSpace.None; xmlLang = null; prevNsTop = nsTop; prefixCount = 0; mixed = false; }
public XPathNavigator CreateNavigator (int node_quota, XmlSpace space) { if (nav_cache == null) { DTMXPathDocumentWriter2 pw = new DTMXPathDocumentWriter2 (new NameTable (), node_quota); XmlDictionaryWriter w = XmlDictionaryWriter.CreateDictionaryWriter (pw); CreateMessage ().WriteMessage (w); nav_cache = pw.CreateDocument ().CreateNavigator (); } return nav_cache.Clone (); }
public static XPathDocument CreateXPathDocument(string uri, XmlSpace space) { XPathDocument result; using (XmlReader xmlReader = XmlReader.Create(uri, SafeXmlFactory.defaultSettings)) { result = SafeXmlFactory.CreateXPathDocument(xmlReader, space); } return(result); }
public DTMXPathDocumentBuilder2 (string url, XmlSpace space, int defaultCapacity) { XmlReader r = null; try { r = new XmlTextReader (url); Init (r, space, defaultCapacity); } finally { if (r != null) r.Close (); } }
internal void Init(string name, string nspace, string prefix, XmlSpace space, string lang, bool mixed) { this.scopes = null; this.name = name; this.nsUri = nspace; this.prefix = prefix; this.space = space; this.lang = lang; this.mixed = mixed; this.toCData = false; this.htmlElementProps = null; }
/// <summary> /// Create a new document and load the content from the Uri, with whitespace handling controlled according to "space". /// </summary> public XPathDocument(string uri, XmlSpace space) { XmlTextReaderImpl reader = SetupReader(new XmlTextReaderImpl(uri)); try { LoadFromReader(reader, space); } finally { reader.Close(); } }
/// <summary> /// Attribute objects are reused during parsing to reduce memory allocations, /// hence the Reset method. /// </summary> public void Reset(string name, XmlNodeType nt, string value) { _value = value; _name = name; _nodeType = nt; _space = XmlSpace.None; _xmlLang = null; _isEmpty = true; _attributes.Count = 0; _dtdType = null; }
public override bool Read() { if (_IsScanner && base.Read()) { _PrevXmlLang = _XmlLang; _PrevXmlSpace = _XmlSpace; _PrevLineNum = this.LineNumber; _PrevLinePos = this.LinePosition; return true; } else { return ProduceExtraNodes(); } }
/// <summary> /// Attribute objects are reused during parsing to reduce memory allocations, /// hence the Reset method. /// </summary> public void Reset(string name, XmlNodeType nt, string value) { Value = value; Name = name; NodeType = nt; Space = XmlSpace.None; XmlLang = null; IsEmpty = true; _attributes.Count = 0; DtdType = null; }
public XPathNavigator CreateNavigator(int nodeQuota, XmlSpace space) { if (nav_cache == null) { DTMXPathDocumentWriter2 pw = new DTMXPathDocumentWriter2(new NameTable(), nodeQuota); XmlDictionaryWriter w = XmlDictionaryWriter.CreateDictionaryWriter(pw); CreateMessage().WriteMessage(w); nav_cache = pw.CreateDocument().CreateNavigator(); } return(nav_cache.Clone()); }
public void method_0(string A_0, XmlNodeType A_1, string A_2) { this.string_0 = A_2; this.string_2 = A_0; this.xmlNodeType_0 = A_1; this.xmlSpace_0 = XmlSpace.None; this.string_1 = null; this.bool_0 = true; this.class830_0.method_1(0); this.class636_0 = null; }
internal void PopScope() { if (this.contextItemCount == 0) { throw new XmlException("Unexpected end of element scope."); } this.contextItemCount--; XmlParserContext.ContextItem contextItem = (XmlParserContext.ContextItem) this.contextItems[this.contextItemCount]; this.baseURI = contextItem.BaseURI; this.xmlLang = contextItem.XmlLang; this.xmlSpace = contextItem.XmlSpace; }
internal void Init(string name, string nspace, string prefix, XmlSpace space, string lang, bool mixed) { this.scopes = null; _name = name; _nsUri = nspace; _prefix = prefix; _space = space; _lang = lang; _mixed = mixed; _toCData = false; _htmlElementProps = null; }
private bool HasStripSpace(IDictionary table) { foreach (object obj in table.Values) { XmlSpace xmlSpace = (XmlSpace)((int)obj); if (xmlSpace == XmlSpace.Default) { return(true); } } return(false); }
public XPathDocument(string uri, XmlSpace space) { XmlTextReaderImpl reader = this.SetupReader(new XmlTextReaderImpl(uri)); try { this.LoadFromReader(reader, space); } finally { reader.Close(); } }
public XPathDocument (string uri, XmlSpace space) { XmlValidatingReader vr = null; try { vr = new XmlValidatingReader (new XmlTextReader (uri)); vr.ValidationType = ValidationType.None; Initialize (vr, space); } finally { if (vr != null) vr.Close (); } }
internal override bool ReadAttributeValue(EntityHandling ehMode) { if ( this.PartialContentNodeType == XmlNodeType.Attribute) { return Read(); } if(!_IsScanner) { return ProduceExtraNodes(); } if (base.ReadAttributeValue(ehMode)) { _PrevXmlLang = _XmlLang; _PrevXmlSpace = _XmlSpace; return true; } return false; }
private void Init (XmlReader reader, XmlSpace space, int defaultCapacity) { this.xmlReader = reader; this.validatingReader = reader as XmlValidatingReader; lineInfo = reader as IXmlLineInfo; this.xmlSpace = space; this.nameTable = reader.NameTable; nodeCapacity = defaultCapacity; attributeCapacity = nodeCapacity; idTable = new Hashtable (); nodes = new DTMXPathLinkedNode [nodeCapacity]; attributes = new DTMXPathAttributeNode [attributeCapacity]; namespaces = new DTMXPathNamespaceNode [0]; Compile (); }
public XmlParserContext (XmlNameTable nt, XmlNamespaceManager nsMgr, String docTypeName, String pubId, String sysId, String internalSubset, String baseURI, String xmlLang, XmlSpace xmlSpace, Encoding enc) { // set up the name table and namespace manager if(nsMgr != null && nt != null && nsMgr.NameTable != nt) { throw new XmlException(S._("Xml_WrongNameTable")); } else if(nt == null) { if(nsMgr == null) { nsMgr = new XmlNamespaceManager(new NameTable()); } nametable = nsMgr.NameTable; } else { nametable = nt; } namespacemanager = nsMgr; // set various properties doctypename = (docTypeName == null) ? "" : docTypeName; publicid = (pubId == null) ? "" : pubId; systemid = (sysId == null) ? "" : sysId; internalsubset = (internalSubset == null) ? "" : internalSubset; encoding = enc; // set up scoped values baseURI = (baseURI == null) ? "" : baseURI; xmlLang = (xmlLang == null) ? "" : xmlLang; stackmanager = new StackManager(baseURI, xmlLang, xmlSpace); }
public XmlParserContext ( XmlNameTable nt, XmlNamespaceManager nsMgr, string xmlLang, XmlSpace xmlSpace, Encoding enc) : this ( nt, nsMgr, null, null, null, null, null, xmlLang, xmlSpace, enc ) { }
internal XmlEntityReader(XmlScanner scanner, XmlNameTable nt, XmlNamespaceManager nsMgr, XmlNodeType node, String entityName, int depth, Encoding encoding, String baseURI, bool isExternal, bool isAttributeText, bool standAlone, String originalBaseURI) : base((scanner == null ? new XmlScanner(new StringReader("a"), nt) : scanner), nt, nsMgr, node, depth, encoding, baseURI, isExternal, standAlone) { if (scanner == null) { _IsScanner = false; _AttributeTextToken = new XmlNSAttributeTokenInfo(_Scanner, _NsMgr, XmlNodeType.Text, Normalization, _XmlNs); _AttributeTextToken.Value = String.Empty; _AttributeTextToken.Depth = depth + 1; } else { _IsScanner = true; } _IsExternal = isExternal; //We only need to return the EndEntity token when EntityHandling = ExpandCharEntity _EndEntityToken = new XmlNameValueTokenInfo(_Scanner, _NsMgr, XmlNodeType.EndEntity, depth-1, String.Empty, false); _EndEntityToken.Name = entityName; _EndEntityEncoding = encoding; _IsAttributeText = isAttributeText; _PrevXmlSpace = XmlSpace.None; _PrevXmlLang = String.Empty; _OriginalBaseUri = originalBaseURI; }
public static ArrayList ExtractFromAlchemyKeywordXML(Stream xmlStream) { XmlReader r = XmlReader.Create(xmlStream); XmlSpace sp = new XmlSpace(); XPathDocument doc = new XPathDocument(r); XPathNavigator nav = doc.CreateNavigator(); //XmlNamespaceManager manager = new XmlNamespaceManager(nav.NameTable); //manager.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); //manager.AddNamespace("aapi", "http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema#"); //manager.AddNamespace("owl", "http://www.w3.org/2002/07/owl#"); //manager.AddNamespace("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#"); //manager.AddNamespace("base", "http://rdf.alchemyapi.com/rdf/v1/r/response.rdf"); //XPathNodeIterator iter = nav.Select("//rdf:Description[contains(@rdf:ID,'-gk_')]/aapi:Name", manager); XPathNodeIterator iter = nav.Select("//keyword/text"); ArrayList keywords = new ArrayList(); while (iter.MoveNext()) keywords.Add(iter.Current.Value); return keywords; }
/// <include file='doc\XmlParserContext.uex' path='docs/doc[@for="XmlParserContext.XmlParserContext2"]/*' /> public XmlParserContext(XmlNameTable nt, XmlNamespaceManager nsMgr,String xmlLang, XmlSpace xmlSpace, Encoding enc) : this(nt, nsMgr, null, null, null, null, String.Empty, xmlLang, xmlSpace, enc) { // Intentionally Empty }
public void AddSpaceAttribute(XmlSpace space) { AddAttribute(); _space = space; }
public void ExitScope() { while (_nsCount > 0) { Namespace nameSpace = _namespaces[_nsCount - 1]; if (nameSpace.Depth != _depth) break; PrefixHandleType shortPrefix; if (nameSpace.Prefix.TryGetShortPrefix(out shortPrefix)) { _shortPrefixUri[(int)shortPrefix] = nameSpace.OuterUri; } _nsCount--; } while (_attributeCount > 0) { XmlAttribute attribute = _attributes[_attributeCount - 1]; if (attribute.Depth != _depth) break; _space = attribute.XmlSpace; _lang = attribute.XmlLang; _attributeCount--; } _depth--; }
public void Clear() { if (_nsCount != 0) { if (_shortPrefixUri != null) { for (int i = 0; i < _shortPrefixUri.Length; i++) { _shortPrefixUri[i] = null; } } _shortPrefixUri[(int)PrefixHandleType.Empty] = s_emptyNamespace; _nsCount = 0; } _attributeCount = 0; _space = XmlSpace.None; _lang = string.Empty; _depth = 0; }
public NamespaceManager(XmlBufferReader bufferReader) { _bufferReader = bufferReader; _shortPrefixUri = new Namespace[(int)PrefixHandleType.Max]; _shortPrefixUri[(int)PrefixHandleType.Empty] = s_emptyNamespace; _namespaces = null; _nsCount = 0; _attributes = null; _attributeCount = 0; _space = XmlSpace.None; _lang = string.Empty; _depth = 0; }
private void AddSpaceControls (QName [] names, XmlSpace result, XPathNavigator styleElem) { // XSLT 3.4 - This implementation recovers from errors. foreach (QName name in names) spaceControls [name] = result; }
private XPathNavigator GetXPathDocumentNavigator (XmlNode node, XmlSpace space) { XmlNodeReader xr = new XmlNodeReader (node); xpathDocument = new XPathDocument (xr, space); return xpathDocument.CreateNavigator (); }