Jump to content

XML DOM wrapper (COM)


Recommended Posts

Ok i'm stuck again. I'm not familiar with XPATH and I followed the link in one of your posts and made a few attempts at creating child nodes.

I'm keeping this as simple as possible so here is my code:

#include <_XMLModified.au3>
#include <Array.au3>

_XMLCreateFile(@ScriptDir & "\test.xml", "menu", 1)
_XMLFileOpen (@ScriptDir & "\test.xml")
$ATTRIBS = _ArrayCreate ("name","oscode")
$CHILDATTRIBS = _ArrayCreate ("name","target","oscode")


$VALUES = _ArrayCreate ("Antivirus","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

$CHILDVALUES = _ArrayCreate ("Norton Antivirus 2006 Trial","WINFILES\Antivirus\Norton2006\NAV061220.exe","112")
_XMLCreateChildNodeWAttr("//menu/folder[0]", "item", $CHILDATTRIBS, $CHILDVALUES)

$VALUES = _ArrayCreate ("Spyware","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

$VALUES = _ArrayCreate ("Windows Updates","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

$VALUES = _ArrayCreate ("Internet","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

$VALUES = _ArrayCreate ("System Info","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

It simply does not write a child object under Root Child "Antivirus" no errors are produced, nothing. But the file outputs like this:

<?xml version="1.0"?>

<menu> <folder name="Antivirus" oscode="255"/>

<folder name="Spyware" oscode="255"/>

<folder name="Windows Updates" oscode="255"/>

<folder name="Internet" oscode="255"/>

<folder name="System Info" oscode="255"/>

</menu>

Link to post
Share on other sites
  • 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

Sorry for all the questions/problems, I really appreciate the help. Here is the code I copied from your post and put into scite to try. It keeps giving me a can't open file error.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1.124
; Author:         Stephen Podhajecki eltorro <gehossafats@netmdc.com>
; Version: 0.1
;
; Script Function:
;
; ----------------------------------------------------------------------------
#Include <_XMLDomWrapper.au3>; change this to your needs
#Include <Array.au3>
;_SetDebug(True)
opt("MustDeclareVars", 1)
;===============================================================================
Global $xmlFile
Global $count = 0
Global $sNxPath, $fHwnd
;===============================================================================

$xmlFile = FileOpenDialog("Open XML", @ScriptDir, "XML (*.XML)", 1)
If @error Then
    MsgBox(4096, "File Open", "No file chosen , Exiting")
    Exit
EndIf

Main()

Exit
;===============================================================================
;Funcs
;===============================================================================
Func Main()
    Local $szXPath, $aNodeName, $find, $ns, $oXSD,$iNodeCount,$aAttrName[1],$aAttrVal[1],$ret_val
    ;Local $xmlFile = "C:\cookbook" & ".xml"
    $ns = ""
    $oXSD = _XMLFileOpen ($xmlFile, $ns)
    If @error Or $oXSD < 1 Then
        MsgBox(0, "Error", "There was an error opening the file " & $xmlFile)
        $oXSD = 0
        Exit
    EndIf
    $szXPath = "//DATAPACKET/ROWDATA"
    $iNodeCount = _XMLGetNodeCount($szXPath & "/*")
    MsgBox(0,"Node Count",$iNodeCount)

    $aNodeName = _XMLGetChildNodes ($szXPath); get a list of node names under this path
    If $aNodeName <> - 1 Then
        For $find = 1 To $aNodeName[0]
            ConsoleWrite($aNodeName[$find]& '[' & $find & ']'&@LF)
            ;It's better to use node index instead of node name as all node here have same name.
          _XMLGetAllAttrib($szXPath & "/*" & '[' & $find & ']',$aAttrName,$aAttrVal)
             _ArrayDisplay($aAttrName,$szXPath & "/*" & '[' & $find & ']')
             _ArrayDisplay($aAttrVal,$szXPath & "/*" & '[' & $find & ']')

        Next
        MsgBox(266288,"_XMLWrapper","Done")
    Else
        MsgBox(0, "Error:", "No nodes found for " & $szXPath)
    EndIf
    $oXSD = 0
EndFunc;==>Main
oÝ÷ Øw«z+-ë^²×(uâ0jˬx-¢ËZ®×âêâ­¢ë[+{*.§^Ê«¢¸ v¥­êeÊÚ&ÊènW¦"Ûzk-¢^Ø^Æi_wºÚîȧ¶©®åzl"¶azzyÊ.Ò,µªíyÛh¶¼×âÆ+)àwè®f­ß®­ç(u쨺,µç[ºØ­È"¾)දj¸nW¢²z-jzç-zºè­«­¢+Øì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(ì(ìQÍÐMÉ¥ÁÐ(ì(ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´(¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí}a51½µ]ÉÁÁȹÔÌÐì(¥¹±Õ±ÐíÉÉä¹ÔÌÐì()±½°ÀÌØíÉаÀÌØíÑÍÑÙÈÄ)1½°ÀÌØíÍ¥±ôÅÕ½ÐíèÀäÈí½½­½½¬ÅÕ½ÐìµÀìÅÕ½Ðì¹áµ°ÅÕ½Ðì)1½°ÀÌØí¹ÌôÅÕ½ÐìÅÕ½Ðì)%¥±á¥ÍÑÌ ÀÌØíÍ¥±¤Q¡¸($%]¡¥±ÉɽÈôÀ($$$ÀÌØíÉÐô}a51¥±=Á¸ ÀÌØíÍ¥±°ÀÌØí¹Ì¤($$%¥ÀÌØíÉÐôÀÑ¡¸á¥Ð($$%5Í    ½à ÐÀäØ°ÅÕ½Ðí¥±½Õ¹ÅÕ½Ðì°ÅÕ½Ðí¥±½Õ¹ÅÕ½Ðì¤($$$ÀÌØíÑÍÑÙÈÄô}a51Ñ9½
½Õ¹Ð ÅÕ½Ðì¼½QA
-P½I=]QÅÕ½ÐìµÀìÅÕ½Ð켨ÅÕ½Ðì¤($$$5Í   ½à ÐÀäØ°ÅÕ½Ðí¹½½Õ¹ÐÅÕ½Ðì°ÀÌØíÑÍÑÙÈĤ($$%IÑÕɸ($%]¹($%5Í    ½à ÐÀäØ°ÅÕ½ÐíÉɽÈÅÕ½Ðì°}a51ÉÉ½È ¤¤(%¹%

As you can see I am using a copy of that xml stored at C:\ to do my testing. I'll also include a copy of the file versions on the off chance it makes a difference. Once again I am very greatful for the help and hope it didn't sound like I was questioning your code or testing of it. I just asked because I was worried there might be a system or setup factor causing the problem since I was assuming you had run it but it didn't run on mine.

Oh and I know about needing to pull out the return in the test script but forgot to before posting.

eltoro.au3

xmltestfile.au3

Edited by sean1976
Link to post
Share on other sites
sean1976, I downloaded your cookbook.xml and the script example you last provided (Not the Test Script) and I was able to convert your XML into an array just fine which you could then work with in AutoIT. One problem I encountered is that your XML has a dangling tag called <PARAMS/> below the </FIELDS> tag which could cause a parse error. I'll throw something together for you which will display all of this data nicely in a table. It'll have to wait till morning because my girlfriend is nagging me. Women...
Link to post
Share on other sites

Ok i'm stuck again. I'm not familiar with XPATH and I followed the link in one of your posts and made a few attempts at creating child nodes.

_XMLCreateChildNodeWAttr() should have been removed. I will remove it in the next release.

use _XMLCreateChildWAttr() instead.

I showed 3 ways you can add the node to your file.

#include <_XMLModified.au3>
;#include <_XMLDomWrapper.au3>
#include <Array.au3>

_XMLCreateFile(@ScriptDir & "\test.xml", "menu", 1)
_XMLFileOpen (@ScriptDir & "\test.xml")
$ATTRIBS = _ArrayCreate ("name","oscode")
$CHILDATTRIBS = _ArrayCreate ("name","target","oscode")


$VALUES = _ArrayCreate ("Antivirus","255")
$ret = _XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)


$CHILDVALUES = _ArrayCreate ("Norton Antivirus 2006 Trial","WINFILES\Antivirus\Norton2006\NAV061220.exe","112")
;three ways to get a node
_XMLCreateChildWAttr("//menu/folder[1]", "item", $CHILDATTRIBS, $CHILDVALUES) ;by node index
;_XMLCreateChildWAttr("//menu/*[position()=1]", "item", $CHILDATTRIBS, $CHILDVALUES) ;by xpath position() func
;_XMLCreateChildWAttr("//menu/folder[@name='Antivirus']", "item", $CHILDATTRIBS, $CHILDVALUES); by attribute name

$VALUES = _ArrayCreate ("Spyware","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

$VALUES = _ArrayCreate ("Windows Updates","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

$VALUES = _ArrayCreate ("Internet","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

$VALUES = _ArrayCreate ("System Info","255")
_XMLCreateRootNodeWAttr("folder", $ATTRIBS, $VALUES)

Hope that helps.

Link to post
Share on other sites

sean1976, sorry I took so long to respond, it's a bit after noon. I threw some letters and numbers into a text file and this is what came out.

; AutoIt Version:   3.1.1.128
; Author:           Stephen Podhajecki eltorro <gehossafats@netmdc.com>
; Modified by:      WeaponX <ghostofagoodthing@gmail.com>
; Version: 0.5
;
; Script Function: Populate Array from cookbook.xml, display in listview
;
; ----------------------------------------------------------------------------
#Include <_XMLDomWrapper.au3>; change this to your needs
#Include <Array.au3>
#include <GUIConstants.au3>

;_SetDebug(True)
opt("MustDeclareVars", 1)
;===============================================================================
Global $xmlFile
Global $count = 0
Global $sNxPath, $fHwnd
Global $ARRAY[1][1]
Global $ARRAYX
Global $ARRAYY
;===============================================================================
;Manual XML path for testing, comment out
;$xmlFile = "D:\Design\Archrival Assembler\Old Versions\cookbook.xml"

If $xmlFile = "" Then
    $xmlFile = FileOpenDialog("Open XML", @ScriptDir, "XML (*.XML)", 1)
    If @error Then
        MsgBox(4096, "File Open", "No file chosen , Exiting")
    Exit
    EndIf
EndIf

Main()
Gui()
Exit

Func Main()
    Local $szXPath1,$szXPath2, $aNodeName1,$aNodeName2, $find, $oXSD,$iNodeCount,$aAttrName1[1],$aAttrVal1[1],$aAttrName2[1],$aAttrVal2[1],$ret_val,$X
    $oXSD = _XMLFileOpen ($xmlFile, "")
    If @error Or $oXSD < 1 Then
        MsgBox(0, "Error", "There was an error opening the file " & $xmlFile)
        $oXSD = 0
        Exit
    EndIf
    
    $szXPath1 = "//DATAPACKET/METADATA/FIELDS"
    $szXPath2 = "//DATAPACKET/ROWDATA"
    
    $ARRAYX = _XMLGetNodeCount($szXPath1 & "/*")
    $ARRAYY = _XMLGetNodeCount($szXPath2 & "/*")
    ReDim $ARRAY[$ARRAYX][$ARRAYY+1]

    $aNodeName1 = _XMLGetChildNodes ($szXPath1)
    $aNodeName2 = _XMLGetChildNodes ($szXPath2)
    If $aNodeName1 <> -1 Then
        ;LOOP THROUGH //DATAPACKET/METADATA/FIELDS
        For $find = 1 To $aNodeName1[0]
            _XMLGetAllAttrib($szXPath1 & "/*" & '[' & $find & ']',$aAttrName1,$aAttrVal1)
            ;ADD TO ARRAY
            $ARRAY[$find-1][0] = $aAttrVal1[0]
            ;LOOP THROUGH //DATAPACKET/ROWDATA
            For $X=1 To $aNodeName2[0]
                _XMLGetAllAttrib($szXPath2 & "/*" & '[' & $X & ']',$aAttrName2,$aAttrVal2)
                ;ONLY APPEND IF CURRENT FIELD NIMBER IS LESS THAN NUMBER OF ATTRIBS FOUND IN EACH ROW
                If $find <= Ubound($aAttrName2) Then
                $ARRAY[$find-1][$X] = $aAttrVal2[$find-1]
                EndIf
            Next
        Next
    Else
        MsgBox(0, "Error:", "No nodes found for " & $szXPath1)
    EndIf

    $oXSD = 0
EndFunc;==>Main

Func GUI()
    Local $msg
    Local $listview
    Local $X = 0
    Local $Y = 1
    Local $HEADER
    Local $COL
    Local $ROW
    
    GUICreate("Cookbook",600,300)  ; will create a dialog box that when displayed is centered
    GUISetState (@SW_SHOW)       ; will display an empty dialog box
    
    ;CREATE HEADER FOR LISTVIEW
    While $X < Ubound($ARRAY)
        $HEADER = $HEADER & $ARRAY[$X][0] & "|"
        $X=$X+1
    WEnd
    
    $listview = GUICtrlCreateListView ($HEADER ,5,5,590,290);,$LVS_SORTDESCENDING)
    
    ;Loop through $ARRAY (from "//DATAPACKET/ROWDATA")
    $Y = 1
    While $Y < Ubound($ARRAY,2)
        ;Loop through $ARRAY (from "//DATAPACKET/METADATA/FIELDS")
        $X=0
        $ROW = ""
        While $X < Ubound($ARRAY)
            $ROW = $ROW & $ARRAY[$X][$Y] & "|"
            $X=$X+1
        WEnd
        GUICtrlCreateListViewItem ($ROW,$listview)
        $Y=$Y+1
    WEnd
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
EndFunc

This will gather the data from your file, populate an array, and to show that it works dispaly a listview. Let me know if you have any questions. I used beta 3.1.1.128 to test.

COOKBOOKVIEWER.au3

cookbook.xml

Link to post
Share on other sites

ok now I'm really puzzled. At first after reading weaponx's post I thought it the problem may have been a version issue since I realized I was using beta 3.1.1.127 instead of 128. But after I updated to .128 I am still getting the "there was an error opening the file ########" whenever I try to open using the code you two posted for me but the testscript still does not return an error. Any ideas of what might be causing this issue with the open command?

Link to post
Share on other sites

ok now I'm really puzzled. At first after reading weaponx's post I thought it the problem may have been a version issue since I realized I was using beta 3.1.1.127 instead of 128. But after I updated to .128 I am still getting the "there was an error opening the file ########" whenever I try to open using the code you two posted for me but the testscript still does not return an error. Any ideas of what might be causing this issue with the open command?

You might have a look at this post. If that is not you problem then post back. And we'll see if we can figure out what is happening.

Link to post
Share on other sites

The only difference that I can think of is that I have the _XMLDomWrapper.au3 file in the same folder as my script.

Or maybe are you trying to open the file from a UNC path or network share?

Also I am running XP Pro SP2 maybe windows is missing something. Make sure you have all windows updates installed. I'm not sure where MSXML gets updated.

Edited by weaponx
Link to post
Share on other sites

ok, I tried all the different msxml version setting's in the _XMLDomWrapper file without any luck. Still getting the file open error and the variable not an object error with the testfile I made. I am using the scripts with the _XMLDomWrapper file in the same folder as the script and with a copy of the xml in the same folder. Gonna check to make sure I have everything updated, currently using windows XP Home SP2.

Yay, found the problem. It was the msxml installation. I downloaded the files for the current MSXML 4.0 SP2 and tried the code you guys gave me and it worked great. Thank you both so much for your help with this. Hopefully I'll be proficient enough in the future to help others similarly.

Once again thank you both for the help. I finished the basic functioning of what I was working on and am now going to work on some improvements but your help allowed me to get the basic program working properly

Edited by sean1976
Link to post
Share on other sites
  • 2 weeks later...

I'm not exactly sure atm what the difference between _XMLGetAllAttribIndex and _XMLGetAllAttrib is?

;===============================================================================
; Function Name:    _XMLGetAllAttribIndex
; Description:        Get all XML Field(s) attributes based on Xpath and specific index.
oÝ÷ Øò¢èZ½éèuë(^±©µ¨'jg­éò¢èZ½ëh­çÞ­éÜzØ^¼¢×±N­ßÛ-êkzh¬jëh×6;===============================================================================
; Function Name:    _XMLGetAllAttrib
; Description:        Get all XML Field(s) attributes based on XPath input from root node.
Link to post
Share on other sites

I have an XML file...

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="a" value="Goober"/>
        <add key="b" value="Goober"/>
        <add key="c" value="Goober"/>
    </appSettings>
</configuration>

How do I change the "value" of key="b" so like my result is....

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="a" value="Goober"/>
        <add key="b" value="Holy Moly Batman"/>
        <add key="c" value="Goober"/>
    </appSettings>
</configuration>
;Change an attribute value
#include <_XMLDomWrapper.au3>
 $oXML = _XMLFileOpen (@ScriptDir&"\abc.xml", "")
     If @error Or $oXML < 1 Then
        MsgBox(0, "Error", "There was an error opening the file " & @ScriptDir&"\abc.xml")
        $oXML = 0
        Exit
    EndIf
Local $before , $after

;show what it is now
$before = _XMLGetAttrib("configuration/appSettings/add[@key='b']","value")
MsgBox(0,"Before",$before)

;change it
_XMLSetAttrib ("configuration/appSettings/add[@key='b']", "value", "Holy Moly Batman")

;show that it is changed
$after = _XMLGetAttrib("configuration/appSettings/add[@key='b']","value")
MsgBox(0,"After",$after)

;delete reference
$oXML= 0
Exit

There is also an updated wrapper which fixes a bug. Please update. :D

Edit: Changed to code box as autoit code box is not working.

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

<?xml version="1.0"? standalone="yes" ?>
<Data>
    <Group>
        <GroupNumber>1</GroupNumber>
        <Person1>Jacob</Person1>
        <Person2>Emily</Person2>
        <Person3>Michael</Person3>
    </Group>
    <Group>
        <GroupNumber>2</GroupNumber>
        <Person1>Matthew</Person1>
        <Person2>Abigail</Person2>
        <Person3>Olivia</Person3>
    </Group>
</Data>

quick and easy question...

how do you make sub xml groups as shown above?

this is probably something really easy, but i've just started with this and this is all i've been able to get:

<?xml version="1.0"?>
<Group>
    <GroupNumber>1</GroupNumber>
    <Person1>Jacob</Person1>
    <Person2>Emily</Person2>
    <Person3>Michael</Person3>
</Group>

thanks for the help

Link to post
Share on other sites

This should do what you want:

;Stephen Podhajecki [eltorro]
;
$Debug = True
#Include <_XMLDomWrapper.au3>
$path = @ScriptDir&"\groups.xml"
$root = "Data"
_XMLCreateFile ($path, $root, True); create file with root data
$hXml= _XMLFileOpen($path)

For $x = 1 to 10
    _XMLCreateRootChild("Group", "" , "")
    _XMLCreateChildNode($root&"/Group["&$x&"]","GroupNumber",$x,"") ; create children by index
Next


Local $aNames[3]=["Jacob","Emily","Michael"]
For $x = 1 to 3
    _XMLCreateChildNode($root&"/Group[1]","Person"&$x,$aNames[$x-1],"") ;add people to groups
Next
Local $aNames[3]=["Matthew","Abigail","Olivia"]
For $x = 1 to 3
    _XMLCreateChildNode($root&"/Group[2]","Person"&$x,$aNames[$x-1],"")
Next

$hXml=0
Exit

<?xml version="1.0"?>
<Data>
  <Group>
    <GroupNumber>1</GroupNumber>
    <Person1>Jacob</Person1>
    <Person2>Emily</Person2>
    <Person3>Michael</Person3>
  </Group>
  <Group>
    <GroupNumber>2</GroupNumber>
    <Person1>Matthew</Person1>
    <Person2>Abigail</Person2>
    <Person3>Olivia</Person3>
  </Group>
  <Group>
    <GroupNumber>3</GroupNumber>
  </Group>
  <Group>
    <GroupNumber>4</GroupNumber>
  </Group>
  <Group>
    <GroupNumber>5</GroupNumber>
  </Group>
  <Group>
    <GroupNumber>6</GroupNumber>
  </Group>
  <Group>
    <GroupNumber>7</GroupNumber>
  </Group>
  <Group>
    <GroupNumber>8</GroupNumber>
  </Group>
  <Group>
    <GroupNumber>9</GroupNumber>
  </Group>
  <Group>
    <GroupNumber>10</GroupNumber>
  </Group>
</Data>

I hope this helps. :whistle:

eltorro

Link to post
Share on other sites

Thanks for the XMLDOMwrapper, I have had lots of use for it! :whistle:

I thought I'd contribute with a little helper function that I wrote to make use of the 'DocumentFragment' function in XMLDOM.

Good to have if you want to move bigger chunks of the nodetree at once.

Sorry if the code is a little rough or maybe even fawlty... I'm no programmer, just a newbie on a steep

learning curve...

You are most welcome to refine it, if you wish to. :)

cheers

capricorn33

;this code should be inserted inside the _XMLDOMwrapper

Func _XMLGetFragment($strXPath) 
local $names[1], $objNodelist, $objN

;create DocumentFragmentobject
   $objFragment = $objDoc.createNode(11, "fragm", "")
   $objN = $objDoc.selectSingleNode ($strXPath)
   
    While @error = 0
               If Not IsObj($objN) Then $xmlerr = @CRLF & "No Matching Nodes found"
               $objFragment = $objN
               return $objFragment
      wend
EndFunc

Func _XMLNodeDragAndDrop($dragXPath, $dropXPath)
      
      $fragNode = _XMLGetFragment($dragXPath);documentFragment fed with the node to be moved
      $objDrop = $objDoc.selectSingleNode ($dropXPath)
      _XMLDeleteNode($dragXPath)    ;delete old node
      
      $parentN = $objDrop.parentNode
      $parentN.insertBefore($fragNode, $objDrop);insert DocFrag before $dropXPath
;test    msgbox(0,"show xml",$parentN.xml)    
      $objDoc.save($strFile)
      return

EndFunc
Edited by capricorn33
Link to post
Share on other sites
  • 5 weeks later...

wow

first of all great thing with the xml code :P

but I got problems... and I can't solve them :)

Heres my auto it code...

What I wanted to do... I wanted simply to read the values out of the .xml and store them in variables...

if I use XMLGetValue in my "test" message box ´there is no value displayed.. so I think I get a null value

Local $sFile = "books.xml"  
    If FileExists($sFile) Then
        While @error = 0
            $ret = _XMLFileOpen ($sFile)
            if $ret =0 then Exit

            $Bobber = _XMLGetValue ("Settings/Bobber")
            $Variance = _XMLGetValue ("Settings/Variance")
            $search = _XMLGetValue ("Settings/Search")

            MsgBox(4096, "test", $search)
            Return
        WEnd
        MsgBox(4096, "Error", _XMLError ())
    EndIf

and here is my books.xml

<?xml version="1.0"?>
<Settings>
<Search>4</Search>
<Bobber>1</Bobber>
<Variance>80</Variance>
</Settings>

Would be very nice if someone could help me out

Edited by hermherm
Link to post
Share on other sites

Try using

MsgBox(4096, "test", $search[1])
oÝ÷ Ú)ìµæ¡ö®¶­s`¤×6t&÷CbÂgV÷C·FW7BgV÷C²Âb33c·6V&6oÝ÷ Ù«­¢+Ø(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ìչѥ½¸9µè}a51ÑY±Õ(ìÍÉ¥ÁÑ¥½¸èÐa50¥±Í½¸aAÑ ¥¹ÁÕÐɽ´É½½Ð¹½¸(ìAɵÑÉÌèÀÌØíÁÑ áµ°ÑÉÁÑ É½´É½½Ð¹½¡É½½Ð½¡¥±½¡¥±¸¸¤(ìMå¹Ñàè}a51ÑY±Õ ÀÌØíÁÑ ¤(ìÕÑ¡½È¡Ì¤èMÑÁ¡¸A½¡©­¤±Ðí¡½ÍÍÑ͹ѵ¹½´Ðì(ìIÑÕɹÌèÉÉä½¥±ÌÑáÐÙ±Õ̴Ľ¸¥±ÕÉ(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(oÝ÷ Øw«zØ^r^"ëu«­¢+Ø)1½°ÀÌØíÍ¥±ôÅÕ½Ðí½½­Ì¹áµ°ÅÕ½Ðì(%¥±á¥ÍÑÌ ÀÌØíÍ¥±¤Q¡¸(ÀÌØíÉÐô}a51¥±=Á¸ ÀÌØíÍ¥±¤(¥ÀÌØíÉÐôÀÑ¡¸á¥Ð((ÀÌØí  ½Èô}a51ÑY±Õ ÅÕ½ÐíMÑÑ¥¹Ì½   ½ÈÅÕ½Ðì¤(ÀÌØíYÉ¥¹ô}a51ÑY±Õ ÅÕ½ÐíMÑÑ¥¹Ì½YÉ¥¹ÅÕ½Ðì¤(ÀÌØíÍÉ ô}a51ÑY±Õ ÅÕ½ÐíMÑÑ¥¹Ì½MÉ ÅÕ½Ðì¤((5Í    ½à ÐÀäØ°ÅÕ½ÐíÑÍÐÅÕ½Ðì°ÀÌØíÍÉ¡lÅt¤(5Í ½à ÐÀäØ°ÅÕ½ÐíÉɽÈÅÕ½Ðì°}a51ÉÉ½È ¤¤(¹%(

eltorro

Link to post
Share on other sites
  • 1 month later...

I have an xml file and I need to pull the outcall and incalls to arrays, I'm lost.. Any help would be great :lmao:

XML File

<?xml version="1.0"?>
<phone>
    <hourstart>10</hourstart>
    <hourstop>1</hourstop>
    <id>1510 10 3</id>
    <light>no</light>
    <call>Line_1_459.55 Line_1_2655.06</call>
    <call>Line_1_464.85 Line_1_2667.57</call>
    <call>Line_1_470.11 Line_1_2680.01</call>
    <call>Line_1_475.57 Line_1_2692.9</call>
    <call>Line_1_480.9 Line_1_2705.49</call>
    <call>Line_1_486.2 Line_1_2718.01</call
    <outcall>Line_1_604.13 Line_1_2523.96</outcall>
    <outcall>Line_1_617.85 Line_1_2522.98</outcall>
    <outcall>Line_1_620.82 Line_1_2538.1</outcall>
    <outcall>Line_1_616.26 Line_1_2550.58</outcall>
    <outcall>Line_1_609.74 Line_1_2562.6</outcall>  
</phone>
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...