Class DOMUtils
Helper methods for parsing XML
Inheritance
System.Object
DOMUtils
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Lucene.Net.QueryParser.dll
Syntax
public static class DOMUtils
Methods
|
Improve this Doc
View Source
GetAttribute(XmlElement, String, Boolean)
Declaration
public static bool GetAttribute(XmlElement element, string attributeName, bool deflt)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
element |
|
System.String |
attributeName |
|
System.Boolean |
deflt |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
GetAttribute(XmlElement, String, Int32)
Declaration
public static int GetAttribute(XmlElement element, string attributeName, int deflt)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
element |
|
System.String |
attributeName |
|
System.Int32 |
deflt |
|
Returns
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
GetAttribute(XmlElement, String, Single)
Declaration
public static float GetAttribute(XmlElement element, string attributeName, float deflt)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
element |
|
System.String |
attributeName |
|
System.Single |
deflt |
|
Returns
Type |
Description |
System.Single |
|
|
Improve this Doc
View Source
GetAttribute(XmlElement, String, String)
Declaration
public static string GetAttribute(XmlElement element, string attributeName, string deflt)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
element |
|
System.String |
attributeName |
|
System.String |
deflt |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
GetAttributeOrFail(XmlElement, String)
Declaration
public static string GetAttributeOrFail(XmlElement e, string name)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
e |
|
System.String |
name |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
GetAttributeWithInheritance(XmlElement, String)
Returns an attribute value from this node, or first parent node with this attribute defined
Declaration
public static string GetAttributeWithInheritance(XmlElement element, string attributeName)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
element |
|
System.String |
attributeName |
|
Returns
Type |
Description |
System.String |
A non-zero-length value if defined, otherwise null
|
|
Improve this Doc
View Source
GetAttributeWithInheritanceOrFail(XmlElement, String)
Declaration
public static string GetAttributeWithInheritanceOrFail(XmlElement e, string name)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
e |
|
System.String |
name |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
GetChildByTagName(XmlElement, String)
Convenience method where there is only one child System.Xml.XmlElement of a given name
Declaration
public static XmlElement GetChildByTagName(XmlElement e, string name)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
e |
|
System.String |
name |
|
Returns
Type |
Description |
System.Xml.XmlElement |
|
|
Improve this Doc
View Source
GetChildByTagOrFail(XmlElement, String)
Declaration
public static XmlElement GetChildByTagOrFail(XmlElement e, string name)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
e |
|
System.String |
name |
|
Returns
Type |
Description |
System.Xml.XmlElement |
|
|
Improve this Doc
View Source
GetChildTextByTagName(XmlElement, String)
Convenience method where there is only one child System.Xml.XmlElement of a given name
Declaration
public static string GetChildTextByTagName(XmlElement e, string tagName)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
e |
|
System.String |
tagName |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
GetFirstChildElement(XmlElement)
Declaration
public static XmlElement GetFirstChildElement(XmlElement element)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
element |
|
Returns
Type |
Description |
System.Xml.XmlElement |
|
|
Improve this Doc
View Source
GetFirstChildOrFail(XmlElement)
Declaration
public static XmlElement GetFirstChildOrFail(XmlElement e)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
e |
|
Returns
Type |
Description |
System.Xml.XmlElement |
|
|
Improve this Doc
View Source
GetNonBlankTextOrFail(XmlElement)
Declaration
public static string GetNonBlankTextOrFail(XmlElement e)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
e |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
GetText(XmlNode)
Declaration
public static string GetText(XmlNode e)
Parameters
Type |
Name |
Description |
System.Xml.XmlNode |
e |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
InsertChild(XmlElement, String, String)
Convenience method to append a new child with text
Declaration
public static XmlElement InsertChild(XmlElement parent, string tagName, string text)
Parameters
Type |
Name |
Description |
System.Xml.XmlElement |
parent |
|
System.String |
tagName |
|
System.String |
text |
|
Returns
Type |
Description |
System.Xml.XmlElement |
|
|
Improve this Doc
View Source
LoadXML(Stream)
Helper method to parse an XML file into a DOM tree, given a System.IO.Stream.
Declaration
public static XmlDocument LoadXML(Stream input)
Parameters
Type |
Name |
Description |
System.IO.Stream |
input |
reader of the XML file to be parsed
|
Returns
Type |
Description |
System.Xml.XmlDocument |
an System.Xml.XmlDocument object
|
|
Improve this Doc
View Source
LoadXML(TextReader)
Helper method to parse an XML file into a DOM tree, given a System.IO.TextReader.
Declaration
public static XmlDocument LoadXML(TextReader input)
Parameters
Type |
Name |
Description |
System.IO.TextReader |
input |
reader of the XML file to be parsed
|
Returns
Type |
Description |
System.Xml.XmlDocument |
an System.Xml.XmlDocument object
|
|
Improve this Doc
View Source
LoadXML(XmlReader)
Helper method to parse an XML file into a DOM tree, given an System.Xml.XmlReader.
Declaration
public static XmlDocument LoadXML(XmlReader input)
Parameters
Type |
Name |
Description |
System.Xml.XmlReader |
input |
reader of the XML file to be parsed
|
Returns
Type |
Description |
System.Xml.XmlDocument |
an System.Xml.XmlDocument object
|