Class XmlUtils
Static methods which helps with XmlElement
Inheritance
object
XmlUtils
Namespace: BuildSystem.Utils.Xml
Assembly: BuildSystem.Utils.dll
Syntax
public class XmlUtils : Object
Constructors
XmlUtils()
Declaration
public XmlUtils()
Methods
createNodeWithAttributes(string, Dictionary<string, string>, XmlElement, XmlDocument)
Create new node with list of attributes and without any value
Declaration
public static XmlElement createNodeWithAttributes(string nodeName, Dictionary<string, string> values, XmlElement parentNode, XmlDocument doc)
Parameters
Type | Name | Description |
---|---|---|
string | nodeName | Name of creating node |
System.Collections.Generic.Dictionary<,><string, string> | values | Dictionary of attributes |
System.Xml.XmlElement | parentNode | Parent node |
System.Xml.XmlDocument | doc | Xml document |
Returns
Type | Description |
---|---|
System.Xml.XmlElement |
createNodeWithText(string, string, XmlElement, XmlDocument)
Creates new node with value
Declaration
public static void createNodeWithText(string nodeName, string nodeText, XmlElement parentNode, XmlDocument doc)
Parameters
Type | Name | Description |
---|---|---|
string | nodeName | Name of creating node |
string | nodeText | Value of node |
System.Xml.XmlElement | parentNode | Parent node |
System.Xml.XmlDocument | doc | Xml document |
nodeHasChild(XmlElement, string)
Check child of node and search specific one. Case is ignored
Declaration
public static bool nodeHasChild(XmlElement parentNode, string childName)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlElement | parentNode | Node which child nodes are analyzing |
string | childName | name of searching child |
Returns
Type | Description |
---|---|
bool | Flag of existing |
readXmlWithReplaces(string, Dictionary<string, string?>)
Creates copy of source file - with replaces. Then reads this copy into result and deletes temp file
Declaration
public static XmlDocument readXmlWithReplaces(string fileName, Dictionary<string, string?> replaceRules)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | File to read |
System.Collections.Generic.Dictionary<,><string, string> | replaceRules | Rules to replace into reading file |
Returns
Type | Description |
---|---|
System.Xml.XmlDocument | XML object after replacing |