Jump to content

Recommended Posts

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