Chilkat VB.NET Xml Class Reference

Xml

A free non-validating XML parser component with encryption and compression features.

Object Creation

(C#)
Chilkat.Xml obj = new Chilkat.Xml();
(VB.NET)
Dim obj As New Chilkat.Xml()

Properties

Cdata As Boolean

When True, causes an XML node's content to be encapsulated in a CDATA section.

(VB.NET) Using CDATA in XML

(PowerShell) Using CDATA in XML

Content As String

The content of the XML node. It is the text between the open and close tags, not including child nodes. For example:

<tag1>This is the content</tag1>

<tag2><child1>abc</child1><child2>abc</child2>This is the content</tag2>
Because the child nodes are not included, the content of "tag1" and "tag2" are both equal to "This is the content".

Content vs. Children: A common misconception explained.

(VB.NET) Setting XML Tag and Content

(PowerShell) Setting XML Tag and Content

ContentInt As Integer

Set/get the content as an integer.

DocType As String

The DOCTYPE declaration (if any) for the XML document.

(VB.NET) Setting the XML DOCTYPE

(PowerShell) Setting the XML DOCTYPE

Encoding As String

This is the encoding attribute in the XML declaration, such as "utf-8" or "iso-8859-1". If not present, this property returns an empty string. This property can be set from any node in the XML document and when set, causes the encoding property to be added to the XML declaration. Setting this property does not cause the document to be converted to a different encoding.

LastErrorHtml As String (ReadOnly)

Error information in HTML format for the last method called.

LastErrorText As String (ReadOnly)

Error information in plain-text format for the last method called.

LastErrorXml As String (ReadOnly)

Error information in XML format for the last method called.

NumAttributes As Integer (ReadOnly)

The number of attributes. For example, the following node has 2 attributes:

<tag attr1="value1" attr2="value2"> This is the content</tag>

(VB.NET) Methods for Getting Attributes

(PowerShell) Methods for Getting Attributes

NumChildren As Integer (ReadOnly)

The number of direct child nodes contained under this XML node.

SortCaseInsensitive As Boolean

If true (or 1 for ActiveX), then all Sort* methods use case insensitive sorting.

Standalone As Boolean

This is the standalone attribute in the XML declaration. This property can be set from any node in the XML document. A value of True adds a standalone="yes" to the XML declaration:

<?xml ... standalone="yes">

Tag As String

The XML node's tag.

(VB.NET) Setting XML Tag and Content

(PowerShell) Setting XML Tag and Content

TreeId As Integer (ReadOnly)

Each tree (or XML document) has a unique TreeId. This is the ID of the tree, and can be used to determine if two Xml objects belong to the same tree.

Version As String (ReadOnly)

The version of the XML component, such as "2.0.0".

Methods

Function AccumulateTagContent(ByVal tag As String, ByVal skipTags As String) As String

Accumulates the content of all nodes having a specific tag into a single result string. SkipTags specifies a set of tags whose are to be avoided. The skipTags are formatted as a string of tags delimited by vertical bar characters. All nodes in sub-trees rooted with a tag appearing in skipTags are not included in the result.

Returns Nothing on failure

Function AddAttribute(ByVal name As String, ByVal value As String) As Boolean

Adds an attribute to the calling node in the XML document. Returns True for success, and False for failure.

(VB.NET) Adding Attributes to an XML Node

(PowerShell) Adding Attributes to an XML Node

(VB.NET) AddAttribute - Insert New Attribute in XML Node

Function AddAttributeInt(ByVal name As String, ByVal value As Integer) As Boolean

Adds an integer attribute to a node.

Function AddChildTree(ByVal tree As Xml) As Boolean

Adds an entire subtree as a child. If the child was a subtree within another Xml document then the subtree is effectively transferred from one XML document to another.

Sub AddOrUpdateAttribute(ByVal name As String, ByVal value As String)

Adds an attribute to an XML node. If an attribute having the specified name already exists, the value is updated.

(VB.NET) Update an XML Attribute

(PowerShell) Update an XML Attribute

Sub AddOrUpdateAttributeI(ByVal name As String, ByVal value As Integer)

Adds an integer attribute to an XML node. If an attribute having the specified name already exists, the value is updated.

Sub AddStyleSheet(ByVal styleSheet As String)

Adds a style sheet declaration to the XML document. The styleSheet should be a string such as:

<?xml-stylesheet href="mystyle.css" title="Compact" type="text/css"?>

Sub AddToAttribute(ByVal name As String, ByVal amount As Integer)

Adds an integer amount to an integer attribute's value. If the attribute does not yet exist, this method behaves the same as AddOrUpdateAttributeI.

(VB.NET) Update an XML Attribute

(PowerShell) Update an XML Attribute

Sub AddToChildContent(ByVal tag As String, ByVal amount As Integer)

Adds an integer value to the content of a child node.

Sub AddToContent(ByVal amount As Integer)

Adds an integer amount to the node's content.

Function AppendToContent(ByVal str As String) As Boolean

Appends text to the content of an XML node

Function BEncodeContent(ByVal charset As String, ByVal inData As Byte()) As Boolean

Sets the node's content with 8bit data that is in a specified multibyte character encoding such as utf-8, shift-jis, big5, etc. The data is first B-encoded and the content is set to be the B-encoded string. For example, if called with "Big5"for the charset, you would get a string that looks something like this: "=?Big5?B?pHCtsw==?=". The data is Base64-encoded and stored between the last pair of "?" delimiters. Use the DecodeContent method to retrieve the byte data from a B encoded string.

Function ChildContentMatches(ByVal tag As String, ByVal pattern As String, ByVal caseSensitive As Boolean) As Boolean

Return true if a child having a specific tag contains content that matches a wildcarded pattern.

Function ChilkatPath(ByVal pathCmd As String) As String

Follows a series of commands to navigate through an XML document to return a piece of data or update the caller's reference to a new XML document node.

Note: This method not related to the XPath (XML Path) standard in any way.

The pathCmd is formatted as a series of commands separated by vertical bar characters, and terminated with a return-command:

    command|command|command|...|returnCommand

A command can be any of the following:

  1. TagName -- Navigate to the 1st direct child with the given tag.
  2. TagName[n] -- Navigate to the Nth direct child with the given tag.
  3. .. -- Navigate up to the parent
  4. TagName{Content} -- Navigate to the 1st direct child with the given tag having the exact content.
  5. /T/TagName -- Traverse the XML DOM tree (rooted at the caller) and navigate to the 1st node having the given tag.
  6. /C/TagName,ContentPattern -- Traverse the XML DOM tree (rooted at the caller) and navigate to the 1st node having the given tag with content that matches the ContentPattern. ContentPattern may use one or more asterisk ('*") characters to represent 0 or more of any character.
  7. /C/ContentPattern -- Traverse the XML DOM tree (rooted at the caller) and navigate to the 1st node having any tag with content that matches the ContentPattern. ContentPattern may use one or more asterisk ('*") characters to represent 0 or more of any character.
  8. /A/TagName,AttrName,AttrValuePattern -- Traverse the XML DOM tree (rooted at the caller) and navigate to the 1st node having the given tag, and attribute, with the attribute value that matches the AttrValuePattern. AttrValuePattern may use one or more asterisk ('*") characters to represent 0 or more of any character.
The returnCommand can be any of the following:
  1. * -- Return the Content of the node.
  2. (AttrName) -- Return the value of the given attribute.
  3. $ -- Update the caller's internal reference to be the node (arrived at by following the series of commands). Returns an empty string.

Returns Nothing on failure

(VB.NET) ChilkatPath Sample Code

Sub Clear()

Removes all children, attributes, and content from the XML node. Resets the tag name to "unnamed".

Function ContentMatches(ByVal pattern As String, ByVal caseSensitive As Boolean) As Boolean

Return true if the node's content matches a wildcarded pattern.

Sub Copy(ByVal node As Xml)

Copies the tag, content, and attributes to the calling node.

Sub CopyRef(ByVal copyFromNode As Xml)

Discards the caller's current internal reference and copies the internal reference from copyFromNode. Effectively updates the caller node to point to the same node in the XML document as copyFromNode.

Function DecodeContent() As Byte()

Decodes a node's Q or B-encoded content string and returns the byte data.

Returns an empty byte array on failure

Function DecodeEntities(ByVal str As String) As String

Utility method to decode HTML entities. It accepts a string containing (potentially) HTML entities and returns a string with the entities decoded.

Returns Nothing on failure

Function DecryptContent(ByVal password As String) As Boolean

Decrypts the content of an XML node that was previously 128-bit AES encrypted with the EncryptContent method.

(VB.NET) Encrypting and Decrypting Content

(PowerShell) Encrypting and Decrypting Content

Function EncryptContent(ByVal password As String) As Boolean

Encrypts the content of the calling XML node using 128-bit CBC AES encryption. The base64-encoded encrypted content replaces the original content.

(VB.NET) Encrypting and Decrypting Content

(PowerShell) Encrypting and Decrypting Content

Function ExtractChildByIndex(ByVal index As Integer) As Xml

Removes and returns the Nth child of an XML node. The first child is at index 0.

Function ExtractChildByName(ByVal tag As String, ByVal attrName As String, ByVal attrValue As String) As Xml

Removes and returns the first child node having a tag equal to the tagName. The attributeName and attrValue may be empty or NULL, in which case the first child matching the tag is removed and returned. If attributeName is specified, then the first child having a tag equal to tagName, and an attribute with attributeName is returned. If attrValue is also specified, then only a child having a tag equal to tagName, and an attribute named attributeName, with a value equal to attrValue is returned.

Function FindChild(ByVal tag As String) As Xml

Returns the child having a specified tag.

(VB.NET) Find Direct Child with Specific Tag

(PowerShell) Find Direct Child with Specific Tag

Function FindChild2(ByVal tag As String) As Boolean

Updates the Xml object's internal reference to point to a child with a specified tag.

(VB.NET) Find Direct Child with Specific Tag

(PowerShell) Find Direct Child with Specific Tag

Function FindNextRecord(ByVal tag As String, ByVal contentPattern As String) As Xml

Returns the next record node where the child with a specific tag matches a wildcarded pattern. This method makes it easy to iterate over high-level records.

Function FindOrAddNewChild(ByVal tag As String) As Xml

First searches for a child having a tag equal to tagName, and if found, returns it. Otherwise creates a new child, sets the tag equal to tagName, and initializes the Content to empty.

Function FirstChild() As Xml

Returns the first child. A program can step through the children by calling FirstChild, and then NextSibling repeatedly.

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function FirstChild2() As Boolean

Updates the internal reference of the caller to point to its first child.

More information about XML methods ending in "2"

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function GetAttrValue(ByVal name As String) As String

Find and return the value of an attribute having a specified name.

Returns Nothing on failure

(VB.NET) Methods for Getting Attributes

(PowerShell) Methods for Getting Attributes

Function GetAttrValueInt(ByVal name As String) As Integer

Returns an attribute as an integer.

(VB.NET) Methods for Getting Attributes

(PowerShell) Methods for Getting Attributes

Function GetAttributeName(ByVal index As Integer) As String

Returns the name of the Nth attribute of an XML node. The first attribute is at index 0.

Returns Nothing on failure

(VB.NET) Methods for Getting Attributes

(PowerShell) Methods for Getting Attributes

Function GetAttributeValue(ByVal index As Integer) As String

Returns the value of the Nth attribute of an XML node. The first attribute is at index 0.

Returns Nothing on failure

(VB.NET) Methods for Getting Attributes

(PowerShell) Methods for Getting Attributes

Function GetAttributeValueInt(ByVal index As Integer) As Integer

Returns an attribute as an integer.

Function GetBinaryContent(ByVal unzipFlag As Boolean, ByVal decryptFlag As Boolean, ByVal password As String) As Byte()

Returns binary content of an XML node as a byte array. The content may have been Zip compressed, AES encrypted, or both. Unzip compression and AES decryption flags should be set appropriately.

Returns an empty byte array on failure

Function GetChild(ByVal index As Integer) As Xml

Returns the Nth child of an XML node

(VB.NET) Iterate over Direct Child Nodes by Index

(PowerShell) Iterate over Direct Child Nodes by Index

Function GetChild2(ByVal index As Integer) As Boolean

Updates the calling object's internal reference to the Nth child node.

Returns true for success, false for failure.

More information about XML methods ending in "2"

(VB.NET) Iterate over Direct Child Nodes by Index

(PowerShell) Iterate over Direct Child Nodes by Index

Function GetChildBoolValue(ByVal tag As String) As Boolean

Returns False if the node's content is "0", otherwise returns True if the node contains a non-zero integer.

Function GetChildContent(ByVal tag As String) As String

Returns the content of a child having a specified tag.

Returns Nothing on failure

Function GetChildContentByIndex(ByVal index As Integer) As String

Returns the content of the Nth child node.

Returns Nothing on failure

(VB.NET) Iterate over Direct Child Nodes by Index

(PowerShell) Iterate over Direct Child Nodes by Index

Function GetChildExact(ByVal tag As String, ByVal content As String) As Xml

Returns the child having the exact tag and content.

Function GetChildIntValue(ByVal tag As String) As Integer

Returns the child integer content for a given tag.

Function GetChildTag(ByVal index As Integer) As String

Returns the tag name of the Nth child node.

Returns Nothing on failure

Function GetChildTagByIndex(ByVal index As Integer) As String

Returns the tag name of the Nth child node.

Returns Nothing on failure

(VB.NET) Iterate over Direct Child Nodes by Index

(PowerShell) Iterate over Direct Child Nodes by Index

Function GetChildWithAttr(ByVal tag As String, ByVal attrName As String, ByVal attrValue As String) As Xml

To be documented soon.

Function GetChildWithContent(ByVal content As String) As Xml

Returns the first child found having the exact content specified.

Function GetChildWithTag(ByVal tag As String) As Xml

Returns the Xml child object having a tag matching tagName.

Function GetNthChildWithTag(ByVal tag As String, ByVal n As Integer) As Xml

Returns the Nth child having a tag that matches exactly with the tagName. Use the NumChildrenHavingTag method to determine how many children have a particular tag.

(VB.NET) Iterate over Direct Children with a Specific Tag

(PowerShell) Iterate over Direct Children with a Specific Tag

Function GetNthChildWithTag2(ByVal tag As String, ByVal n As Integer) As Boolean

Updates the calling object's internal reference to the Nth child node having a specific tag.

Returns true for success, false for failure.

(VB.NET) Iterate over Direct Children with a Specific Tag

(PowerShell) Iterate over Direct Children with a Specific Tag

Function GetParent() As Xml

Returns the parent of this XML node, or NULL if the node is the root of the tree.

Function GetParent2() As Boolean

Updates the internal reference of the caller to its parent.

More information about XML methods ending in "2"

Function GetRoot() As Xml

Returns the root node of the XML document

Sub GetRoot2()

Updates the internal reference of the caller to the document root.

More information about XML methods ending in "2"

Function GetSelf() As Xml

To be documented soon...

Function GetXml() As String

Generate the XML text document for the XML tree rooted at this node.

Returns Nothing on failure

Function HasAttrWithValue(ByVal name As String, ByVal value As String) As Boolean

Returns true if the node contains attribute with the name and value.

Function HasAttribute(ByVal name As String) As Boolean

Returns true if the node contains an attribute with the specified name.

Function HasChildWithContent(ByVal content As String) As Boolean

Returns true if the node has a direct child node containing the exact content string specified.

Function HasChildWithTag(ByVal tag As String) As Boolean

Returns true (1 for ActiveX) if the node has a direct child with a given tag.

Function HasChildWithTagAndContent(ByVal tag As String, ByVal content As String) As Boolean

Returns true if the node contains a direct child having the exact tag and content specified.

Function LastChild() As Xml

Returns the last Xml child node. A node's children can be enumerated by calling LastChild and then repeatedly calling PreviousSibling, until a NULL is returned.

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function LastChild2() As Boolean

Updates the internal reference of the caller to its last child.

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function LoadXml(ByVal xmlData As String) As Boolean

Loads an XML document from a memory buffer and returns True if successful. The contents of the calling node are replaced with the root node of the XML document loaded.

Function LoadXml2(ByVal xmlData As String, ByVal autoTrim As Boolean) As Boolean

Same as LoadXml, but an additional argument controls whether or not leading/trailing whitespace is auto-trimmed from each node's content.

Returns true for success, false for failure.

Function LoadXmlFile(ByVal fileName As String) As Boolean

Loads an XML document from a file and returns True if successful. The contents of the calling node are replaced with the root node of the XML document loaded.

Function LoadXmlFile2(ByVal fileName As String, ByVal autoTrim As Boolean) As Boolean

Same as LoadXmlFile, but an additional argument controls whether or not leading/trailing whitespace is auto-trimmed from each node's content.

Returns true for success, false for failure.

Function NewChild(ByVal tag As String, ByVal content As String) As Xml

Creates a new child having tag and content. The new child is created even if a child with a tag equal to tagName already exists. (Use FindOrAddNewChild to prevent creating children having the same tags.)

(VB.NET) Creating a New Child Node

(PowerShell) Creating a New Child Node

Sub NewChild2(ByVal tag As String, ByVal content As String)

Creates a new child but does not return the node that is created.

(VB.NET) Creating a New Child Node

(PowerShell) Creating a New Child Node

Sub NewChildInt2(ByVal tag As String, ByVal value As Integer)

Inserts a new child having an integer for content.

Function NextSibling() As Xml

Returns the nodes next sibling, or NULL if there are no more.

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function NextSibling2() As Boolean

Updates the internal reference of the caller to its next sibling.

More information about XML methods ending in "2"

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function NumChildrenHavingTag(ByVal tag As String) As Integer

Returns the number of children having a specific tag name.

(VB.NET) Iterate over Direct Children with a Specific Tag

(PowerShell) Iterate over Direct Children with a Specific Tag

Function PreviousSibling() As Xml

Returns the Xml object that is the node's previous sibling, or NULL if there are no more.

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function PreviousSibling2() As Boolean

Updates the internal reference of the caller to its previous sibling.

More information about XML methods ending in "2"

(VB.NET) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

(PowerShell) Traverse Direct Children via FirstChild / NextSibling, or LastChild / PreviousSibling

Function QEncodeContent(ByVal charset As String, ByVal inData As Byte()) As Boolean

Sets the node's content with 8bit data that is in a specified multibyte character encoding such as utf-8, shift-jis, big5, etc. The data is first Q-encoded and the content is set to be the Q-encoded string. For example, if called with "gb2312"for the charset, you would get a string that looks something like this: "=?gb2312?Q?=C5=B5=BB=F9?=". Character that are not 7bit are represented as "=XX" where XX is the hexidecimal value of the byte. Use the DecodeContent method to retrieve the byte data from a Q encoded string.

Function RemoveAllAttributes() As Boolean

Removes all attributes from an XML node. Should always return True.

Sub RemoveAllChildren()

Removes all children from the calling node.

Function RemoveAttribute(ByVal name As String) As Boolean

Removes an attribute by name from and XML node.

Sub RemoveChild(ByVal tag As String)

Removes all direct children with a given tag.

(VB.NET) Removing / Deleting Child Nodes from XML

(PowerShell) Removing / Deleting Child Nodes from XML

Sub RemoveChildByIndex(ByVal index As Integer)

Removes the Nth child from the calling node.

(VB.NET) Removing / Deleting Child Nodes from XML

(PowerShell) Removing / Deleting Child Nodes from XML

Sub RemoveChildWithContent(ByVal content As String)

Removes all children having the exact content specified.

(VB.NET) Removing / Deleting Child Nodes from XML

(PowerShell) Removing / Deleting Child Nodes from XML

Sub RemoveFromTree()

Removes the calling object and its sub-tree from the XML document making it the root of its own tree.

(VB.NET) Removing / Deleting Child Nodes from XML

(PowerShell) Removing / Deleting Child Nodes from XML

Function SaveBinaryContent(ByVal filename As String, ByVal unzipFlag As Boolean, ByVal decryptFlag As Boolean, ByVal password As String) As Boolean

Saves a node's binary content to a file.

Function SaveLastError(ByVal filename As String) As Boolean

Saves the last error information to an XML formatted file.

Function SaveXml(ByVal fileName As String) As Boolean

Generates XML representing the tree or subtree rooted at this node and writes it to a file.

Function SearchAllForContent(ByVal after As Xml, ByVal contentPattern As String) As Xml

Returns the first node whose content matches the contentPattern, which is a case-sensitive string that can use any number of '*'s to represent 0 or more occurances of any character. The search is breadth-first over the sub-tree rooted at the caller, and the previous node returned can be passed to the next call as afterNode to continue the search after that node.

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SearchAllForContent2(ByVal after As Xml, ByVal contentPattern As String) As Boolean

Same as SearchAllForContent except the internal reference of the caller is updated to point to the search result (instead of returning a new object).

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SearchForAttribute(ByVal after As Xml, ByVal tag As String, ByVal attr As String, ByVal valuePattern As String) As Xml

Returns the first node having a tag equal to tagName, and an attribute named attrName whose value matches valuePattern, which is a case-sensitive string that can use any number of '*'s to represent 0 or more occurances of any character. The search is breadth-first over the sub-tree rooted at the caller, and the previous node returned can be passed to the next call as afterNode to continue the search after that node.

(VB.NET) XML SearchForAttribute Method

(PowerShell) XML SearchForAttribute Method

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SearchForAttribute2(ByVal after As Xml, ByVal tag As String, ByVal attr As String, ByVal valuePattern As String) As Boolean

Same as SearchForAttribute except the internal reference of the caller is updated to point to the search result (instead of returning a new object).

(VB.NET) XML SearchForAttribute Method

(PowerShell) XML SearchForAttribute Method

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SearchForContent(ByVal after As Xml, ByVal tag As String, ByVal contentPattern As String) As Xml

Returns the first node having a tag equal to tagName whose content matches contentPattern, which is a case-sensitive string that can use any number of '*'s to represent 0 or more occurances of any character. The search is breadth-first over the sub-tree rooted at the caller, and the previous node returned can be passed to the next call as afterNode to continue the search after that node.

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SearchForContent2(ByVal after As Xml, ByVal tag As String, ByVal contentPattern As String) As Boolean

Same as SearchForContent except the internal reference of the caller is updated to point to the search result (instead of returning a new object).

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SearchForTag(ByVal after As Xml, ByVal tag As String) As Xml

Returns the first node having a tag equal to tagName. The search is breadth-first over the sub-tree rooted at the caller, and the previous node returned can be passed to the next call as afterNode to continue the search after that node.

(VB.NET) XML SearchForTag Method

(PowerShell) XML SearchForTag Method

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SearchForTag2(ByVal after As Xml, ByVal tag As String) As Boolean

Same as SearchForTag except the internal reference of the caller is updated to point to the search result (instead of returning a new object).

(VB.NET) XML SearchForTag Method

(PowerShell) XML SearchForTag Method

(VB.NET) XML Tree Traversal Order for Search* Methods

(PowerShell) XML Tree Traversal Order for Search* Methods

Function SetBinaryContent(ByVal inData As Byte(), ByVal zipFlag As Boolean, ByVal encryptFlag As Boolean, ByVal password As String) As Boolean

Sets the node's content to a block of binary data with optional Zip compression and/or AES encryption. The binary data is automatically converted to base64 format whenever XML text is generated. If the zipFlag is True, the data is first compressed. If the encryptFlag is True, the data is AES encrypted using the Rijndael 128-bit symmetric-encryption algorithm.

Function SetBinaryContentFromFile(ByVal filename As String, ByVal zipFlag As Boolean, ByVal encryptFlag As Boolean, ByVal password As String) As Boolean

Sets the node's content with binary (or text) data from a file. The file contents can be Zip compressed and/or encrypted, and the result is base-64 encoded.

Sub SortByAttribute(ByVal attrName As String, ByVal ascending As Boolean)

Sorts the direct child nodes by the value of a specified attribute.

Sub SortByAttributeInt(ByVal attrName As String, ByVal ascending As Boolean)

Sorts the direct child nodes by the value of a specified attribute interpreted as an integer (not lexicographically as strings).

Sub SortByContent(ByVal ascending As Boolean)

Sorts the direct child nodes by content.

(VB.NET) XML Sort by Content

(PowerShell) XML Sort by Content

Sub SortByTag(ByVal ascending As Boolean)

Sorts the direct child nodes by tag.

(VB.NET) XML Sort by Tag

(PowerShell) XML Sort by Tag

Sub SortRecordsByAttribute(ByVal sortTag As String, ByVal attrName As String, ByVal ascending As Boolean)

Sorts the direct child nodes by the content of an attribute in the grandchild nodes.

Sub SortRecordsByContent(ByVal sortTag As String, ByVal ascending As Boolean)

Sorts the direct child nodes by the content of the grandchild nodes.

(VB.NET) XML Sort Records by Content

(PowerShell) XML Sort Records by Content

Sub SortRecordsByContentInt(ByVal sortTag As String, ByVal ascending As Boolean)

Sorts the direct child nodes by the content of the grandchild nodes. For sorting purposes, the content is interpreted as an integer (not lexicographically as for strings).

Function SwapNode(ByVal node As Xml) As Boolean

Swaps another node's tag, content, and attributes with this one.

Function SwapTree(ByVal tree As Xml) As Boolean

Swaps another node's tag, content, attributes, and children with this one.

Function TagContent(ByVal tag As String) As String

To be documented soon...

Function TagEquals(ByVal tag As String) As Boolean

Returns True if the node's tag equals the specified string.

Function UnzipContent() As Boolean

Unzip the content of the XML node replacing it's content with the decompressed data.

(VB.NET) Compress XML Content

(PowerShell) Compress XML Content

Function UnzipTree() As Boolean

Unzips and recreates the XML node and the entire subtree, restoring it to the state before it was zip compressed.

(VB.NET) Compress XML Tree

(PowerShell) Compress XML Tree

Function UpdateAttribute(ByVal attrName As String, ByVal attrValue As String) As Boolean

Adds an attribute to the node if it doesn't already exist. Otherwise it updates the existing attribute with the new value.

(VB.NET) Update an XML Attribute

(PowerShell) Update an XML Attribute

Function UpdateAttributeInt(ByVal attrName As String, ByVal value As Integer) As Boolean

Updates an attribute value. (Call UpdateAttribute if the attribute value is a string.)

Sub UpdateChildContent(ByVal tag As String, ByVal value As String)

Replaces the content of a child node.

Sub UpdateChildContentInt(ByVal tag As String, ByVal value As Integer)

Replaces the content of a child node where the content is an integer.

Function ZipContent() As Boolean

Applies Zip compression to the content of an XML node and replaces the content with base64-encoded compressed data.

(VB.NET) Compress XML Content

(PowerShell) Compress XML Content

Function ZipTree() As Boolean

Zip compresses the content and entire subtree rooted at the calling XML node and replaces the current content with base64-encoded Zip compressed data. The node and subtree can be restored by calling UnzipTree. Note that the node name and attributes are unaffected.

(VB.NET) Compress XML Tree

(PowerShell) Compress XML Tree