Jump to content

XML DOM wrapper (COM)


Recommended Posts

Hello again,

It's been several months since my last query. (post #653 in this topic)

Then my problem was solved only partially.

This time I found a complete solution.

Here it is:

#include"_XMLDomWrapper.au3"
$XMLFILE = "TaskResult.xml"

_XMLFileOpen($XMLFILE)

$iCount = _XMLGetNodeCount("/root/command/property")
Msgbox(0,"Nodes' <property> no.",$iCount)


    $SSSystemName = _XMLGetAttrib('(//property[@name="SS.SystemName"])', 'value')
    $MemorySize = _XMLGetAttrib('(//property[@name="Memory.Size"])', 'value')
    $MemorySize = StringFormat("%.2f", $MemorySize/1048576)
    $DiscoveryModel = _XMLGetAttrib('(//property[@name="Discovery.Model"])', 'value')
    $SSServiceTag= _XMLGetAttrib('(//property[@name="SS.ServiceTag"])', 'value')
    $SSAssetTag= _XMLGetAttrib('(//property[@name="SS.AssetTag"])', 'value')
    $ConfigurationPropertyOwnershipTag= _XMLGetAttrib('(//property[@name="Configuration.PropertyOwnershipTag"])', 'value')
    $PWRakeupOnLAN= _XMLGetAttrib('(//property[@name="PWR.WakeupOnLAN"])', 'value')
    $PWRLowPowerS5= _XMLGetAttrib('(//property[@name="PWR.LowPowerS5"])', 'value')
        If $PWRakeupOnLAN > 3 and $PWRLowPowerS5 <> 3 Then
            $WOL = String("should work correctly")
        Else
            $WOL = String("not work properly")
        EndIf
MsgBox(0,"Reading xml file ", " Computer "& $SSSystemName &" has "& $MemorySize &" GB of RAM "& @crlf &" This is a " & $DiscoveryModel & " with SN: "& $SSServiceTag & @CRLF &" WakeOnLAN "& $WOL)

The script searches the file TaskResult.xml

as the result shows the value attribute

Edited by KatoXY
Link to post
Share on other sites
  • 3 weeks later...
  • Replies 778
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Try using MsgBox(4096, "test", $search[1]) oÝ÷ Ú)ìµæ¡ö®¶­s`¤×6t&÷CbÂgV÷C·FW7BgV÷C²Âb33c·6V&6oÝ÷ Ù«­¢+Ø(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ìչѥ½¸

Hi eltorro, I am syed and i am new to this Function. Today when i dig in to the forum i got an opportunity come accross the _XMLDomWrapper.au3 and i am strugling my self to understand the func

Posted Images

Trying to get the XML Wrapper to read through my two Songs in this XML Database. However the output (see below) only shows the last entry.

#include"_XMLDomWrapper.au3"
$XMLFILE = "test.xml"
_XMLFileOpen($XMLFILE)

$iCount = _XMLGetNodeCount("/VirtualDJ_Database/Song")
ConsoleWrite("Node*s' <song> no." & $iCount & @CRLF)
For $n = 1 To $iCount


    $Author = _XMLGetAttrib('(//Display)', 'Author')
    $Title = _XMLGetAttrib('(//Display)', 'Title')
    $FileName = _XMLGetAttrib('(//Song)', 'FilePath')
    ConsoleWrite($Author & @CRLF) 
ConsoleWrite($Title & @CRLF) 
ConsoleWrite($FileName & @CRLF)

Next

Output:

Node*s' <song> no.2

Plasmic Honey

Ride the Trip (Lift-Off - Mix 2)

I:\Tools\02 - Ride the Trip (Lift-Off Mix - Mix 2).mp3

Plasmic Honey

Ride the Trip (Lift-Off - Mix 2)

I:\Tools\02 - Ride the Trip (Lift-Off Mix - Mix 2).mp3

>Exit code: 0 Time: 0.315

Test XML File is attached.

Any ideas on how to parse each <Song> ?

test.xml

Edited by DJ VenGenCe
Link to post
Share on other sites
  • 4 weeks later...

I have a 9,000 line XML file that I've been banging my head on all day wondering why I'm not getting the results I think I should be getting. I'm not going to overwhelm you and post a 9k line file so I narrowed where I'm going wrong and created a small example.

In the example below let's say I want to return all the <BOOK> nodes in the XML file that have a rating = 5. _XMLGetChildren returns exactly what I want but it seems it's returning based off of the current parent node instead of the root node. What am I doing wrong here? How can I return all the <BOOK> nodes and reference all it's children?

Any help would be appreciated. Thanks.

Here is the XML source:

<?xml version="1.0"?><ROOTNODE> <LIBRARY>       <BOOKS>         <GENRE value="Comedy">              <BOOK rating="5">                   <TITLE>Fourteen Days Later</TITLE>                  <PAGES>1200</PAGES>             </BOOK>             <BOOK rating="5">                   <TITLE>Caddyshack</TITLE>                   <PAGES>800</PAGES>              </BOOK>         </GENRE>            <GENRE value="MYSTERY">             <BOOK rating="5">                   <TITLE>Cold Case</TITLE>                    <PAGES>912</PAGES>              </BOOK>             <BOOK rating="3">                   <TITLE>The Man Who Knew Too Much</TITLE>                    <PAGES>1111</PAGES>             </BOOK>             <BOOK rating="5">                   <TITLE>The Red House Mystery</TITLE>                    <PAGES>899</PAGES>              </BOOK>             <BOOK rating="5">                   <TITLE>The Mystery of 31</TITLE>                    <PAGES>788</PAGES>              </BOOK>             <BOOK rating="5">                   <TITLE>The Daffodil Mystery</TITLE>                 <PAGES>1500</PAGES>             </BOOK>             <BOOK rating="4">                   <TITLE>Invisible</TITLE>                    <PAGES>1000</PAGES>             </BOOK>         </GENRE>            <GENRE value="HORROR">              <BOOK rating="5">                   <TITLE>The Shining</TITLE>              </BOOK>         </GENRE>        </BOOKS>    </LIBRARY></ROOTNODE>

AutoIt test code:

#include <array.au3>
#include <_XMLDomWrapper.au3>

Global $rating = 5

_XMLFileOpen("shorterTest.xml")

;_XMLGetNodeCount returns the correct value
$ratingCount = _XMLGetNodeCount("//BOOK[@rating='" & $rating & "']")
MsgBox(0,"Rating Count","Number of books with rating " & $rating & " = " & $ratingCount)

;for testing ---_XMLGetValue returns the first node of each GENRE
$test = _XMLGetValue("//BOOK[@rating='" & $rating & "'][1]/TITLE")
_ArrayDisplay($test, "Get Value")

;not returning what I expected --- returning the ith book node of each genre instead of the ith book of all book nodes that have a rating = 5
for $i = 1 To $ratingCount
    $value = _XMLGetChildren("//BOOK[@rating='" & $rating & "'][" & $i & "]") 
    _ArrayDisplay($value)
Next
Link to post
Share on other sites

Trying to get the XML Wrapper to read through my two Songs in this XML Database. However the output (see below) only shows the last entry.

<snip...>

Output:

Node*s' <song> no.2

Plasmic Honey

Ride the Trip (Lift-Off - Mix 2)

I:\Tools\02 - Ride the Trip (Lift-Off Mix - Mix 2).mp3

Plasmic Honey

Ride the Trip (Lift-Off - Mix 2)

I:\Tools\02 - Ride the Trip (Lift-Off Mix - Mix 2).mp3

>Exit code: 0 Time: 0.315

Test XML File is attached.

Any ideas on how to parse each <Song> ?

Something like this:
#include"_XMLDomWrapper.au3"

Global $sXMLFILE = @ScriptDir & "\test1.xml", $iCount, $sAuthor, $sTitle, $sFileName
_XMLFileOpen($sXMLFILE)
$iCount = _XMLGetNodeCount("/VirtualDJ_Database/Song")
ConsoleWrite("Node*s' <song> no." & $iCount & @CRLF)
For $n = 1 To $iCount
    $sAuthor = _XMLGetAttrib('/VirtualDJ_Database/Song[' & $n & ']/Display', 'Author')
    $sTitle = _XMLGetAttrib('/VirtualDJ_Database/Song[' & $n & ']/Display', 'Title')
    $sFileName = _XMLGetAttrib('/VirtualDJ_Database/Song[' & $n & ']', 'FilePath')
    ConsoleWrite("Author:  " & $sAuthor & @CRLF)
    ConsoleWrite("Title:  " & $sTitle & @CRLF)
    ConsoleWrite("File:  " & $sFileName & @CRLF)
Next

Note that your path to 'FilePath' was wrong, it's an attribute of the Song element, not Display.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites

I have a 9,000 line XML file that I've been banging my head on all day wondering why I'm not getting the results I think I should be getting. I'm not going to overwhelm you and post a 9k line file so I narrowed where I'm going wrong and created a small example.

In the example below let's say I want to return all the <BOOK> nodes in the XML file that have a rating = 5. _XMLGetChildren returns exactly what I want but it seems it's returning based off of the current parent node instead of the root node. What am I doing wrong here? How can I return all the <BOOK> nodes and reference all it's children?

The methods and properties are there in the XML DOM, but since _XMLDOMWrapper.au3 wasn't designed to use object parameters, you have to do it yourself:
#include <array.au3>
#include <_XMLDomWrapper.au3>

Global $rating = 5
Global $sXMLFile = @ScriptDir & "\Test1.xml"
Global $colNodeList, $oBook, $oTitle, $sTitle

_XMLFileOpen($sXMLFile)

$colNodeList = $objDoc.selectNodes("//BOOK[@rating='" & $rating & "']")
If IsObj($colNodeList) Then
    For $oBook In $colNodeList
        $oTitle = $oBook.selectSingleNode("TITLE")
        $sTitle = $oTitle.text
        ConsoleWrite("Title = " & $sTitle & @LF)
    Next
Else
    ConsoleWrite("ERROR:  No collection object" & @LF)
EndIf

This gets a collection object containing all BOOK nodes where @rating=5. Then it loops through the collection and gets the TITLE node object under each. Finally it gets the .text property from each of those node objects.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites

There's a slightly easier way to do this:

#include <array.au3>
#include <_XMLDomWrapper.au3>

Global $rating = 5
Global $sXMLFile = @ScriptDir & "\Test1.xml"
Global $oX, $colNodeList, $node, $value

$oX = _XMLFileOpen($sXMLFile)

$colNodeList = $oX.selectNodes("//BOOK[@rating='" & $rating & "']")
If IsObj($colNodeList) Then
    For $node In $colNodeList
        $value = _XMLGetChildren($node, ".")
        _ArrayDisplay($value)
    Next
Else
    ConsoleWrite("ERROR:  No collection object" & @LF)
EndIf

If anyone is interested, I've also modified the most current version of this UDF (1.0.3.98) to return the XML object from the FileOpen function. And each subsequent function takes that object as the first parameter. I can host it somewhere if needed.

Edit:

Damn, just realized you'll need my version of the UDF to do this... gonna have to wait until I get home to host it (can't FTP from work).

Edit2:

Ah ha, web FTP FTW!

_XMLDomWrapper (object version)

Example above updated accordingly.

Edited by wraithdu
Link to post
Share on other sites

I`m not sure about how to use this UDF. For example I have this kind of XML file:

<?xml version="1.0"?>
<BaseMap name="Europe">
    <Country id="Country_1">
        <PolyCoords>
            X1,Y1
            X2,Y2
            .....
            Xn,Yn
        </PolyCoords>
    </Country>
    <Country id="Country_2">
        <PolyCoords>
            X1,Y1
            X2,Y2
            .....
            Xn,Yn
        </PolyCoords>
    </Country>
</BaseMap>

How should I get root attrib name and then every country by ID and polycoords for every country?

EDIT:

Finally I got how this work:

#include-once
#include <_XMLDomWrapper.au3>
#include <Array.au3>

_XMLFileOpen(@ScriptDir & "\BaseMap.xml")
$NODES = _XMLGetChildNodes("BaseMap")
For $INDEX = 1 To $NODES[0]
    $POLY_COORDS = _XMLGetChildren("BaseMap/" & $NODES[$INDEX])
    $ID = _XMLGetAttrib("/BaseMap/" & $NODES[$INDEX] & "[" & $INDEX & "]","id")
    MsgBox(0,$ID,StringReplace($POLY_COORDS[1][1],@TAB,""))
Next
Edited by Andreik
When the words fail... music speaks
Link to post
Share on other sites
  • 3 weeks later...

Can anyone give me a suggestion as to how I could get at the Certificate "Name" (not value) for BOTH Certificates.

Here is my XML:

<?xml version="1.0" encoding="UTF-8"?>
<ServerSettings DomainId="91B95" NameSpace="rpc">
    <CommConf>
        <AgentCommunicationSetting AlwaysConnect="1" CommunicationMode="PULL" DisableDownloadProfile="0" Kcs="748B9" PullHeartbeatSeconds="300" RandomizationEnabled="1" RandomizationRange="300" RememberCurrentGroup="0" RememberCurrentPolicyMode="0" UploadCmdStateHeartbeatSeconds="300" UploadLearnedApp="0" UploadLogHeartbeatSeconds="300" UploadOpStateHeartbeatSeconds="300"/>
        <ServerList Name="Local Servers">
            <ServerPriorityBlock Name="Priority1">
                <Server Address="192.168.100.10" HttpPort="80" HttpsVerifyCA="0" VerifySignatures="1"/>
            </ServerPriorityBlock>
            <ServerPriorityBlock Name="Priority2">
                <Server Address="192.168.100.11" HttpPort="80" HttpsVerifyCA="0" VerifySignatures="1"/>
            </ServerPriorityBlock>
        </ServerList>
        <ServerCertList>
            <Certificate Name="LocalCertOne">MIICP</Certificate>
            <Certificate Name="LocalCertTwo">MIICQ</Certificate>
        </ServerCertList>
        <LogSetting MaxLogRecords="100" SendingLogAllowed="1" UploadProcessLog="1" UploadRawLog="1" UploadSecurityLog="1" UploadSystemLog="1" UploadTrafficLog="1"/>
    </CommConf>
</ServerSettings>

I have this but it only gets me one of the names, I'd like to get both Certificate Names and assign them to separate variables.

$CertificateName = _XMLGetAttrib('/ServerSettings/CommConf/ServerCertList/Certificate', 'Name')

Looking to do something like this:

If $CertificateNameOne = "LocalCertOne" OR $CertificateNameTwo = "LocalCertOne" Then
    MsgBox("", "Don't Run It!", "Bad Cert NOT Found")
Elseif $CertificateNameOne = "LocalCertTwo" OR $CertificateNameTwo = "LocalCertTwo" Then
    MsgBox("", "Run It!", "Bad Cert Found")
EndIf

Thanks,

-Mike

Edited by mdwerne
Link to post
Share on other sites

Get the attribute values like this:

#include <_XMLDOMWrapper.au3>

$sXML = @ScriptDir & "\Test1.xml"
$iRET = _XMLFileOpen($sXML)
If @error Then
    MsgBox(16, "Error", "Failed to open XML; $iRET = " & $iRET & "; @error = " & @error)
    Exit
EndIf

$sXPath = "/ServerSettings/CommConf/ServerCertList/Certificate"
$iCount = _XMLGetNodeCount($sXPath)
For $n = 1 To $iCount
    $sName = _XMLGetAttrib($sXPath & "[" & $n & "]", "Name")
    ConsoleWrite("Debug:  $sName = " & $sName & @LF)
Next

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites

Is it possible to create some XML but just in memory, without a file written on hard disk?

#include <_XMLDOMWrapper.au3>

$sXML = '<?xml version="1.0" encoding="utf-8"?><root><element1 name="element1">"Element One"</element1></root>'
_XMLLoadXML($sXML)

:unsure:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites
  • 2 weeks later...

Hi,

I need to create utility to read info on xml file like this:

<?xml version="1.0" encoding="UTF-8"?>
<foldercolors>
 <path color="{A3B60A15-3008-40C5-B96B-615CF0005B25}" type="0">
  <dir>
   <pathstring>c:\windows</pathstring>
  </dir>
 </path>
 <path color="{2F499E2B-8B6E-4B80-8E3B-C73E032E801F}" type="2">
  <dir>
   <pathstring>c:\windows\test.temp</pathstring>
  </dir>
 </path>
 <path color="{C7A7BD30-0E8C-4A4B-B43A-2BA330167A21}" type="6">
  <dir>
   <pathstring>*(.zip|.rar|.7z|.tar|.tbz2|.tgz|.zipx)</pathstring>
  </dir>
 </path>
</foldercolors>

1) if "type" value is 0 or 2 (but other value), test if pathstring exists

2) create dialog to display no existing pathstring

3) add button in dialog to clear non existing pathstring in xml file

For now my script not read type value and i can not find how to do this. :unsure:

Can i have some help ?

foldercolors.xml

script.au3

Edited by AlbatorV
Link to post
Share on other sites

1) if "type" value is 0 or 2 (but other value), test if pathstring exists

For now my script not read type value and i can not find how to do this. :>

Can i have some help ?

Post a short example of how you are trying to read the "type" attribute.

You should be using _XMLGetAttrib().

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites

Here my script

For $i=1 to _XMLGetNodeCount("/foldercolors/path")
    $type = _XMLGetAttrib("foldercolors/path[" & $i & "]", "type")
    if $type[1]=0 or $type[1]=2 then
        $pathstring = _XMLGetValue("/foldercolors/path[" & $i & "]/dir/pathstring")
        If NOT FileExists($pathstring[1]) Then MsgBox(0,"","Type=" & $type[1])
    EndIf
Next
Edited by AlbatorV
Link to post
Share on other sites

You are confusing the return values. You get a string back for _XMLGetAttrib() and an array for _XMLGetValue():

#include <Array.au3>
#include <_XMLDOMWrapper.au3>

Global $debugging = True, $iRET, $type, $pathstring
Global $sXML = '<?xml version="1.0" encoding="UTF-8"?>' & @CRLF & _
        '<foldercolors>' & @CRLF & _
        '   <path color="{A3B60A15-3008-40C5-B96B-615CF0005B25}" type="0">' & @CRLF & _
        '       <dir>' & @CRLF & _
        '           <pathstring>c:\windows</pathstring>' & @CRLF & _
        '       </dir>' & @CRLF & _
        '   </path>' & @CRLF & _
        '   <path color="{2F499E2B-8B6E-4B80-8E3B-C73E032E801F}" type="2">' & @CRLF & _
        '       <dir>' & @CRLF & _
        '           <pathstring>c:\windows\test.temp</pathstring>' & @CRLF & _
        '       </dir>' & @CRLF & _
        '   </path>' & @CRLF & _
        '   <path color="{C7A7BD30-0E8C-4A4B-B43A-2BA330167A21}" type="6">' & @CRLF & _
        '       <dir>' & @CRLF & _
        '           <pathstring>*(.zip|.rar|.7z|.tar|.tbz2|.tgz|.zipx)</pathstring>' & @CRLF & _
        '       </dir>' & @CRLF & _
        '   </path>' & @CRLF & _
        '</foldercolors>' & @CRLF

$iRET = _XMLLoadXML($sXML)
ConsoleWrite("$iRET = " & $iRET & @LF)

For $i = 1 To _XMLGetNodeCount("/foldercolors/path")
    $type = _XMLGetAttrib("/foldercolors/path[" & $i & "]", "type")
    ConsoleWrite($i & ":  $type = " & $type & @LF)

    If $type = 0 Or $type = 2 Then
        $pathstring = _XMLGetValue("/foldercolors/path[" & $i & "]/dir/pathstring")
        _ArrayDisplay($pathstring)
    EndIf
Next

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites

It's perfect, thanks.

Another thing... I have this xml

<?xml version="1.0" ?>
<meta_data config_type="private" lastfeed_high="0" />

I want to get "config_type" value, so...

$configtype=_xmlgetattrib("/meta_data", "config_type")
msgbox(0,"","Config?  " & $configtype)

But always return "-1"

:unsure:

Edited by AlbatorV
Link to post
Share on other sites

I don't see the problem. This works fine for me:

#include <_XMLDOMWrapper.au3>

Global $debugging = True, $iRET, $configtype
Global $sXML = '<?xml version="1.0" ?>' & @CRLF & _
        '<meta_data config_type="private" lastfeed_high="0" />' & @CRLF

$iRET = _XMLLoadXML($sXML)
ConsoleWrite("$iRET = " & $iRET & @LF)

$configtype=_xmlgetattrib("/meta_data", "config_type")
msgbox(0,"","Config?  " & $configtype)

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to post
Share on other sites
  • 4 weeks later...

I've needed these for a while and didn't find any suitable so here's what I came up with.

_XMLDomWrapper.au3

Edit: Updated Version 03.07.2008 (Version 1.0.3.87) Total downloads: Posted Image

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

Works with newer wrapper :huh2:

XmlExample.au3

_XMLExample.au3 downloads: Posted Image The only thing I could not get to work was getting the checkbox state in the 2nd treeview.

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.

Edit: June 29,2006

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

Edit: March , Apr 2007

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

Edit: Jun 8, 2007

Fixed a namespace bug in _XMLCreateChildNode() and _XMLCreateChildNodeWAttr()

Edit: July 12, 2007

Changed version number displayed on this page to reflect latest version.

Edit: July 13, 2007

Fixed example script.

Edit: July 20, 2007

Fixed a bug where a failed _XMLFileOpen() return an empty object

Added an object check to applicable functions.

Edit: Aug 8, 2007

Added _XMLSetAutoSave() to turn off/on forced saving. -- Thanks drlava.

Added check for previous creation of COM error handler. --Thanks Lukasz Suleja

Edit: Aug 27, 2007

Changed order of properties created on file open to correct behaviour with namespaces.

Edit: Aug 31,2007

Fixed bug where _XMLUpdatedField would inadvertantly erase child nodes.

Edit: Sep 07,2007

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

Edit: Jan 05,2008

Fixed header documentation for _XMLGetAttrib. It returns the requested attribute if found. Not an array.

Edit: Feb 25,2008

Fixed dimensioning bug in _XMLGetChildren --Thanks oblique

Edit: Mar 05,2008

Return values fixed for the following functions: --Thanks oblique

_XMLFileOpen ,_XMLLoadXML,_XMLCreateFile

Documentation fixed for _XMLGetNodeCount,_XMLGetChildren --Thanks oblique

Edit: Mar 07,2008

Small changes.

Fixed an issue pointed out by lgr.

** latest version 1.0.3.87 ** Total downloads: Posted Image

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.

Hi eltorro,

I am syed and i am new to this Function. Today when i dig in to the forum i got an opportunity come accross the _XMLDomWrapper.au3 and i am strugling my self to understand the functions to use. Do you have any example codes for each function? if so that will help for my tool creation. could you please help me ?

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...