_XMLDomWrapper.au3 34.55K
2834 downloads
Edit: MDI Version 3.2.2006
I have moved most of my code to google code. and dispensed with the dynamic ip service.
Download here:
_XMLDomWrapper.au3
SVN code is here.
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;overflow:auto'> _XMLCreateFile($sPath, $sRootNode, [$bOverwrite = False]) Creates an XML file with the given name and root.(Requires: #include <_XMLDomWrapper.au3>)
_XMLFileOpen($sXMLFile,[$sNamespace=""],[$ver=-1]) Creates an instance of an XML file.(Requires: #include <_XMLDomWrapper.au3>)
;==============================================================================
_XMLGetChildNodes ( strXPath ) Selects XML child Node(s) of an element based on XPath input from root node. (Requires: #include <_XMLDomWrapper.au3>)
_XMLGetNodeCount ( strXPath, strQry = "", iNodeType = 1 ) Get node count for specified path and type. (Requires: #include <_XMLDomWrapper.au3>)
_XMLGetPath ( strXPath ) Returns a nodes full path based on XPath input from root node. (Requires: #include <_XMLDomWrapper.au3>)
;==============================================================================
_XMLSelectNodes ( strXPath ) Selects XML Node(s) based on XPath input from root node. (Requires: #include <_XMLDomWrapper.au3>)
_XMLGetField ( strXPath ) Get XML Field(s) based on XPath input from root node.(Requires: #include <_XMLDomWrapper.au3>)
_XMLGetValue ( strXPath ) Get XML Field based on XPath input from root node. (Requires: #include <_XMLDomWrapper.au3>)
_XMLGetChildText ( strXPath ) Selects XML child Node(s) of an element based on XPath input from root node. (Requires: #include <_XMLDomWrapper.au3>)
_XMLUpdateField ( strXPath, strData ) Update existing node(s) based on XPath specs.(Requires: #include <_XMLDomWrapper.au3>)
_XMLReplaceChild ( objOldNode, objNewNode, ns = "" ) Replaces a node with a new node. (Requires: #include <_XMLDomWrapper.au3>)
;==============================================================================
_XMLDeleteNode ( strXPath ) Delete specified XPath node.(Requires: #include <_XMLDomWrapper.au3>)
_XMLDeleteAttr ( strXPath, strAttrib ) Delete attribute for specified XPath(Requires: #include <_XMLDomWrapper.au3>)
_XMLDeleteAttrNode ( strXPath, strAttrib ) Delete attribute node for specified XPath(Requires: #include <_XMLDomWrapper.au3>)
;==============================================================================
_XMLGetAttrib ( strXPath, strAttrib, strQuery = "" ) Get XML attribute based on XPath input from root node.(Requires: #include <_XMLDomWrapper.au3>)
_XMLGetAllAttrib ( strXPath, ByRef aName, ByRef aValue, strQry = "" ) Get all XML Field(s) attributes based on XPath input from root node.(Requires: #include <_XMLDomWrapper.au3>)
_XMLGetAllAttribIndex ( strXPath, ByRef aName, ByRef aValue, strQry = "", NodeIndex = 0 ) Get all XML Field(s) attributes based on Xpathn and specific index.(Requires: #include <_XMLDomWrapper.au3>)
_XMLSetAttrib ( strXPath, strAttrib, strValue = "" ) Set XML Field(s) attributes based on XPath input from root node.(Requires: #include <_XMLDomWrapper.au3>)
;==============================================================================
_XMLCreateCDATA ( strNode, strCDATA, strNameSpc = "" ) Create a CDATA SECTION node directly under root. (Requires: #include <_XMLDomWrapper.au3>)
_XMLCreateComment ( strNode, strComment ) Create a COMMENT node at specified path.(Requires: #include <_XMLDomWrapper.au3>)
_XMLCreateAttrib ( strXPath,strAttrName,strAttrValue="" ) Creates an attribute for the specified node. (Requires: #include <_XMLDomWrapper.au3>)
;==============================================================================
_XMLCreateRootChild ( strNode, strData = "", strNameSpc = "" ) Create node directly under root.(Requires: #include <_XMLDomWrapper.au3>)
_XMLCreateRootNodeWAttr ( strNode, aAttr, aVal, strData = "", strNameSpc = "" ) Create a child node under root node with attributes.(Requires: #include <_XMLDomWrapper.au3>)
_XMLCreateChildNode ( strXPath, strNode, strData = "", strNameSpc = "" ) Create a child node under the specified XPath Node.(Requires: #include <_XMLDomWrapper.au3>)
_XMLCreateChildWAttr ( strXPath, strNode, aAttr, aVal, strData = "", strNameSpc = "" ) Create a child node under the specified XPath Node with Attributes. (Requires: #include <_XMLDomWrapper.au3>)
;==============================================================================
_XMLSchemaValidate ( sXMLFile, ns, sXSDFile ) _XMLSchemaValidate($sXMLFile, $ns, $sXSDFile) Validate a document against a DTD. (Requires: #include <_XMLDomWrapper.au3>)
_XMLGetDomVersion ( ) Returns the XSXML version currently in use. (Requires: #include <_XMLDomWrapper.au3>)
_XMLError ( sError = "" ) Sets or Gets XML error message generated by XML functions.(Requires: #include <_XMLDomWrapper.au3>)
_XMLUDFVersion ( ) eturns the UDF Version number. (Requires: #include <_XMLDomWrapper.au3>)
_XMLTransform ( oXMLDoc, Style = "",szNewDoc="" ) Transfroms the document using built-in sheet or xsl file passed to function. (Requires: #include <_XMLDomWrapper.au3>)
_XMLNodeExists( $strXPath) Checks for the existence of the specified path. (Requires: #include <_XMLDomWrapper.au3>)</div>
Here's a sample prog to show some of its usefullness.
Its the gui sample from the /Examples/gui folder.
SaveSampleControls.au3 8.19K
2280 downloadsWorks with newer wrapper
XmlExample.au3 8.53K
4427 downloads_XMLExample.au3 downloads:

Please give me some feedback.
Steve
Edit:
Bug Fix: _XMLGetField not returning array count.
Added Func _XMLSelectNodes($sXPath) returns a list of node names
Edit:
Corrected Def for _XMLGetAllAttrib
Edit:
Bugfix for _XMLCreateCDATA
Bugfix for _XMLGetValue returns array as supposed to.
Added count to index[0] of the _XMLGetValue return
Change _XMLFileOpen _XMLFileCreate to look for available MSXML obj.
Added optional flag to _XMLFileCreate for specifiying UTF-8
Mar 30, 2007 Rewrote _AddFormat function to break up tags( no indentation)
Added _XMLTransform() which runs the document against a xsl(t) style sheet for indentation.
Changed _XMLCreateRootChildWAttr() to use new formatting
Changed _XMLChreateChildNode() to use new formatting
Apr 02, 2007 Added _XMLReplaceChild()
Apr 03, 2007 Changed other node creating function to use new formatting
Changed _XMLFileOpen() _XMLFileCreate to take an optional version number of MSXML to use.
Changed _XMLFileOpen() _XMLFileCreate find latest MSXML version logic.
Edit: Apr 24, 25 2007
Fixed _XMLCreateChileNodeWAttr() - Instead of removal, It points to the function that replaced it.
Added _XMLCreateAttrib()
Fixed bug with _XMLCreateRootNodeWAttr ,_XMLCreateChild[Node]WAttr() where an extra node with same name was added.
Stripped extrenous comments.
Removed dependency on Array.au3 (I added the func from Array.au3 and renamed it to avoid conflicts.)
Fixed a namespace bug in _XMLCreateChildNode() and _XMLCreateChildNodeWAttr()
Edit: July 12, 2007
Changed version number displayed on this page to reflect latest version.
Fixed example script.
Fixed a bug where a failed _XMLFileOpen() return an empty object
Added an object check to applicable functions.
Added _XMLSetAutoSave() to turn off/on forced saving. -- Thanks drlava.
Added check for previous creation of COM error handler. --Thanks Lukasz Suleja
Changed order of properties created on file open to correct behaviour with namespaces.
Fixed bug where _XMLUpdatedField would inadvertantly erase child nodes.
Fixed _XMLDeleteNode bug where non-existant node cause COM error.
Added _XMLNodeExist function to check for the existence of node or nodes matching the specified path
Fixed header documentation for _XMLGetAttrib. It returns the requested attribute if found. Not an array.
Fixed dimensioning bug in _XMLGetChildren --Thanks oblique
Edit: Mar 05,2008Return values fixed for the following functions: --Thanks oblique
_XMLFileOpen ,_XMLLoadXML,_XMLCreateFile
Documentation fixed for _XMLGetNodeCount,_XMLGetChildren --Thanks oblique
Small changes.
Fixed an issue pointed out by lgr.

I have moved most of my code to google code. and dispensed with the dynamic ip service.
Download here:
_XMLDomWrapper.au3
SVN code is here.
Edited by eltorro, 13 August 2010 - 05:31 AM.





