.NET Components
Chilkat .NET Components for Email, Zip Compression, Encryption, XML, S/MIME, and Character Encoding Conversion

BACK

Chilkat::Xml Class

A super-fast low-memory usage XML parser with huge performance gains over MSXML. Advanced features include: (1) Zip or unzip XML content or subtrees directly within an XML document. (2) AES encrypt or decrypt content within XML documents. (3) Easily store binary data in XML documents. (4) Provides XMLHTTP functionality. [Description] Chilkat XML .NET is a high-performance XML parser with advanced features for XMLHTTP, Zip compression, AES encryption, and character encoding conversion. Chilkat XML .NET is a non-validating parser that provides significant memory and speed improvements over validating parsers such as MSXML. It provides XMLHTTP support for communicating directly with HTTP servers and charset conversion for converting XML documents from any language encoding to any other. It also provides the ability to Zip and AES encrypt content within an XML document.

Base Classes: Object
  Properties Description  
    AutoFix Automatically removes characters that cause validating XML parsers to fail. This property is False by default.

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

 
    Content This is the content of the XML node. It is the text between the open and close tags, such as: This is the content

 
    Encoding 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.

 
    HttpParamName When calling HttpPost, this is the name of the parameter that contains the XML document. The default is "xml".

 
    LastError An XML-formatted string containing error information, if any, of the last method call.

 
    NumAttributes The number of attributes. For example, the following node has 2 attributes: This is the content

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

 
    Standalone Should be set to "yes" or "no". This is the standalone attribute in the XML declaration. If not present, then this property returns an empty string. This property can be set from any node in the XML document and when set, causes the standalone property to be added to the XML declaration.

 
    Tag The XML node's tag.

 
    TreeId 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.

 
    ValidatingParser The default value is False, causing the Chilkat XML fast, non-validating parser to be used. If true, Chilkat will internally use Microsoft's validating XML DOM parser (MSXML).

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

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

 
    AddChildTree 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.

 
    AppendToContent Appends text to the content of an XML node

 
    BEncodeContent 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.

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

 
    ConvertToEncoding Converts the entire XML document to another character encoding, such as utf-8, iso-8859-1, etc. The source encoding is obtained from the "encoding" attribute in the XML declaration, and if not present, is assumed to be "us-ascii". This method updates the Encoding property. All data in the XML document is converted. If any problems or errors were encountered, a False value is returned, but the document will still be converted on a best-effort basis. A return value of True indicates that no problems were found.

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

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

 
    EncryptContent AES encrypts the content of the calling XML node using 128-bit Rijndael encryption.

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

 
    ExtractChildByName 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.

 
    FindOrAddNewChild 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.

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

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

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

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

 
    GetBinaryContent 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.

 
    GetChild Returns the Nth child of an XML node

 
    GetChildWithTag Returns the Xml child object having a tag matching tagName.

 
    GetNthChildWithTag 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.

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

 
    GetRoot Returns the root node of the XML document

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

 
    HasAttributeWithValue Returns True if the XML node has the specified attribute/value pair.

 
    HttpPost Provides client-side protocol support for communication with HTTP servers. A client can use this method to send an arbitrary HTTP request, receive the response, and have Chilkat XML.NET parse that response. The request body is sent directly from the Chilkat XML object and the response is parsed directly into the returned Chilkat XML object. When combined with the support for Extensible Stylesheet Language (XSL), this provides an easy way to send structured queries to HTTP servers and efficiently display the results with a variety of presentations.

 
    IsUnlocked Returns True if the class is already unlocked, otherwise returns False.

 
    LastChild 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.

 
    LoadXmlFile 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.

 
    LoadXml 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.

 
    NewChild 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.)

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

 
    NumChildrenHavingTag Returns the number of children having a specific tag name.

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

 
    QEncodeContent 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.

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

 
    RemoveAttribute Removes an attribute by name from and XML node.

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

 
    SaveLastError Saves the error log to an XML log file

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

 
    SearchAllForContent 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 tree, and the previous node returned can be passed to the next call as afterNode to continue the search after that node.

 
    SearchForAttribute 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 tree, and the previous node returned can be passed to the next call as afterNode to continue the search after that node.

 
    SearchForContent 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 tree, and the previous node returned can be passed to the next call as afterNode to continue the search after that node.

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

 
    SetBinaryContent 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.

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

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

 
    UnlockComponent Unlocks the component allowing for the full functionality to be used. Returns true if the unlock code is valid.

 
    UnzipContent Unzip the content of the XML node

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

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

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

 
    ZipTree 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.

 

Copyright 2002, Chilkat Software, Inc. All Rights Reserved.