internal HtmlNode(XmlNodeType nodeType, NodePosition parsedPosition) : this(parsedPosition) { SetNodeId(); Debug.Assert(nodeType == XmlNodeType.Document); if (nodeType != XmlNodeType.Document) { throw new HtmlParserException("This constructor can only be called for XmlNodeType.Document node type."); } Debug.Assert(this is HtmlDocument); Debug.Assert(this is HtmlDocument); m_Doc = this as HtmlDocument; m_XmlNode = (this as HtmlDocument).m_XmlDoc; m_UpperName = null; m_Attributes = new HtmlAttributeCollection(this); m_ChildNodeList = new HtmlNodeList(m_XmlNode.ChildNodes); }
internal HtmlNode( XmlNodeType nodeType, string name, string publicId, string systemId, string internalSubset, HtmlDocument doc, NodePosition parsedPosition) : this(parsedPosition) { SetNodeId(); //m_Doc = doc; Debug.Assert(nodeType == XmlNodeType.DocumentType); if (nodeType != XmlNodeType.DocumentType) { throw new HtmlParserException("This constructor can only be called for XmlNodeType.DocumentType node type."); } XmlRefDocumentType att = new XmlRefDocumentType(name, publicId, systemId, internalSubset, doc.m_XmlDoc, this); InitXmlNode(att as XmlNode, doc); }
internal HtmlElement CreateElement( string prefix, string localName, string namespaceURI, bool isEmptyTag, NodePosition parsedPosition) { HtmlElement element = null; Type customType = null; if (s_TagMappersAndStructureProviders.Count > 0) { try { Debug.Assert(localName != null); customType = s_TagMappersAndStructureProviders[localName.ToLower(CultureInfo.InvariantCulture)]; } catch (KeyNotFoundException) { customType = null; } } if (customType != null) { // NOTE: create the element using reflection or use a factory class for faster creation, but still register them the same way throw new NotImplementedException("Custom tag mappers are not supported yet."); } else { switch (m_HtmlDtd) { case HtmlDtd.Html32: case HtmlDtd.Html401: case HtmlDtd.Html401Transitional: case HtmlDtd.Html401Frameset: case HtmlDtd.XhtmlStrict: case HtmlDtd.XhtmlTransitional: case HtmlDtd.XhtmlFrameset: element = Html.Specialized.Html401.Factory.CreateHtml401Element(prefix, localName, namespaceURI, this, isEmptyTag, parsedPosition); if (element == null) { element = Html.Specialized.HtmlProprietary.Factory.CreateHtmlProprietaryElement(prefix, localName, namespaceURI, this, isEmptyTag, parsedPosition); } if (element == null) { element = Html.Specialized.HtmlNetscape.Factory.CreateHtmlNetscapeElement(prefix, localName, namespaceURI, this, isEmptyTag, parsedPosition); } break; default: throw new HtmlParserException("Invalid HTML DTD."); } } if (element == null) { return(new HtmlElement(prefix, localName, namespaceURI, this, isEmptyTag, parsedPosition)); } else { return(element); } }
internal HtmlAttribute(string prefix, string localName, string namespaceURI, HtmlDocument doc, NodePosition parsedPosition, string attValue, bool decodeValue) : base(XmlNodeType.Attribute, prefix, localName, namespaceURI, doc, parsedPosition) { if (prefix == "xmlns" && string.IsNullOrEmpty(attValue)) { attValue = "http://schemas.acruxsoftware.net/missing-namespace-uri"; m_NodePosition = NodePosition.ReadOnly; } if (decodeValue) { m_XmlNode.Value = HttpUtility.HtmlDecode(attValue); } else { m_XmlNode.Value = attValue; } }
internal HtmlNode(XmlNodeType nodeType, string prefix, string localName, string namespaceURI, HtmlDocument doc, NodePosition parsedPosition) : this(parsedPosition) { SetNodeId(); Debug.Assert(doc != null); //m_Doc = doc; if (nodeType == XmlNodeType.Attribute) { XmlRefAttribute att = new XmlRefAttribute(prefix, localName, namespaceURI, doc.m_XmlDoc, this); InitXmlNode(att as XmlNode, doc); } else if (nodeType == XmlNodeType.Element) { XmlRefElement att = new XmlRefElement(prefix, localName, namespaceURI, doc.m_XmlDoc, this); InitXmlNode(att as XmlNode, doc); } else { Debug.Assert(false); throw new HtmlParserException(); } }
internal HtmlNode(XmlNodeType nodeType, string target, string data, HtmlDocument doc, NodePosition parsedPosition) : this(parsedPosition) { SetNodeId(); //m_Doc = doc; Debug.Assert(nodeType == XmlNodeType.ProcessingInstruction); if (nodeType != XmlNodeType.ProcessingInstruction) { throw new HtmlParserException("This constructor can only be called for XmlNodeType.ProcessingInstruction"); } XmlRefProcessingInstruction att = new XmlRefProcessingInstruction(target, data, doc.m_XmlDoc, this); InitXmlNode(att as XmlNode, doc); }
internal HtmlNode(XmlNodeType nodeType, string commentOrText, HtmlDocument doc, NodePosition parsedPosition) : this(parsedPosition) { SetNodeId(); // m_Doc = doc; Debug.Assert(nodeType == XmlNodeType.Comment || nodeType == XmlNodeType.Text || nodeType == XmlNodeType.XmlDeclaration); if (nodeType != XmlNodeType.Comment && nodeType != XmlNodeType.Text && nodeType != XmlNodeType.XmlDeclaration) { throw new HtmlParserException("This constructor can only be called for XmlNodeType.Comment or XmlNodeType.Text or XmlNodeType.XmlDeclaration node types."); } if (nodeType == XmlNodeType.Comment) { XmlRefComment att = new XmlRefComment(commentOrText, doc.m_XmlDoc, this); InitXmlNode(att as XmlNode, doc); } else if (nodeType == XmlNodeType.Text) { XmlRefText att = new XmlRefText(commentOrText, doc.m_XmlDoc, this); InitXmlNode(att as XmlNode, doc); } else if (nodeType == XmlNodeType.XmlDeclaration) { XmlRefXmlDeclaration att = new XmlRefXmlDeclaration(doc.m_XmlDoc, this); InitXmlNode(att as XmlNode, doc); } else { Debug.Assert(false); throw new HtmlParserException(); } }
private HtmlNode(NodePosition parsedPosition) { m_NodePosition = parsedPosition; }
internal HtmlElement(string prefix, string localName, string namespaceURI, HtmlDocument doc, bool isEmptyTag, NodePosition parsedPosition) : base(XmlNodeType.Element, prefix, localName, namespaceURI, doc, parsedPosition) { m_IsEmptyTag = isEmptyTag; base.OnChildAppending += new OnChildAppendingDelegate(ChildAppending); }