Hi PsaltyDS,
i am working on a tool creation. i need your help to complete that. could you please help me ? my task is simple! i should have all the application name in one node and the location and exe of that application should be in its child node. how can i create the XML for 35 to 90 applications? also how can i read that XML attributes thrioguh my code to shows in array?
I've tried some of the examples but I keep getting a "-1". I don't know anything about XML structures and so I don't know what the <OBT_WF_RUN_ID> element is in order to know which function(s) within the XMLDomWrapper I should use in order to determine the value of the <OBT_WF_RUN_ID> element. So, I was hoping for some direction.
Since I don't need to loop through the entire document enumerating values, I just need to obtain this one value - I've found it difficult to figure out how to do this from the many examples in this message thread.
Start from step one: how did you use _XMLFileOpen() and error check the result? The fragment of XML you showed includes namespace specifications, did you use those when opening the file?
First, don't make our lives hard by posting incomplete stuff that we have to edit just to see what you're talking about. It only took adding two lines to your partial XML example to make it complete. Just put this at the end:
</attInstances>
</encapsulatedArchiveGroup>
Now it's a complete XML file we can work with.
Now, on closer inspection you get some sympathy because this involves a topic that makes my pin feathers hurt: XPath query with an un-named default namespace. Ref: KB288147 Evil stuff.
If there is a defined namespace in your scope, then it MUST be explicitly named in the XPath query. The problem is the default namespace has no name. You still can't just leave it off, it MUST be used in XPATH. So at the document object in the MSXML DOM, you have to set the property for "SelectionNamespaces" with a usable name, and the exact same URI as the default. That is accomplished by this line:
The default namespace used in XPath selections will now be the same as it was before, but now it has a usable name "MyNS". So we can use that namespace name in the XPath elements:
Sorry, but I can't figure out how this UDF works. I am an experienced AU3 user, however I know almost nothing about XML. I tried to follow your examples, but there was no success. Here is my code:
<?xml version="1.0"?>
<!-- EXAMPLE: Ogg Vorbis stream from standard input WITHOUT reencoding This example streams an Ogg Vorbis stream from standard input (stdin.) Since ezstream will not be doing any reencoding, the resulting stream format (quality/bitrate, samplerate, channels) will be of the respective input stream. -->
<ezstream>
<url><a href='http://localhost:8000/vorbis.ogg</url>' class='bbc_url' title='External link' rel='nofollow external'>http://localhost:8000/vorbis.ogg</url></a>
<sourcepassword>hackme</sourcepassword>
<format>VORBIS</format>
<filename>stdin</filename>
<!-- Important: For streaming from standard input, the default for continuous streaming is bad. Set <stream_once /> to 1 here to prevent ezstream from spinning endlessly when the input stream stops: -->
<stream_once>1</stream_once>
<!-- The following settings are used to describe your stream to the server. It's up to you to make sure that the bitrate/quality/samplerate/channels information matches up with your input stream files. -->
<svrinfoname>My Stream</svrinfoname>
<svrinfourl><a href='http://www.oddsock.org</svrinfourl>' class='bbc_url' title='External link' rel='nofollow external'>http://www.oddsock.org</svrinfourl></a>
<svrinfogenre>RockNRoll</svrinfogenre>
<svrinfodescription>This is a stream description</svrinfodescription>
<svrinfobitrate>96</svrinfobitrate>
<svrinfoquality>2.0</svrinfoquality>
<svrinfochannels>2</svrinfochannels>
<svrinfosamplerate>44100</svrinfosamplerate>
<!-- Allow the server to advertise the stream on a public YP directory: -->
<svrinfopublic>1</svrinfopublic>
</ezstream>
Sorry but I can't read the "url" value... Any ideas?
Can someone help me in parsing the following xml. The problem is that I do not have any distinguishable 'attribute' between two NODEs.
There can be any number of NODEs under Root with no attribute.
Can someone help me in parsing the following xml. The problem is that I do not have any distinguishable 'attribute' between two NODEs. There can be any number of NODEs under Root with no attribute.
This seems more a xpath question than specific to the XML udf. There are several possibilities depends on your needs:
1) By content. For example: //NODE/Param1 = 4 (This returns the boolean true) 2) By node number.For example: /ROOT/NODE[2]/Param1 (This returns 4)
If the xml becomes large or very complex its better to use xslt or xquery with for example Saxon, but for most cases the XML UDF with Xpath will do the trick.
Look at _XMLGetAllAttrib() in the UDF. It's a little strange because it modifies two ByRef arrays, and also returns the results in a single 2D array. You'd have to ask eltorro why it does both.
Greetings. I am hoping someone can help me parse through my XML. I have reviewed the examples in this thread but still dont understand the whole attribute structures. Here is what I have so far:
Example of XML File is attached.
I am trying to capture the value of <is_hidden>false</is_hidden> as a variable from the node? control type ="ADVTEXTBOX_CTRL" where the element ID is user_id. I am suspecting I missing a whole lot in relation to nodes and such.
Here is my sample code:
#include <_XMLDomWrapper.au3> $sXML_File = "C:\File.xml" _XMLFileOpen($sXML_File) If _XMLFileOpen($sXML_File) Then $sVer = _XMLGetAttrib('./config/control/advtextbox_ctrl', 'is_hidden') MsgBox(1, "Test", $sVer,"") ;ConsoleWrite($sVer & @LF) EndIf