Sign in to follow this  
Followers 0
Rotahn

Help with XMLDomWrapper

2 posts in this topic

I just can't get this working....... :">

i've been on this for 3 days now and i have come to the conclusion that i must be stupid :lmao:

Could someone please help me out on this as i have read (probably not understood) every post in the XMLDomwrapper thread in scripts and scraps and tried to acheive what i wanted using varients of each of the examples all with no success. Then i came to the code posted by eltorro in answer to hermherm...this is exactly what i want..unfortunatly i'm too stupid to make it work.

This is what i have so far...

#Include <_XMLDomWrapper.au3>
#include <Array.au3>


main()
func main()
Local $sFile = "item.xml"
    If FileExists($sFile) Then
            $ret = _XMLFileOpen ($sFile)
            if $ret =0 then Exit

            $id = _XMLGetValue ("realdata/item/id")
            $desc = _XMLGetValue ("realdata/item/desc")
            $price = _XMLGetValue ("realdata/item/price")

            MsgBox(4096, "test", $desc[1])
        MsgBox(4096, "Error", _XMLError ())
    EndIf
EndFunc

and this is the xml i am trying to read

<?xml version="1.0" ?>
- <RealData>
  <MSG ID="9">offline</MSG>
- <ITEM>
  <ID>1220902</ID>
  <DESC>Item Description</DESC>
  <PRICE CURRENCY="GBP">999.99</PRICE>
  <QTY>5</QTY>
  <DELDATE>2006-10-04</DELDATE>
  </ITEM>
  </RealData>

All i want is to be able to get these into simple variables...the answer just escapes me..

Please can someone show me where i'm going wrong, i dont want the script writing for me just a simple..'have you thought about doing it this way...' or, 'you fool, this just wont work' kind of thing :ph34r:

Cheers

Rotahn

Share this post


Link to post
Share on other sites



think it's case sensitive.

Lar.

func main()
    Local $sFile = ".\item.xml"
    If FileExists($sFile) Then
            $ret = _XMLFileOpen ($sFile)
            if $ret =0 then Exit

            $id = _XMLGetValue ("/RealData/ITEM/ID")
            $desc = _XMLGetValue ("/RealData/ITEM/DESC")
            $price = _XMLGetValue ("/RealData/ITEM/PRICE")

            MsgBox(4096, $desc[0], $desc[1])
        MsgBox(4096, "Error", _XMLError ())
    EndIf
EndFunc
Thank you very much Lar..your a star :ph34r:

Even though i feel pretty stupid in the fact that it didn't occur to me to check to see if it was case sensitive :lmao:

Thanks again

Rotahn

Share this post


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
Sign in to follow this  
Followers 0