Sign in to follow this  
Followers 0
Jud420

XML Dom Help

4 posts in this topic

#1 ·  Posted (edited)

I am trying to use the XML DOM method, and I'm getting an 'invalid xml header' error. What am I doing wrong:

Code:

#Include <_XMLDomWrapper.au3>

_SetDebug()
Opt("TrayIconDebug", 1) 
LoaddXML()

Func LoadXML()
    $sFile = @ScriptDir & "\test.xml"
    $ret = _XMLFileOpen($sFile)
    $node = _XMLGetAttrib("/resultset", "count")
    trace($node)
EndFunc
Func trace($msg)
    ConsoleWrite($msg & @CR)
EndFunc

My XML:

<?xml version="1.0" encoding="utf-8" ?>
  <resultset count="1" fetch-size="1">
    <record mod-id="13" record-id="61">
      <field name="BRC #">
        <data>14003288</data>
      </field>
      <field name="criID">
        <data>65500071</data>
      </field>
      <field name="Client::FirstName">
        <data>William</data>
      </field>
      <field name="Client::LastName">
        <data>Tsombikos</data>
      </field>
      <field name="Client::DOB">
        <data>11/05/1984</data>
      </field>
    </record>
  </resultset>
Edited by Jud420

Share this post


Link to post
Share on other sites



Is your xml file actually saved as unicode?

Share this post


Link to post
Share on other sites

autoit wrote it, and the formatting is done by me for readability on the forum. its actually just one long string. What should the header say?

Share this post


Link to post
Share on other sites

I am trying to use the XML DOM method, and I'm getting an 'invalid xml header' error. What am I doing wrong:

Code:

#Include <_XMLDomWrapper.au3>

_SetDebug()
Opt("TrayIconDebug", 1) 
LoaddXML()

Func LoadXML()
    $sFile = @ScriptDir & "\test.xml"
    $ret = _XMLFileOpen($sFile)
    $node = _XMLGetAttrib("/resultset", "count")
    trace($node)
EndFunc
Func trace($msg)
    ConsoleWrite($msg & @CR)
EndFunc

My XML:

<?xml version="1.0" encoding="utf-8" ?>
  <resultset count="1" fetch-size="1">
    <record mod-id="13" record-id="61">
      <field name="BRC #">
        <data>14003288</data>
      </field>
      <field name="criID">
        <data>65500071</data>
      </field>
      <field name="Client::FirstName">
        <data>William</data>
      </field>
      <field name="Client::LastName">
        <data>Tsombikos</data>
      </field>
      <field name="Client::DOB">
        <data>11/05/1984</data>
      </field>
    </record>
  </resultset>
Other than a typo calling your function LoaddXML(), it works fine for me. I change the attribute to count=123, to be sure it was pulling the right one:

>Running:(3.2.8.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Temp\Test.au3"  
Debug = True
Get Attrib length= 1
RET>>123
123
+>10:08:16 AutoIT3.exe ended.rc:0

<_<


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

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