Jump to content

Problem with _XMLSelectNodes


Recommended Posts

I am trying to open an xml file, and select some nodes to loop through, so I can pull data from them.  I am getting "No matching nodes found", when I try to pull the <include nodes.

Code:

#include <_XMLDomWrapper.au3>
Local $iRET, $iNodeCnt, $sXPath = "/databaseChangeLog"
Local $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "_XMLCOMEerr")

_SetDebug("True")

$iRET = _XMLFileOpen("c:\temp\test\test.xml")
If @error Then
    MsgBox(16,"Error",@error & @LF & @extended)
    Exit
EndIf

_DebugWrite("sXPath = " & $sXPath)
$tempXPath = $sXPath & "/*"
$aNodes = _XMLSelectNodes($tempXPath)
_DebugWrite("tempXPath = " & $tempXPath)
If @error Then
    MsgBox(16,"Error During SelectNodes",@error)
    Exit
EndIf


If IsArray($aNodes) Then
    ConsoleWrite("Check" & @LF)
For $n = 1 To $aNodes[0]
  ConsoleWrite($aNodes[$n] & @LF)
Next
EndIf

XML File:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
            
    <changeSet context="baseline" author="author" id="OracleCharacterSetCheck" dbms="oracle" runAlways="true">
        <preConditions onFail="WARN" onFailMessage="This database is not using a supported character set, and unexpected errors may occur as a result.">
            <sqlCheck expectedResult="1">SELECT count(*) FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET' and value in ('WE8ISO8859P15', 'WE8MSWIN1252', 'WE8ISO8859P1');</sqlCheck>
        </preConditions>
    </changeSet>
                    
    <include file="releaseChangelogs/version1/baseline.xml" relativeToChangelogFile="true"/>
    <include file="releaseChangelogs/version2/file.xml" relativeToChangelogFile="true"/>
    <include file="releaseChangelogs/version3/file.xml" relativeToChangelogFile="true"/>
    <include file="releaseChangelogs/version4/file.xml" relativeToChangelogFile="true"/>

</databaseChangeLog>
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...