Here's a fix for the write part:Steve,
Isn't that one of the main reasons for using CDATA so that you don't need to escape everything (since the CDATA is not parsed)?
Can you comment on the trouble using _XMLCreateCDATA? I reproduced the same outcome that Gary got trying to use it.
thanks,
Dale
;=============================================================================== ; Function Name: _XMLCreateCDATA ; Description: Create a CDATA SECTION node directly under root. ; Parameters: $node name of node to create ; $data CDATA value ; Syntax: _XMLCreateCDATA($node,$data) ; Author(s): Stephen Podhajecki <gehossafats@netmdc.com> ; Returns: on error set error to 1 and returns -1 ; fixme, won't append to exisiting node. must create new node. ;=============================================================================== Func _XMLCreateCDATA($strNode, $strCDATA,$strNameSpc="") Local $objChild, $objNode While @error = 0 $objNode = $objDoc.createNode (1, $strNode, $strNameSpc) $objChild = $objDoc.createCDATASection ($strCDATA) $objNode.appendChild($objChild) $objDoc.documentElement.appendChild ($objNode) $objDoc.Save ($strFile) $objChild = "" Return WEnd ; _XMLError( "Failed to create CDATA Section: " & $strNode & @CRLF & $oMyError.windescription) _XMLError( "Failed to create CDATA Section: " & $strNode & @CRLF) SetError(1) Return -1 EndFunc ;==>_XMLCreateCDATA
Here's the xml as loaded in SciTe
<?xml version="1.0"?> <Snippet><hCode><![CDATA[; Include Version:1.52 (8 February 2006) #include-once ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with color management. ; ; ------------------------------------------------------------------------------ ;=============================================================================== ; ; Description: Get the red component of a given color. ; Syntax: ]]></hCode></Snippet>
I'm still working on the read. I think that the CDATASection is considered a child of the the node and may have to be referenced by it's index.
Steve
Edit: updated code.
Edited by eltorro, 24 February 2006 - 09:13 AM.








