Luigi Posted July 18, 2014 Posted July 18, 2014 (edited) Hi Forum! I try translate this example from VB http://msdn.microsoft.com/en-us/library/aa468547.aspx to AutoIt... Almost everything works... $xNode.parentNode.nodeName works fine... $xNode.nodeValue not works... It is recursive, get all nodes, but not print values.. XML is hard to me yet, someone can a little help here? To show nodeValue? Best Regards, Detefon #include <String.au3> Global Const $NODE_TYPE = 1 LoadDocument() Func LoadDocument() Local $xDoc = ObjCreate('MSXML.DOMDocument') $xDoc.validateOnParse = False If $xDoc.Load('teste.tmx') Then DisplayNode($xDoc.childNodes, 0) EndIf EndFunc ;==>LoadDocument Func DisplayNode($Nodes, $iIdent = 0) Local $NODE_TYPE = 1 Local $xNode = ObjCreate('MSXML.IXMLDOMNode') $iIdent += 2 For $xNode In $Nodes If $xNode.nodeType() == $NODE_TYPE Then ConsoleWrite(_StringRepeat(' ', $iIdent) & 'key[ ' & $xNode.parentNode.nodeName & ' ] value[ ' & $xNode.nodeValue & ' ]' & @LF) EndIf If $xNode.hasChildNodes() Then DisplayNode($xNode.childNodes(), $iIdent) Next EndFunc ;==>DisplayNode the xml file expandcollapse popup<?xml version="1.0" encoding="UTF-8"?> <map version="1.0" orientation="orthogonal" width="4" height="4" tilewidth="32" tileheight="32"> <tileset firstgid="1" name="dirt" tilewidth="32" tileheight="32"> <image source="dirt.png" trans="ffffff" width="96" height="192"/> <terraintypes> <terrain name="dirt" tile="10"/> </terraintypes> <tile id="1" terrain="0,0,0,"/> <tile id="2" terrain="0,0,,0"/> <tile id="4" terrain="0,,0,0"/> <tile id="5" terrain=",0,0,0"/> <tile id="6" terrain=",,,0"/> <tile id="7" terrain=",,0,0"/> <tile id="8" terrain=",,0,"/> <tile id="9" terrain=",0,,0"/> <tile id="10" terrain="0,0,0,0"/> <tile id="11" terrain="0,,0,"/> <tile id="12" terrain=",0,,"/> <tile id="13" terrain="0,0,,"/> <tile id="14" terrain="0,,,"/> <tile id="15" terrain="0,0,0,0"/> <tile id="16" terrain="0,0,0,0"/> <tile id="17" terrain="0,0,0,0"/> </tileset> <tileset firstgid="19" name="dirt2" tilewidth="32" tileheight="32"> <image source="dirt2.png" trans="ffffff" width="96" height="192"/> <terraintypes> <terrain name="dirt2" tile="10"/> </terraintypes> <tile id="1" terrain="0,0,0,"/> <tile id="2" terrain="0,0,,0"/> <tile id="4" terrain="0,,0,0"/> <tile id="5" terrain=",0,0,0"/> <tile id="6" terrain=",,,0"/> <tile id="7" terrain=",,0,0"/> <tile id="8" terrain=",,0,"/> <tile id="9" terrain=",0,,0"/> <tile id="10" terrain="0,0,0,0"/> <tile id="11" terrain="0,,0,"/> <tile id="12" terrain=",0,,"/> <tile id="13" terrain="0,0,,"/> <tile id="14" terrain="0,,,"/> <tile id="15" terrain="0,0,0,0"/> <tile id="16" terrain="0,0,0,0"/> <tile id="17" terrain="0,0,0,0"/> </tileset> <tileset firstgid="37" name="grass" tilewidth="32" tileheight="32"> <image source="grass.png" trans="ffffff" width="96" height="192"/> <terraintypes> <terrain name="grass" tile="10"/> </terraintypes> <tile id="1" terrain="0,0,0,"/> <tile id="2" terrain="0,0,,0"/> <tile id="4" terrain="0,,0,0"/> <tile id="5" terrain=",0,0,0"/> <tile id="6" terrain=",,,0"/> <tile id="7" terrain=",,0,0"/> <tile id="8" terrain=",,0,"/> <tile id="9" terrain=",0,,0"/> <tile id="10" terrain="0,0,0,0"/> <tile id="11" terrain="0,,0,"/> <tile id="12" terrain=",0,,"/> <tile id="13" terrain="0,0,,"/> <tile id="14" terrain="0,,,"/> <tile id="15" terrain="0,0,0,0"/> <tile id="16" terrain="0,0,0,0"/> <tile id="17" terrain="0,0,0,0"/> </tileset> <tileset firstgid="55" name="lava" tilewidth="32" tileheight="32"> <image source="lava.png" trans="ffffff" width="96" height="192"/> <terraintypes> <terrain name="lava" tile="10"/> </terraintypes> <tile id="1" terrain="0,0,0,"/> <tile id="2" terrain="0,0,,0"/> <tile id="4" terrain="0,,0,0"/> <tile id="5" terrain=",0,0,0"/> <tile id="6" terrain=",,,0"/> <tile id="7" terrain=",,0,0"/> <tile id="8" terrain=",,0,"/> <tile id="9" terrain=",0,,0"/> <tile id="10" terrain="0,0,0,0"/> <tile id="11" terrain="0,,0,"/> <tile id="12" terrain=",0,,"/> <tile id="13" terrain="0,0,,"/> <tile id="14" terrain="0,,,"/> <tile id="15" terrain="0,0,0,0"/> <tile id="16" terrain="0,0,0,0"/> <tile id="17" terrain="0,0,0,0"/> </tileset> <layer name="Camada de Tiles 1" width="4" height="4"> <data> <tile gid="71"/> <tile gid="70"/> <tile gid="71"/> <tile gid="65"/> <tile gid="72"/> <tile gid="65"/> <tile gid="65"/> <tile gid="70"/> <tile gid="71"/> <tile gid="72"/> <tile gid="65"/> <tile gid="65"/> <tile gid="70"/> <tile gid="71"/> <tile gid="71"/> <tile gid="70"/> </data> </layer> <layer name="Camada de Tiles 2" width="4" height="4"> <data> <tile gid="0"/> <tile gid="10"/> <tile gid="11"/> <tile gid="17"/> <tile gid="0"/> <tile gid="13"/> <tile gid="3"/> <tile gid="11"/> <tile gid="0"/> <tile gid="0"/> <tile gid="13"/> <tile gid="14"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> </data> </layer> <layer name="Camada de Tiles 3" width="4" height="4"> <data> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="0"/> <tile gid="43"/> <tile gid="44"/> <tile gid="45"/> <tile gid="0"/> <tile gid="46"/> <tile gid="53"/> <tile gid="48"/> <tile gid="0"/> </data> </layer> </map> Edited July 18, 2014 by Detefon Visit my repository
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now