Jump to content
Sign in to follow this  
devilyn

_XMLGetAttrib cant get attribute

Recommended Posts

devilyn

I'm unable to get the value from my XML. this is what i got so far...

#include "_XMLDomWrapper.au3"
#include <Array.au3>
$sXMLFile = "Test.xml"
$result = _XMLFileOpen($sXMLFile, 'xmlns="urn:schemas-professionalDisc:nonRealTimeMeta:ver.1.30" xmlns:lib="urn:schemas-professionalDisc:lib:ver.1.30" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"')
If $result = 0 Then
    MsgBox(0,"","File not found")
    Exit
EndIf

ConsoleWrite(_XMLGetAttrib("//xsi:Duration", "value")&@CRLF)

<?xml version="1.0" encoding="UTF-8"?>
<NonRealTimeMeta xmlns="urn:schemas-professionalDisc:nonRealTimeMeta:ver.1.30" xmlns:lib="urn:schemas-professionalDisc:lib:ver.1.30" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" lastUpdate="2011-10-05T19:30:05-08:00">
<TargetMaterial umidRef="060A2B340101010501010D4313000000BB8B4F25405805CA08004602023D3535"/>
<Duration value="555"/>
<LtcChangeTable tcFps="30" halfStep="false">
  <LtcChange frameCount="0" value="66153821" status="increment"/>
  <LtcChange frameCount="554" value="50343821" status="end"/>
</LtcChangeTable>
<CreationDate value="2011-10-05T19:29:52-08:00"/>
<TypicalUbit value="0000000005101120"/>
<BodyUmidBasicChangeTable>
  <BodyUmidBasicChange frameCount="0" value="060A2B340101010501010D4333000000BB8B4F25405805CA08004602023D3535" status="start"/>
</BodyUmidBasicChangeTable>
<BodyUmidWhenChangeTable>
  <BodyUmidWhenChange frameCount="0" value="475D700140580588" status="increment"/>
  <BodyUmidWhenChange frameCount="554" value="C7E7700140580588" status="end"/>
</BodyUmidWhenChangeTable>
<BodyUmidWhereChangeTable>
  <BodyUmidWhereChange frameCount="0" value="000000000000000000000000" status="start"/>
</BodyUmidWhereChangeTable>
<BodyUmidWhoChangeTable>
  <BodyUmidWhoChange frameCount="0" value="000000000000000000000000" status="start"/>
</BodyUmidWhoChangeTable>
<KlvPacketTable>
  <KlvPacket key="060E2B34010101050301020A02000000" frameCount="0" lengthValue="095F5265635374617274" status="spot"/>
</KlvPacketTable>
<VideoFormat>
  <VideoRecPort port="DIRECT"/>
  <VideoFrame videoCodec="MPEG2HD25CBR_1440_1080_MP@H-14" captureFps="59.94i" formatFps="59.94i"/>
  <VideoLayout pixel="1440" numOfVerticalLine="1080" aspectRatio="16:9"/>
</VideoFormat>
<AudioFormat numOfChannel="2">
  <AudioRecPort port="ANALOG" audioCodec="LPCM16" trackDst="CH1"/>
  <AudioRecPort port="ANALOG" audioCodec="LPCM16" trackDst="CH2"/>
</AudioFormat>
<Device manufacturer="Sony" modelName="PMW-EX1R" serialNo="0113621">
</Device>
<Lens modelName="XS14X5.8AS-X8D"/>
<RecordingMode type="normal" cacheRec="true"/>
</NonRealTimeMeta>

Thanks in advance

Share this post


Link to post
Share on other sites
devilyn

Found it!

$sXmlNS = '"urn:schemas-professionalDisc:nonRealTimeMeta:ver.1.30"'
If _XMLFileOpen($sXMLFile, 'xmlns=' & $sXmlNS) = -1 Then
ConsoleWrite("canĀ“t open file!" & @CRLF)
Exit
Else
$objDoc.setProperty("SelectionNamespaces", 'xmlns:MyNS=' & $sXmlNS)

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  

×