Xml Unicode C Reference Documentation

Xml

Current Version: 9.5.0.97

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

Create/Dispose

HCkXmlW instance = CkXmlW_Create();
// ...
CkXmlW_Dispose(instance);
HCkXmlW CkXmlW_Create(void);

Creates an instance of the HCkXmlW object and returns a handle ("void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkXmlW_Dispose(HCkXmlW handle);

Objects created by calling CkXmlW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkXmlW_Dispose.

Properties

Cdata
BOOL CkXmlW_getCdata(HCkXmlW cHandle);
void CkXmlW_putCdata(HCkXmlW cHandle, BOOL newVal);

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

More Information and Examples
top
Content
void CkXmlW_getContent(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putContent(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_content(HCkXmlW cHandle);

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

top
ContentInt
int CkXmlW_getContentInt(HCkXmlW cHandle);
void CkXmlW_putContentInt(HCkXmlW cHandle, int newVal);

Set/get the content as an integer.

top
DebugLogFilePath
void CkXmlW_getDebugLogFilePath(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putDebugLogFilePath(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_debugLogFilePath(HCkXmlW cHandle);

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

top
DocType
void CkXmlW_getDocType(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putDocType(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_docType(HCkXmlW cHandle);

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

More Information and Examples
top
EmitBom
BOOL CkXmlW_getEmitBom(HCkXmlW cHandle);
void CkXmlW_putEmitBom(HCkXmlW cHandle, BOOL newVal);
Introduced in version 9.5.0.44

If TRUE, then emit the BOM (byte order mark, also known as a preamble) for encodings such as utf-8, utf-16, etc. The defautl value is FALSE. This only applies when writing XML files. It does not apply when getting the XML as a string via the GetXml method.

top
EmitCompact
BOOL CkXmlW_getEmitCompact(HCkXmlW cHandle);
void CkXmlW_putEmitCompact(HCkXmlW cHandle, BOOL newVal);
Introduced in version 9.5.0.64

If TRUE, then GetXml and GetXmlSb emit compact XML. The XML emitted has no unnecessary whitespace, incuding no end-of-lines (CR's and/or LF's). The default value is FALSE, which maintains backward compatibility.

More Information and Examples
top
EmitXmlDecl
BOOL CkXmlW_getEmitXmlDecl(HCkXmlW cHandle);
void CkXmlW_putEmitXmlDecl(HCkXmlW cHandle, BOOL newVal);

If TRUE, then the XML declaration is emitted for methods (such as GetXml or SaveXml) where the XML is written to a file or string. The default value of this property is TRUE. If set to FALSE, the XML declaration is not emitted. (The XML declaration is the 1st line of an XML document starting with "<?xml ...".

top
Encoding
void CkXmlW_getEncoding(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putEncoding(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_encoding(HCkXmlW cHandle);

This is the encoding attribute in the XML declaration, such as "utf-8" or "iso-8859-1". The default is "utf-8". 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.

Calling any of the LoadXml* methods causes this property to be set to the charset found within the XML, if any. If no charset is specified within the loaded XML, then the LoadXml method resets this property to its default value of "utf-8".

top
I
int CkXmlW_getI(HCkXmlW cHandle);
void CkXmlW_putI(HCkXmlW cHandle, int newVal);
Introduced in version 9.5.0.64

Used in tagPaths (and ChilkatPath). The value of this property is substituted for "i" in "[i]". See the example below..

top
IsBase64
BOOL CkXmlW_getIsBase64(HCkXmlW cHandle);
Introduced in version 9.5.0.76

Returns TRUE if the content contains only those characters allowed in the base64 encoding. A base64 string is composed of characters 'A'..'Z', 'a'..'z', '0'..'9', '+', '/' and it is often padded at the end with up to two '=', to make the length a multiple of 4. Whitespace is ignored.

top
J
int CkXmlW_getJ(HCkXmlW cHandle);
void CkXmlW_putJ(HCkXmlW cHandle, int newVal);
Introduced in version 9.5.0.64

Used in tagPaths (and ChilkatPath). The value of this property is substituted for "j" in "[j]". See the example below..

More Information and Examples
top
K
int CkXmlW_getK(HCkXmlW cHandle);
void CkXmlW_putK(HCkXmlW cHandle, int newVal);
Introduced in version 9.5.0.64

Used in tagPaths (and ChilkatPath). The value of this property is substituted for "k" in "[k]". See the example below..

top
LastErrorHtml
void CkXmlW_getLastErrorHtml(HCkXmlW cHandle, HCkString retval);
const wchar_t *CkXmlW_lastErrorHtml(HCkXmlW cHandle);

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorText
void CkXmlW_getLastErrorText(HCkXmlW cHandle, HCkString retval);
const wchar_t *CkXmlW_lastErrorText(HCkXmlW cHandle);

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorXml
void CkXmlW_getLastErrorXml(HCkXmlW cHandle, HCkString retval);
const wchar_t *CkXmlW_lastErrorXml(HCkXmlW cHandle);

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastMethodSuccess
BOOL CkXmlW_getLastMethodSuccess(HCkXmlW cHandle);
void CkXmlW_putLastMethodSuccess(HCkXmlW cHandle, BOOL newVal);

Indicate whether the last method call succeeded or failed. A value of TRUE indicates success, a value of FALSE indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = TRUE and failure = FALSE.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to TRUE. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
NumAttributes
int CkXmlW_getNumAttributes(HCkXmlW cHandle);

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

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

More Information and Examples
top
NumChildren
int CkXmlW_getNumChildren(HCkXmlW cHandle);

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

top
SortCaseInsensitive
BOOL CkXmlW_getSortCaseInsensitive(HCkXmlW cHandle);
void CkXmlW_putSortCaseInsensitive(HCkXmlW cHandle, BOOL newVal);

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

top
Standalone
BOOL CkXmlW_getStandalone(HCkXmlW cHandle);
void CkXmlW_putStandalone(HCkXmlW cHandle, BOOL newVal);

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">

top
Tag
void CkXmlW_getTag(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putTag(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_tag(HCkXmlW cHandle);

The XML node's tag, including the namespace prefix.

More Information and Examples
top
TagNsPrefix
void CkXmlW_getTagNsPrefix(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putTagNsPrefix(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_tagNsPrefix(HCkXmlW cHandle);
Introduced in version 9.5.0.77

The node's namespace prefix, if present. For example, if the tag is "soapenv:Envelope", then this property will return "soapenv".

More Information and Examples
top
TagPath
void CkXmlW_getTagPath(HCkXmlW cHandle, HCkString retval);
const wchar_t *CkXmlW_tagPath(HCkXmlW cHandle);
Introduced in version 9.5.0.77

Returns the path to reach this element from the XML document root. If the caller is the document root, then the empty string is returned.

More Information and Examples
top
TagUnprefixed
void CkXmlW_getTagUnprefixed(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putTagUnprefixed(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_tagUnprefixed(HCkXmlW cHandle);
Introduced in version 9.5.0.77

The node's tag without the namespace prefix. For example, if the tag is "soapenv:Envelope", then this property will return "Envelope".

More Information and Examples
top
TreeId
int CkXmlW_getTreeId(HCkXmlW cHandle);

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.

top
UncommonOptions
void CkXmlW_getUncommonOptions(HCkXmlW cHandle, HCkString retval);
void CkXmlW_putUncommonOptions(HCkXmlW cHandle, const wchar_t *newVal);
const wchar_t *CkXmlW_uncommonOptions(HCkXmlW cHandle);
Introduced in version 9.5.0.90

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string and should typically remain empty.

top
VerboseLogging
BOOL CkXmlW_getVerboseLogging(HCkXmlW cHandle);
void CkXmlW_putVerboseLogging(HCkXmlW cHandle, BOOL newVal);

If set to TRUE, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is FALSE. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
void CkXmlW_getVersion(HCkXmlW cHandle, HCkString retval);
const wchar_t *CkXmlW_version(HCkXmlW cHandle);

Version of the component/library, such as "9.5.0.94"

More Information and Examples
top

Methods

AccumulateTagContent
BOOL CkXmlW_AccumulateTagContent(HCkXmlW cHandle, const wchar_t *tag, const wchar_t *skipTags, const wchar_t *outStr);
const wchar_t *CkXmlW_accumulateTagContent(HCkXmlW cHandle, const wchar_t *tag, const wchar_t *skipTags);

Accumulates the content of all nodes having a specific tag into a single result string. SkipTags specifies a set of subtrees 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 TRUE for success, FALSE for failure.

More Information and Examples
top
AddAttribute
BOOL CkXmlW_AddAttribute(HCkXmlW cHandle, const wchar_t *name, const wchar_t *value);

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

Returns TRUE for success, FALSE for failure.

top
AddAttributeInt
BOOL CkXmlW_AddAttributeInt(HCkXmlW cHandle, const wchar_t *name, int value);

Adds an integer attribute to a node.

Returns TRUE for success, FALSE for failure.

top
AddChildTree
BOOL CkXmlW_AddChildTree(HCkXmlW cHandle, HCkXmlW tree);

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.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
AddOrUpdateAttribute
void CkXmlW_AddOrUpdateAttribute(HCkXmlW cHandle, const wchar_t *name, const wchar_t *value);

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

More Information and Examples
top
AddOrUpdateAttributeI
void CkXmlW_AddOrUpdateAttributeI(HCkXmlW cHandle, const wchar_t *name, int value);

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

top
AddStyleSheet
void CkXmlW_AddStyleSheet(HCkXmlW cHandle, const wchar_t *styleSheet);

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"?>

top
AddToAttribute
void CkXmlW_AddToAttribute(HCkXmlW cHandle, const wchar_t *name, int amount);

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

More Information and Examples
top
AddToChildContent
void CkXmlW_AddToChildContent(HCkXmlW cHandle, const wchar_t *tag, int amount);

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

top
AddToContent
void CkXmlW_AddToContent(HCkXmlW cHandle, int amount);

Adds an integer amount to the node's content.

top
AppendToContent
BOOL CkXmlW_AppendToContent(HCkXmlW cHandle, const wchar_t *str);

Appends text to the content of an XML node

Returns TRUE for success, FALSE for failure.

top
BEncodeContent
BOOL CkXmlW_BEncodeContent(HCkXmlW cHandle, const wchar_t *charset, HCkByteData inData);

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.

Returns TRUE for success, FALSE for failure.

top
ChildContentMatches
BOOL CkXmlW_ChildContentMatches(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *pattern, BOOL caseSensitive);

Return TRUE if a child at the specified tagPath contains content that matches a wildcarded pattern. Otherwise returns FALSE.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

top
ChilkatPath
BOOL CkXmlW_ChilkatPath(HCkXmlW cHandle, const wchar_t *pathCmd, const wchar_t *outStr);
const wchar_t *CkXmlW_chilkatPath(HCkXmlW cHandle, const wchar_t *pathCmd);

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. "++" -- Navigate to the next sibling. (next/previous sibling feature added in v9.5.0.76)
  5. "--" -- Navigate to the previous sibling.
  6. TagName{Content} -- Navigate to the 1st direct child with the given tag having the exact content.
  7. /T/TagName -- Traverse the XML DOM tree (rooted at the caller) and navigate to the 1st node having the given tag.
  8. /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.
  9. /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.
  10. /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 TRUE for success, FALSE for failure.

top
Clear
void CkXmlW_Clear(HCkXmlW cHandle);

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

top
ContentMatches
BOOL CkXmlW_ContentMatches(HCkXmlW cHandle, const wchar_t *pattern, BOOL caseSensitive);

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

top
Copy
void CkXmlW_Copy(HCkXmlW cHandle, HCkXmlW node);

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

top
CopyRef
void CkXmlW_CopyRef(HCkXmlW cHandle, HCkXmlW copyFromNode);

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.

top
DecodeContent
BOOL CkXmlW_DecodeContent(HCkXmlW cHandle, const unsigned char * outData);

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

Returns TRUE for success, FALSE for failure.

top
DecodeEntities
BOOL CkXmlW_DecodeEntities(HCkXmlW cHandle, const wchar_t *str, const wchar_t *outStr);
const wchar_t *CkXmlW_decodeEntities(HCkXmlW cHandle, const wchar_t *str);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
DecryptContent
BOOL CkXmlW_DecryptContent(HCkXmlW cHandle, const wchar_t *password);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
EncryptContent
BOOL CkXmlW_EncryptContent(HCkXmlW cHandle, const wchar_t *password);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
ExtractChildByIndex
HCkXmlW CkXmlW_ExtractChildByIndex(HCkXmlW cHandle, int index);

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

Returns NULL on failure

top
ExtractChildByName
HCkXmlW CkXmlW_ExtractChildByName(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *attrName, const wchar_t *attrValue);

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

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

Returns NULL on failure

More Information and Examples
top
FindChild
HCkXmlW CkXmlW_FindChild(HCkXmlW cHandle, const wchar_t *tagPath);

Returns the child with the given tag or at the specified tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

Returns NULL on failure

top
FindChild2
BOOL CkXmlW_FindChild2(HCkXmlW cHandle, const wchar_t *tagPath);

Updates the Xml object's internal reference to point to a child at the specified tag or tagPath.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

Returns TRUE for success, FALSE for failure.

top
FindNextRecord
HCkXmlW CkXmlW_FindNextRecord(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *contentPattern);

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.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

Returns NULL on failure

More Information and Examples
top
FindOrAddNewChild
HCkXmlW CkXmlW_FindOrAddNewChild(HCkXmlW cHandle, const wchar_t *tagPath);

First checks for a child at tagPath, and if found, returns it. Otherwise creates a new child with empty content.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

Returns NULL on failure

top
FirstChild
HCkXmlW CkXmlW_FirstChild(HCkXmlW cHandle);

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

Returns NULL on failure

top
FirstChild2
BOOL CkXmlW_FirstChild2(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

top
GetAttributeName
BOOL CkXmlW_GetAttributeName(HCkXmlW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkXmlW_getAttributeName(HCkXmlW cHandle, int index);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
GetAttributeValue
BOOL CkXmlW_GetAttributeValue(HCkXmlW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkXmlW_getAttributeValue(HCkXmlW cHandle, int index);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
GetAttributeValueInt
int CkXmlW_GetAttributeValueInt(HCkXmlW cHandle, int index);

Returns an attribute as an integer. Returns 0 if the attribute does not exist.

top
GetAttrValue
BOOL CkXmlW_GetAttrValue(HCkXmlW cHandle, const wchar_t *name, const wchar_t *outStr);
const wchar_t *CkXmlW_getAttrValue(HCkXmlW cHandle, const wchar_t *name);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
GetAttrValueInt
int CkXmlW_GetAttrValueInt(HCkXmlW cHandle, const wchar_t *name);

Returns an attribute as an integer. Returns 0 if the attribute does not exist.

More Information and Examples
top
GetBinaryContent
BOOL CkXmlW_GetBinaryContent(HCkXmlW cHandle, BOOL unzipFlag, BOOL decryptFlag, const wchar_t *password, const unsigned char * outData);

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 TRUE for success, FALSE for failure.

top
GetChild
HCkXmlW CkXmlW_GetChild(HCkXmlW cHandle, int index);

Returns the Nth child of an XML node

Returns NULL on failure

More Information and Examples
top
GetChild2
BOOL CkXmlW_GetChild2(HCkXmlW cHandle, int index);

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

Returns TRUE for success, FALSE for failure.

top
GetChildAttrValue
BOOL CkXmlW_GetChildAttrValue(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *attrName, const wchar_t *outStr);
const wchar_t *CkXmlW_getChildAttrValue(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *attrName);
Introduced in version 9.5.0.77

Returns the content of a descendant child having a specified attribute. The tagPath can be a tag or a tag path.

Returns TRUE for success, FALSE for failure.

top
GetChildBoolValue
BOOL CkXmlW_GetChildBoolValue(HCkXmlW cHandle, const wchar_t *tagPath);

Returns FALSE if the node's content is "0", otherwise returns TRUE if the node contains a non-zero integer. The tagPath can be a tag or a tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "colors|primary|red".

More Information and Examples
top
GetChildContent
BOOL CkXmlW_GetChildContent(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *outStr);
const wchar_t *CkXmlW_getChildContent(HCkXmlW cHandle, const wchar_t *tagPath);

Returns the content of a child having a specified tag. The tagPath can be a tag or a tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "colors|primary|red".

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
GetChildContentByIndex
BOOL CkXmlW_GetChildContentByIndex(HCkXmlW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkXmlW_getChildContentByIndex(HCkXmlW cHandle, int index);

Returns the content of the Nth child node.

Returns TRUE for success, FALSE for failure.

top
GetChildContentSb
BOOL CkXmlW_GetChildContentSb(HCkXmlW cHandle, const wchar_t *tagPath, HCkStringBuilderW sb);
Introduced in version 9.5.0.76

Returns the content of the XML element at the tagPath. The XML element's content is appended to the sb.

Returns TRUE for success, FALSE for failure.

top
GetChildExact
HCkXmlW CkXmlW_GetChildExact(HCkXmlW cHandle, const wchar_t *tag, const wchar_t *content);

Returns the child having the exact tag and content.

Returns NULL on failure

top
GetChildIntValue
int CkXmlW_GetChildIntValue(HCkXmlW cHandle, const wchar_t *tagPath);

Returns the child integer content for a given tag. The tagPath can be a tag or a tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "colors|primary|red".

More Information and Examples
top
GetChildTag
BOOL CkXmlW_GetChildTag(HCkXmlW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkXmlW_getChildTag(HCkXmlW cHandle, int index);

Returns the tag name of the Nth child node.

Returns TRUE for success, FALSE for failure.

top
GetChildTagByIndex
BOOL CkXmlW_GetChildTagByIndex(HCkXmlW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkXmlW_getChildTagByIndex(HCkXmlW cHandle, int index);

Returns the tag name of the Nth child node.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
GetChildWithAttr
HCkXmlW CkXmlW_GetChildWithAttr(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *attrName, const wchar_t *attrValue);

Finds and returns the XML child node having both a given tag and an attribute with a given name and value.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

Returns NULL on failure

More Information and Examples
top
GetChildWithContent
HCkXmlW CkXmlW_GetChildWithContent(HCkXmlW cHandle, const wchar_t *content);

Returns the first child found having the exact content specified.

Returns NULL on failure

top
GetChildWithTag
HCkXmlW CkXmlW_GetChildWithTag(HCkXmlW cHandle, const wchar_t *tagPath);

Returns the child at the specified tag or tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

Returns NULL on failure

top
GetNthChildWithTag
HCkXmlW CkXmlW_GetNthChildWithTag(HCkXmlW cHandle, const wchar_t *tag, int n);

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.

Returns NULL on failure

top
GetNthChildWithTag2
BOOL CkXmlW_GetNthChildWithTag2(HCkXmlW cHandle, const wchar_t *tag, int n);

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

Returns TRUE for success, FALSE for failure.

top
GetParent
HCkXmlW CkXmlW_GetParent(HCkXmlW cHandle);

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

Returns NULL on failure

top
GetParent2
BOOL CkXmlW_GetParent2(HCkXmlW cHandle);

Updates the internal reference of the caller to its parent.

Returns TRUE for success, FALSE for failure.

top
GetRoot
HCkXmlW CkXmlW_GetRoot(HCkXmlW cHandle);

Returns the root node of the XML document

Returns NULL on failure

top
GetRoot2
void CkXmlW_GetRoot2(HCkXmlW cHandle);

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

top
GetSelf
HCkXmlW CkXmlW_GetSelf(HCkXmlW cHandle);

Returns a new XML object instance that references the same XML node.

Returns NULL on failure

top
GetXml
BOOL CkXmlW_GetXml(HCkXmlW cHandle, const wchar_t *outStr);
const wchar_t *CkXmlW_getXml(HCkXmlW cHandle);

Generate the XML text document for the XML tree rooted at this node. If called from the root node of the XML document, then the XML declarator ("<?xml version="1.0" encoding="utf-8" ?>") is included at the beginning of the XML. Otherwise, it is not included.

Returns TRUE for success, FALSE for failure.

top
GetXmlBd
BOOL CkXmlW_GetXmlBd(HCkXmlW cHandle, HCkBinDataW bd);
Introduced in version 9.5.0.77

Emits (appends) the XML to the contents of bd.

Returns TRUE for success, FALSE for failure.

top
GetXmlSb
BOOL CkXmlW_GetXmlSb(HCkXmlW cHandle, HCkStringBuilderW sb);
Introduced in version 9.5.0.62

Emits the XML to a StringBuilder object. (Appends to the existing contents of sb.)

Returns TRUE for success, FALSE for failure.

top
HasAttribute
BOOL CkXmlW_HasAttribute(HCkXmlW cHandle, const wchar_t *name);

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

top
HasAttrWithValue
BOOL CkXmlW_HasAttrWithValue(HCkXmlW cHandle, const wchar_t *name, const wchar_t *value);

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

top
HasChildWithContent
BOOL CkXmlW_HasChildWithContent(HCkXmlW cHandle, const wchar_t *content);

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

top
HasChildWithTag
BOOL CkXmlW_HasChildWithTag(HCkXmlW cHandle, const wchar_t *tagPath);

Returns TRUE if the node has a child with the given tag (or tag path). Otherwise returns FALSE.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

More Information and Examples
top
HasChildWithTagAndContent
BOOL CkXmlW_HasChildWithTagAndContent(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *content);

Returns TRUE if the node contains child with the given tag (or tag path) and content specified.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

top
InsertChildTreeAfter
void CkXmlW_InsertChildTreeAfter(HCkXmlW cHandle, int index, HCkXmlW tree);

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. The child tree is inserted in a position after the Nth child (of the calling node).

top
InsertChildTreeBefore
void CkXmlW_InsertChildTreeBefore(HCkXmlW cHandle, int index, HCkXmlW tree);

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. The child tree is inserted in a position before the Nth child (of the calling node).

More Information and Examples
top
LastChild
HCkXmlW CkXmlW_LastChild(HCkXmlW cHandle);

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.

Returns NULL on failure

top
LastChild2
BOOL CkXmlW_LastChild2(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

top
LoadBd
BOOL CkXmlW_LoadBd(HCkXmlW cHandle, HCkBinDataW bd, BOOL autoTrim);
Introduced in version 9.5.0.77

Loads XML from the contents of bd. If autoTrim is TRUE, then each element's text content is trimmed of leading and trailing whitespace.

Returns TRUE for success, FALSE for failure.

top
LoadSb
BOOL CkXmlW_LoadSb(HCkXmlW cHandle, HCkStringBuilderW sb, BOOL autoTrim);
Introduced in version 9.5.0.62

Loads XML from the contents of a StringBuilder object.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
LoadXml
BOOL CkXmlW_LoadXml(HCkXmlW cHandle, const wchar_t *xmlData);

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.

Returns TRUE for success, FALSE for failure.

top
LoadXml2
BOOL CkXmlW_LoadXml2(HCkXmlW cHandle, const wchar_t *xmlData, BOOL autoTrim);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
LoadXmlFile
BOOL CkXmlW_LoadXmlFile(HCkXmlW cHandle, const wchar_t *fileName);

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.

Returns TRUE for success, FALSE for failure.

top
LoadXmlFile2
BOOL CkXmlW_LoadXmlFile2(HCkXmlW cHandle, const wchar_t *fileName, BOOL autoTrim);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
NewChild
HCkXmlW CkXmlW_NewChild(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *content);

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

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "colors|primary|red". See the example below for details.

Returns NULL on failure

top
NewChild2
void CkXmlW_NewChild2(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *content);

Creates a new child node, but does not return the node that is created. The tagPath can be a tag or a tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "colors|primary|red". See the example below for details.

top
NewChildAfter
HCkXmlW CkXmlW_NewChildAfter(HCkXmlW cHandle, int index, const wchar_t *tag, const wchar_t *content);

Inserts a new child in a position after the Nth child node.

Returns NULL on failure

More Information and Examples
top
NewChildBefore
HCkXmlW CkXmlW_NewChildBefore(HCkXmlW cHandle, int index, const wchar_t *tag, const wchar_t *content);

Inserts a new child in a position before the Nth child node.

Returns NULL on failure

More Information and Examples
top
NewChildInt2
void CkXmlW_NewChildInt2(HCkXmlW cHandle, const wchar_t *tagPath, int value);

Inserts a new child having an integer for content. The tagPath can be a tag or a tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "colors|primary|red". See the example below for details.

More Information and Examples
top
NextInTraversal2
BOOL CkXmlW_NextInTraversal2(HCkXmlW cHandle, HCkStringBuilderW sbState);
Introduced in version 9.5.0.77

Updates to Xml object's internal reference to the next node in a depth-first traversal. (This method name, NextInTraversal2, ends with "2" to signify that the internal reference is updated. There is no "NextInTraversal" method.)

The sbState contains the current state of the traversal. sbState should be empty when beginning a traversal.

More Information and Examples
top
NextSibling
HCkXmlW CkXmlW_NextSibling(HCkXmlW cHandle);

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

Returns NULL on failure

top
NextSibling2
BOOL CkXmlW_NextSibling2(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

top
NumChildrenAt
int CkXmlW_NumChildrenAt(HCkXmlW cHandle, const wchar_t *tagPath);
Introduced in version 9.5.0.64

Returns the number of children for the node indicated by tagPath. Returns -1 if the node at tagPath does not exist.

top
NumChildrenHavingTag
int CkXmlW_NumChildrenHavingTag(HCkXmlW cHandle, const wchar_t *tag);

Returns the number of children having a specific tag name.

top
PreviousSibling
HCkXmlW CkXmlW_PreviousSibling(HCkXmlW cHandle);

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

Returns NULL on failure

top
PreviousSibling2
BOOL CkXmlW_PreviousSibling2(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

top
PruneAttribute
int CkXmlW_PruneAttribute(HCkXmlW cHandle, const wchar_t *attrName);
Introduced in version 9.5.0.77

Recursively descends the XML from this node and removes all occurrences of the specified attribute. Returns the number of attribute occurrences removed.

top
PruneTag
int CkXmlW_PruneTag(HCkXmlW cHandle, const wchar_t *tag);
Introduced in version 9.5.0.77

Recursively descends the XML from this node and removes all occurrences of the specified tag, including all descendents of each removed node. Returns the number of tag occurrences removed.

More Information and Examples
top
QEncodeContent
BOOL CkXmlW_QEncodeContent(HCkXmlW cHandle, const wchar_t *charset, HCkByteData inData);

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.

Returns TRUE for success, FALSE for failure.

top
RemoveAllAttributes
BOOL CkXmlW_RemoveAllAttributes(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

top
RemoveAllChildren
void CkXmlW_RemoveAllChildren(HCkXmlW cHandle);

Removes all children from the calling node.

top
RemoveAttribute
BOOL CkXmlW_RemoveAttribute(HCkXmlW cHandle, const wchar_t *name);

Removes an attribute by name from and XML node.

Returns TRUE for success, FALSE for failure.

top
RemoveChild
void CkXmlW_RemoveChild(HCkXmlW cHandle, const wchar_t *tagPath);

Removes all children with a given tag or tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

top
RemoveChildByIndex
void CkXmlW_RemoveChildByIndex(HCkXmlW cHandle, int index);

Removes the Nth child from the calling node.

More Information and Examples
top
RemoveChildWithContent
void CkXmlW_RemoveChildWithContent(HCkXmlW cHandle, const wchar_t *content);

Removes all children having the exact content specified.

More Information and Examples
top
RemoveFromTree
void CkXmlW_RemoveFromTree(HCkXmlW cHandle);

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

More Information and Examples
top
RemoveStyleSheet
int CkXmlW_RemoveStyleSheet(HCkXmlW cHandle, const wchar_t *attrName, const wchar_t *attrValue);
Introduced in version 9.5.0.77

Removes all XML stylesheets having an attribute with attrName equal to attrValue. Returns the number of stylesheets removed, or -1 if there was an error.

top
SaveBinaryContent
BOOL CkXmlW_SaveBinaryContent(HCkXmlW cHandle, const wchar_t *filename, BOOL unzipFlag, BOOL decryptFlag, const wchar_t *password);

Saves a node's binary content to a file.

Returns TRUE for success, FALSE for failure.

top
SaveXml
BOOL CkXmlW_SaveXml(HCkXmlW cHandle, const wchar_t *fileName);

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

Returns TRUE for success, FALSE for failure.

top
Scrub
void CkXmlW_Scrub(HCkXmlW cHandle, const wchar_t *directives);
Introduced in version 9.5.0.77

Recursively traverses the XML rooted at the caller and scrubs according to the instructions in the comma separated directives. The currently defined directives are:

  • "AttrTrimEnds" - Leading and trailing whitespace removed from attribute values.
  • "AttrTrimInside" - Replace all tabs, CR's, and LF's with SPACE chars, and removes extra SPACE chars so that no more than one SPACE char in a row exists.
  • "ContentTrimEnds" - Same as AttrTrimEnds but for content.
  • "ContentTrimInside" - Same as AttrTrimInside but for content.
  • "LowercaseAttrs" - Convert all attribute names to lowercase.
  • "LowercaseTags" - Convert all tags to lowercase.
  • "RemoveCtrl" - Remove non-printable us-ascii control chars (us-ascii values <= 31 except for TAB,CR, and LF are removed)

If you have other ideas for useful XML scrubbing directives, send email to support@chilkatsoft.com. It must be general enough such that many developers will find it useful.

More Information and Examples
top
SearchAllForContent
HCkXmlW CkXmlW_SearchAllForContent(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *contentPattern);

Returns the first node having content matching the contentPattern. The contentPattern is a case-sensitive string that may contain any number of '*'s, each representing 0 or more occurrences of any character. The search is breadth-first over the sub-tree rooted at the caller. A match is returned only after the search has traversed past the node indicated by afterPtr. To find the 1st occurrence, set afterPtr equal to NULL. (For the ActiveX implementation, the afterPtr should never be NULL. A reference to the caller's node should be passed instead.)

To iterate over matching nodes, the returned node can be passed in afterPtr for the next call to SearchAllForContent, until the method returns NULL.

Returns NULL on failure

More Information and Examples
top
SearchAllForContent2
BOOL CkXmlW_SearchAllForContent2(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *contentPattern);

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

Returns TRUE for success, FALSE for failure.

top
SearchForAttribute
HCkXmlW CkXmlW_SearchForAttribute(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *tag, const wchar_t *attr, const wchar_t *valuePattern);

Returns the first node having a tag equal to tag, an attribute named attr, whose value matches valuePattern. The valuePattern is a case-sensitive string that may contain any number of '*'s, each representing 0 or more occurrences of any character. The search is breadth-first over the sub-tree rooted at the caller. A match is returned only after the search has traversed past the node indicated by afterPtr. To find the 1st occurrence, set afterPtr equal to NULL. (For the ActiveX implementation, the afterPtr should never be NULL. A reference to the caller's node should be passed instead.)

To iterate over matching nodes, the returned node can be passed in afterPtr for the next call to SearchForAttribute, until the method returns NULL.

Returns NULL on failure

top
SearchForAttribute2
BOOL CkXmlW_SearchForAttribute2(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *tag, const wchar_t *attr, const wchar_t *valuePattern);

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

Returns TRUE for success, FALSE for failure.

top
SearchForContent
HCkXmlW CkXmlW_SearchForContent(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *tag, const wchar_t *contentPattern);

Returns the first node having a tag equal to tag, whose content matches contentPattern. The contentPattern is a case-sensitive string that may contain any number of '*'s, each representing 0 or more occurrences of any character. The search is breadth-first over the sub-tree rooted at the caller. A match is returned only after the search has traversed past the node indicated by afterPtr. To find the 1st occurrence, set afterPtr equal to NULL. (For the ActiveX implementation, the afterPtr should never be NULL. A reference to the caller's node should be passed instead.)

To iterate over matching nodes, the returned node can be passed in afterPtr for the next call to SearchForContent, until the method returns NULL.

Returns NULL on failure

More Information and Examples
top
SearchForContent2
BOOL CkXmlW_SearchForContent2(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *tag, const wchar_t *contentPattern);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
SearchForTag
HCkXmlW CkXmlW_SearchForTag(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *tag);

Returns the first node having a tag equal to tag. The search is breadth-first over the sub-tree rooted at the caller. A match is returned only after the search has traversed past the node indicated by afterPtr. To find the 1st occurrence, set afterPtr equal to NULL. (For the ActiveX implementation, the afterPtr should never be NULL. A reference to the caller's node should be passed instead.)

To iterate over matching nodes, the returned node can be passed in afterPtr for the next call to SearchForTag, until the method returns NULL.

Returns NULL on failure

top
SearchForTag2
BOOL CkXmlW_SearchForTag2(HCkXmlW cHandle, HCkXmlW afterPtr, const wchar_t *tag);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
SetBinaryContent
BOOL CkXmlW_SetBinaryContent(HCkXmlW cHandle, HCkByteData inData, BOOL zipFlag, BOOL encryptFlag, const wchar_t *password);

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.

Returns TRUE for success, FALSE for failure.

top
SetBinaryContent2
BOOL CkXmlW_SetBinaryContent2(HCkXmlW cHandle, const void * pByteData, unsigned long szByteData, BOOL zipFlag, BOOL encryptFlag, const wchar_t *password);

The same as SetBinaryContent but the data is provided via a pointer and byte count.

top
SetBinaryContentFromFile
BOOL CkXmlW_SetBinaryContentFromFile(HCkXmlW cHandle, const wchar_t *filename, BOOL zipFlag, BOOL encryptFlag, const wchar_t *password);

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.

Returns TRUE for success, FALSE for failure.

top
SortByAttribute
void CkXmlW_SortByAttribute(HCkXmlW cHandle, const wchar_t *attrName, BOOL ascending);

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

top
SortByAttributeInt
void CkXmlW_SortByAttributeInt(HCkXmlW cHandle, const wchar_t *attrName, BOOL ascending);

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

top
SortByContent
void CkXmlW_SortByContent(HCkXmlW cHandle, BOOL ascending);

Sorts the direct child nodes by content.

More Information and Examples
top
SortByTag
void CkXmlW_SortByTag(HCkXmlW cHandle, BOOL ascending);

Sorts the direct child nodes by tag.

More Information and Examples
top
SortRecordsByAttribute
void CkXmlW_SortRecordsByAttribute(HCkXmlW cHandle, const wchar_t *sortTag, const wchar_t *attrName, BOOL ascending);

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

top
SortRecordsByContent
void CkXmlW_SortRecordsByContent(HCkXmlW cHandle, const wchar_t *sortTag, BOOL ascending);

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

More Information and Examples
top
SortRecordsByContentInt
void CkXmlW_SortRecordsByContentInt(HCkXmlW cHandle, const wchar_t *sortTag, BOOL ascending);

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

top
SwapNode
BOOL CkXmlW_SwapNode(HCkXmlW cHandle, HCkXmlW node);

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

Returns TRUE for success, FALSE for failure.

top
SwapTree
BOOL CkXmlW_SwapTree(HCkXmlW cHandle, HCkXmlW tree);

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

Returns TRUE for success, FALSE for failure.

top
TagContent
BOOL CkXmlW_TagContent(HCkXmlW cHandle, const wchar_t *tagName, const wchar_t *outStr);
const wchar_t *CkXmlW_tagContent(HCkXmlW cHandle, const wchar_t *tagName);

Returns the content of the 1st node found in the sub-tree rooted at the caller that has a given tag. (Note: The search for the node having tag ARG is not limited to the direct children of the caller.)

Returns TRUE for success, FALSE for failure.

top
TagEquals
BOOL CkXmlW_TagEquals(HCkXmlW cHandle, const wchar_t *tag);

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

top
TagIndex
int CkXmlW_TagIndex(HCkXmlW cHandle, const wchar_t *tagPath);
Introduced in version 9.5.0.76

Returns the index of the XML node with the given tag. Returns -1 if no node having the specified tag is found at the tagPath.

More Information and Examples
top
TagNsEquals
BOOL CkXmlW_TagNsEquals(HCkXmlW cHandle, const wchar_t *ns);
Introduced in version 9.5.0.77

Returns TRUE if the node's tag namespace prefix equals the specified ns.

More Information and Examples
top
TagUnpEquals
BOOL CkXmlW_TagUnpEquals(HCkXmlW cHandle, const wchar_t *unprefixedTag);
Introduced in version 9.5.0.77

Returns TRUE if the node's unprefixed tag equals the specified string. For example, if the tag is "soapenv:Body", the unprefixed tag is "Body".

More Information and Examples
top
UnzipContent
BOOL CkXmlW_UnzipContent(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
UnzipTree
BOOL CkXmlW_UnzipTree(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
UpdateAt
BOOL CkXmlW_UpdateAt(HCkXmlW cHandle, const wchar_t *tagPath, BOOL autoCreate, const wchar_t *value);
Introduced in version 9.5.0.64

Updates the content for the node indicated by tagPath. If autoCreate is TRUE, then nodes along tagPath are auto-created as needed.

More Information and Examples
top
UpdateAttrAt
BOOL CkXmlW_UpdateAttrAt(HCkXmlW cHandle, const wchar_t *tagPath, BOOL autoCreate, const wchar_t *attrName, const wchar_t *attrValue);
Introduced in version 9.5.0.64

Updates or adds the attribute value for the node indicated by tagPath. If autoCreate is TRUE, then nodes along tagPath are auto-created as needed.

top
UpdateAttribute
BOOL CkXmlW_UpdateAttribute(HCkXmlW cHandle, const wchar_t *attrName, const wchar_t *attrValue);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
UpdateAttributeInt
BOOL CkXmlW_UpdateAttributeInt(HCkXmlW cHandle, const wchar_t *attrName, int value);

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

Returns TRUE for success, FALSE for failure.

top
UpdateChildContent
void CkXmlW_UpdateChildContent(HCkXmlW cHandle, const wchar_t *tagPath, const wchar_t *value);

Replaces the content of a child node. The tagPath can be a tag or tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC". The nodes in the tagPath are automatically created as needed.

top
UpdateChildContentInt
void CkXmlW_UpdateChildContentInt(HCkXmlW cHandle, const wchar_t *tagPath, int value);

Replaces the content of a child node where the content is an integer. The tagPath can be a tag or tag path.

Beginning in version 9.5.0.64, the tagPath can be a tag path. A tag path is a series of tags separated by vertical bar characters. For example: "tagA|tagB|tagC".

top
ZipContent
BOOL CkXmlW_ZipContent(HCkXmlW cHandle);

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

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
ZipTree
BOOL CkXmlW_ZipTree(HCkXmlW cHandle);

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.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top