Looping through an XML file

I got this really great script that loops through some XML files and does stuff based off the content.
What I would like to do now is have it repeat when it gets to a certain field. for example my xml file would look like this.
<xml>
<fileName>nameoffile</fileName>
<userEmail>[email protected]</userEmail>
<commandList>
<item>info here</item>
<item>more info here</item>
<item>yet more info</item>
<item>still more info here</item>
</commandList>
</xml>
then basically i need the applescript to see the <commandList> tag and then repeat for each item.
i can't seem to wrap my head around how to get it to happen.
currently I am using this to extract the normal tags from the xml file
set theXML to choose file
tell application "System Events"
tell XML element 1 of contents of XML file theXML
set the fileName to value of (XML elements whose name is "fileName")
... and so on
end tell
end tell
i believe i have to put an if statment in saying that if the element name == "commandList" then
repeat with item in commandList
my stuff here.
end repeat
but i'm not sure how to build the statement.
thanks for any help.
P

Something like this?
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
set theXML to POSIX path of (choose file)
tell application "System Events"
tell XML element 1 of contents of XML file theXML -- root element
set the fileName to value of XML element "fileName"
get value of XML elements of XML element "commandList" -- sub elements
repeat with anItem in the result
log anItem
end repeat
end tell
end tell
</pre>

Similar Messages

  • How to loop through single XML File and send multiple RFC calls?

    I am looking for the best approach to use for making multiple RFC calls (can be sequential) using a single XML file of data.  I have been attempting to get a BPM loop working, but to no avail.  My RFC only accepts a single set of delivery input and I have been told to try to work with it as is.
    input xml sample:
    <?xml version="1.0" encoding="UTF-8"?>
    <ProofOfDelivery>
       <POD>
          <delivery_number>1</delivery_number>
          <carrier_name>UPS</carrier_name>
       </POD>
       <POD>
          <delivery_number>2</delivery_number>
          <carrier_name>UPS</carrier_name>
       </POD>
    </ProofOfDelivery>
    I need to make a synchronous RFC call for each set of POD data.
    Thanks in advance!

    Thanks for the inputs.
    I tried with a BPM and multi-mapping transformation before a ForEach block.  I am getting this error:
    Work item 000000028028: Object FLOWITEM method EXECUTE cannot be executed
    Error during result processing of work item 000000028029
    com/sap/xi/tf/_ProofOfDeliveryMultiMapping_com.sap.aii.utilxi.misc.api.BaseRuntimeExceptionRuntim
    Error: Exception CX_MERGE_SPLIT occurred (program: CL_MERGE_SPLIT_SERVICE========CP, include: CL_
    Probably because I am not making/using the container objects properly.  Here is a screenshot of my BPM.  Can anyone spot my issue or point me to an example on this sort of container use?
    [http://kdwendel.brinkster.net/images/bpm.jpg|http://kdwendel.brinkster.net/images/bpm.jpg]
    Thanks

  • Automator - Loop through a text file and process data through a 3rd party software

    Just stumbled on Automator the other day (I am a mac n00b) and would like to automate the processing of a text file, line-by-line, using a third party tool.  I would like Automator to loop through the text file one line at a time, copy the string and keep as a variable.  Next, place the variable data (copied string) into the text field of the 3rd party software for processing.  Once the processing is complete, I would like Automator to fetch the next line/string for processing.  I see items like "copy from clipboard" and  "variables" within the menu but I am not finding much documentation on how to utilizle this tool.  Just hear how potentially powerful it is. 
    The 3rd party software is not a brand name, just something made for me to process text.  I may have to use mouse clicks or tabs + [return] to navigate with Automator.  A term I heard on Bn Walldie's itunes video series was "scriptable software" for which I don't think this 3rd party app would be. 
    Kind regards,
    jw

    Good news and bad news...
    The good news is that it should be entirely possible to automate your workflow.
    The bad news is that it will be a nightmare to implement via Automator, if it's even possible.
    Automator is, essentially a pretty interface on top of AppleScript/Apple Events, and with the pretty interface comes a certain stranglehold on features. Knowing how to boil rice might make you a cook, but understanding flavor profiles and ingredient combinations can make you a chef, and it's the same with AppleScript and Automator. Automator's good at getting you from points A to B but if there are any bumps in the road (e.g. the application you're using isn't scriptable) then it falls apart.
    What I'm getting at is that your requirements are pretty simple to implement in AppleScript because you can get 'under the hood' and do exactly what you want, as opposed to Automator's restricted interface.
    The tricky part is that if no one else can see this app it's going to be hard to tell you what to do.
    I can give you the basics on reading a file and iterating through the lines of text in it, and I can show you how to 'type' text in any given application, but it may be up to you to put the pieces together.
    Here's one way of reading a file and working through each line of text:
    -- ask the user for a file:
    set theFile to (choose file)
    -- read the file contents:
    set theFileContents to (read file theFile)
    -- break out the lines/paragraphs of text:
    set theLines to paragraphs of theFileContents
    -- now iterate through those lines, one by one:
    repeat with eachLine in theLines
      -- code to perform for eachLine goes here
    end repeat
    Once you have a line of text (eachLine in the above example) you can 'type' that into another application via something like:
    tell application "AppName" to activate
    tell application "System Events"
              tell process "AppName"
      keystroke eachLine
              end tell
    end tell
    Here the AppleScript is activating the application and using System Events to emulate typing the contents of the eachLine variable into the process. Put this inside your repeat loop and you're almost there.

  • Loop through a csv file and return the number of rows in it?

    What would be simplest way to loop through a csv file and
    return the number of rows in it?
    <cffile action="read" file="#filename#" output="#csvstr#"
    >
    <LOOP THROUGH AND COUNT ROWS>

    ListLen(). Use chr(13) as your delimiter

  • How to loop through many XML messages and parse them ?

    Hi All
    I have been trying very hard to loop through many XML messages and process each of them. Let me first explain the problem -
    Suppose I have the following String -
    <xyz>
    <abc>happy</abc>
    </xyz>
    <xyz>
    <abc>new</abc>
    <xyz>
    <xyz>
    <abc>year</abc>
    </xyz>
    I have to process each message within the <xyz></xyz> tag and find the falue of <abc> element (happy, new and year).
    The extraction of <abc> value is very simple, I am using SAX parser's startElement() method to check every element's name and if the element's name is <abc> pick up the value. But I am not able to loop through the different messages within the <xyz></xyz> tag.
    I am thinking of using another DOM parser -
    DOMParser domParser = new DOMParser();
    StringReader rdr = new StringReader(inputXML);
    InputSource src = new InputSource(rdr);
    domParser.parse(src);
    Document doc = domParser.getDocument();
    NodeList nodeList = doc.getElementsByTagName("xyz");
    Now I can loop through this nodeList, but not able to. Is using the DOM parser and NodeList the preferable way of lopping through the messages, then how I can loop through ? Or is there any other way ?
    I have been trying on this for quite a few days, but not able to. Can you please help me out ?
    Thanking you in advance ....
    Nirmalya Sinha

    Hi,
    Try using the SAX reader from the dom4j package. The document object that you receive contains methods for getting the root elements and with that you can traverse down to the sub elements of it.
    Hope this was of some help.

  • Loop through the excel files in folder and sub folder

    hi all
    I need to loop  through all the excel fies in a folder and its sub folder which contain excel files 
    actually, my excel files contain a column  with sdate and it contain different dates in which  has to get the max  date my query is 
    "select * from  @[User::filename] where sdate=(select max(sdate) asi  from @[User::filename] )"
    loop  all the excel file in folder and its sub folder

    Take a look at the Foreach Loop.
    Here is an article about it.
    Andy Tauber
    Data Architect
    The Vancouver Clinic
    Website | LinkedIn
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

  • Trouble looping through XML file

    I've got the following code which loops through an XML file. It works when there are multiple devices in the XML file and the COMPUTER node in the script includes [$i] but if only one device is in the network (thus only one in the XML file) then I have to
    remove the [$i]. What am I doing wrong to make it apply to both?
    $i = 0
    foreach ($COMPUTER in $settings.Settings.Setting.COMPUTERS.COMPUTER) {
    # IP for Computer
    $IPADDRESS = $settings.Settings.Setting.COMPUTERS.COMPUTER[$i].COMPUTERIP
    # Username for Computer
    $USERNAME = $settings.Settings.Setting.COMPUTERS.COMPUTER[$i].USERNAME
    # Credentials file
    $CREDFILE = $settings.Settings.Setting.COMPUTERS.COMPUTER[$i].CRED
    # Do things here using the variables declared above
    $i= $i+1
    } # Stop looping
    I should point out that I've changed the variable and XML names accordingly but the principle is the same.
    Thanks in advance

    Hi Bobbins,
    no, I just pasted that there so you can copy&paste it to the console and see the results. External XML sources are totally valid.
    To apply this to your initial script example, replace all instances of ...
    $settings.Settings.Setting.COMPUTERS.COMPUTER[$i]
    ... with ...
    $COMPUTER
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • Java Tree's & XML Files ??

    Hi ye's -
    Listen I'm a little stuck - and need yer help ??? If ye's can .........please -
    The problem is this -
    I have a Massive XML File containing all the different Categories, Tags, Tag Descriptions, Indicators and valid Subfields, Repeatable Subfields.
    Now - I need to build a Tree to illustrate all this information - however within my code I don't want to Compare it against the elements int the XML file since I'll have tonnes of different elements, making my code enormous -
    Is there a way I can code in java to loop through the XML file and build up my Tree as it goes along ????
    Here is a sample of the code I was using - but surely theres an easier way ? Can't keep continuing like this ;o(
    Lorraine
    public void parseDomTreeMarc(Element rootElement)
    NodeList BiblioTags = rootElement.getChildNodes();
    DefaultMutableTreeNode Category = null;
    DefaultMutableTreeNode Tag = null;
    for(int i = 0; i < BiblioTags.getLength(); i++)
         if(BiblioTags.item(i).getNodeName().compareTo("Title") == 0)
              NodeList CategoriesList = BiblioTags.item(i).getChildNodes();
              Category = new DefaultMutableTreeNode(CategoriesList.item(i).getNodeValue());
              for(int j = 0; j < CategoriesList.getLength(); j++)
                   if(CategoriesList.item(j).getNodeName().compareTo("TagValue") == 0)
                        NodeList TagList = CategoriesList.item(j).getChildNodes();
                        for(int k = 0; k < TagList.getLength(); k++)
                             switch(TagList.item(k).getNodeType())
                                  case Node.TEXT_NODE:
                                  if(TagList.item(k).getNodeValue().compareTo("") != 0)
                                       Tag = new DefaultMutableTreeNode(TagList.item(k).getNodeValue());
                                       Category.add(Tag);
                             if(TagList.item(k).getNodeName().compareTo("TitleDescription") == 0)
                                       etc...
                                       doing same piece of code for all elements more or less ...
         //Create Marc Tree
    final JTree marcTree = new JTree(Category);
    marcTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    JScrollPane treeView1 = new JScrollPane(marcTree);
    this.getContentPane().add(treeView1, new XYConstraints(10, 350, 223, 197));

    Have emailed a jar file of sample code to the email address shown in your profie. Let me know if there's a better address to send it to
    Good luck!

  • Redirect the existing user's call to back office user by cross checking a Txt/Xml file on UCCX Scripting

    I need some help on following scenario.
    I have a customer UCCX 9 and When a new customer calls the contact center via a main number (eg:02089772111) to open an account or register themselves, caller will go through all the necessary welcome message …. And to an agent as normal
    Then the agent collects all the relevant informations (Name, address, tel-number (07929768543), etc) and records it in to a database
    And also the agent finally assign the customer to an internal person (eg: John on extension 3001 (not an agent)) and complete the account registration, like cisco assigning a TAC engineer to a case opener.
    Then the customer calls again to inquire anything in the future ( after opening an account) using the same phone (07929768543) on account and to the main number (eg:02089772111), caller should hear all the greeting, etc…like a first time caller and this time it should go to John on extension 3001 directly rather than to an agent.
    Is this possible with UCCX, can we add a file (xml or text) to script and update it with customer number and back office user extension to perform this diversion by collecting caller number and checking the file and send it to internal person. by updating this file real time by an agent or in a daily or weekly basis by a supervisor by modifying this txt/xml or may be a DataBase file.
    Thanks
    Shameer

    Shameer,
    Your XML file could look something like this:
    <?xml version="1.0" encoding="ISO-8859-1" ?> 
    <Numbers>
    <ANI="07929768200">
         <Ext>2001</Ext>
    </ANI>
    <ANI="02089772144">
         <Ext>2002</Ext>
    </ANI>
    </Numbers>
    You would then have to use the ANI of the caller to loop through the XML file. This would return the extension of the internal resource. They you would just use a call transfer step to connect the two together.
    HTH,
    Adam
    **Please remember to rate helpful posts, for the betterment of the community**
    Edit: fixed XML code. I was unaware that you can't have numbers as element names

  • Loop through CSV to create XML

    Hello all, first and foremost I want to apologize if this has been answered somewhere, but I am looking to do the following:
    I have 500 records I need put in XML format. The records are currently in CSV format. I can use curl to upload a record in XML format using our applications API. I was under the impression that I could generate 1 large XML file and upload the entire group.
    I have a script that will read in data from a CSV and output it to a file in XML format. I got the script the way I thought I needed it working, which was to create a new xml file, append a line to it, then loop through the csv and echo my string repeatedly inputing the variables from the CSV file. I could then upload the XML file where I needed it.
    As it turns out, it seems the API will only allow me to upload 1 record at a time. (ALMOST pointless IMO.) So what I am looking to do is change the way the script loops through the CSV file, and instead of creating 1 large file, I would like the script to loop through the CSV one line at a time, create the XML file of only 1 record, upload it using curl, delete itself (or its contents) and repeat that process throughout the entire CSV file.
    I am just getting familiar with loops, so Im not sure how I would even start this process, or even word what I want properly to search google. (Which I have been for the last two days, thats how I frankenstiened what I have below. Any help would be greatly appreciated.
    The script is as follows:
    #!/bin/bash
    echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' >> xmldata.xml
    #:Read variables from XMLInput.csv:#
    while read inputline;do
    line0="$(echo $inputline | cut -d, -f1)"
    line1="$(echo $inputline | cut -d, -f2)"
    #:Set auto increment ID:#
    idAdd0=$((idAdd0 +1))
    #:removes trailing alpha characters leaving only the IP address:#
    cutLine0=${line0//[^0-9.]/}
    #:Strips trailing octet and appends .1:#
    startIP=`echo $cutLine0 | sed 's/.[0-9]*$/.1/'`
    #:Strips trailing octet and appens 254:#
    endIP=`echo $cutLine0 | sed 's/.[0-9]*$/.254/'`
    #:echos line to txt file as XML:#
    echo "<network_segment><id>"$idAdd0"</id><name>$line0</name><starting_address>$startIP</starting_address><ending_address>$endIP</ending_address><distribution_point/><url/><netboot_server/><swu_server/><building>$line1</building><department/><override_buildings>false</override_buildings><override_departments>false</override_departments></network_segment>" >> xmldata.xml
    done < XMLInput.csv
    exit 0

    What I ended up doing was having the script create 500 separate XML files in a folder by adding my auto increment variable to the XML file name,
    then curling each file as a separate entry. A litte dirtier than I wanted, but in the end, I didn't have to manually enter 500 subnets
    and define there locations in a website. Job Done.
    Script if interested:
    #!/bin/bash
    #:Read variables from XMLInput.csv:#
    while read inputline;do
    line0="$(echo $inputline | cut -d, -f1)"
    line1="$(echo $inputline | cut -d, -f2)"
    echo
    #:Set auto increment ID:#
    idAdd0=$((idAdd0 +1))
    #:removes trailing alpha characters leaving only the IP address:#
    cutLine0=${line0//[^0-9.]/}
    #:Strips trailing octet and appends .1:#
    startIP=`echo $cutLine0 | sed 's/.[0-9]*$/.1/'`
    #:Strips trailing octet and appens 254:#
    endIP=`echo $cutLine0 | sed 's/.[0-9]*$/.254/'`
    #:echos line to txt file as XML:#
    echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'"<network_segment><id>"$idAdd0"</id><name>$line0</name><starting_address>
    $startIP</starting_address><ending_address>$endIP</ending_address><distribution_point/><url/><netboot_server/><swu_server/><building>$line1</building>
    <department/><override_buildings>false</override_buildings><override_departments>false</override_departments></network_segment>" >> xmldata$idAdd0.xml
    #:upload XML file to JSS:#
    `curl -k -v -u account:Password https://server address/JSSResource/networksegments/name/SegmentName -T "xmldata$idAdd0.xml" -X POST`
    done < XMLInput.csv
    exit 0

  • Update Database Through XML file using SAP B1 business objects

    Hello everyone,
    I am facing a problem ie I am not able to update the Database(SQL 2000) through an XML file.
    Though i am able to insert the data in the databse using xml file but unable to update that data.
    The tables i want to update are OITM,ITM1,OITW. While i was trying to update  the Databse i was getting an error ie " -1107 Object's key is not set".
    I dont want to use DTW for importing or anything.
    Kindly help me out why i am facing this problem asap...

    Hi Pranay,
    My case was that I wanted to replicate an item from one company to another (I guess that's your case also). What I finally did is copy field by field the objects I needed. Later I've find out the solution given here,
    Copy items between databases
    but I haven't try it out. I expect your comments about it :).
    Regards,
    Ian

  • SSIS - Loop through files from a file path based on the value in the variable

    Experts,
    I have a requirement where I'll be loading multiple files in to a SQL server table and archive the files when loaded. However, the challenge is , the file path should be dynamic based on the value of a variable (say, @ProductName).
    For example: If I am running the package for variable @ProductName="Product", the file path would be "\\....\Src\Product", in that case the ForEachLoop will loop through all the files in that folder, load them to the table and Archive
    the files to the "\\....\Src\Product\Archive" folder.
    Similarly, if the @ProductName="Product_NCP", the foreachloop container should loop through files in the "\\....\Src\Product_NCP" folder, load them to the table and archive them to the ""\\....\Src\Product_NCP\Archive"
    folder.
    Any suggestions? I should be able to run the package manually just by passing the "@Product" value, create Archive folder if it doesn't exist, load the data and archive the files.

    Yes
    1. Have a variable inside SSIS to get folder path. Set path based on your rule using an expression
    like
    (@[User::ProductName] == "Product" ? "\\....\Src\Product" : (@[User::ProductName] == "Product_NCP" ? \\....\Src\Product_NCP:..))
    similary archive
    (@[User::ProductName] == "Product" ? "\\....\Src\Product\Archive" : (@[User::ProductName] == "Product_NCP" ? "\\....\Src\Product_NCP\Archive" :..))
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Configuring SPA2102 through xml file

    Can anyone help me? I have an SPA2102 and i want to configure it through an xml file, but it doesnt seem to work, the xml im sending is the following:
    <flat-profile>
    <User_ID_1_>user</User_ID_1_>
    <Password_1_>password</Password_1_>
    </flat-profile>
    Since all i want to change is the account, but when i load it with the http://ipaddress/admin/resync?tftp... i get the following message,  SPA will resync the profile when it is not in use and reboot
    you can click HERE to return to the configuration page, but it never reboots,and if i do it manually, it stays the same, so i would appretiate if someone could help me, and point me in the right direction, telling what is that im doing wrong. Thanks in advance. 

    I will try to make it clearer:
    The server I have access to runs Tomcat through Apache. The only way I can access files is if I put them under httdocs.
    The question is quite simple: without having my clueless host remap everything, how can I access files in the Tomcat directory, where those files rightly belong?
    There should be a simple way to do it in a web.xml file, but have been unsuccessful thus far.

  • URGENT:  Loop through files

    I have a package that will be run from an Oracle Job and I want to process files in a directory and load each of the files into the database. I can load one specifically, but I want to loop through all the files in the directory and load each one at a time. Any help would be greatly appreciated.
    Lisa

    I followed the instructions but when I try to create the java, I get the following error (removed the numbers in front of each line):
    and compile java source named "DirList"
    ERROR at line 2:
    ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 17.
    Was expecting:
    unknown command beginning "import jav..." - rest of line ignored.
    unknown command beginning "public cla..." - rest of line ignored.
    unknown command "{" - rest of line ignored.
    unknown command beginning "public sta..." - rest of line ignored.
    For a list of known commands enter HELP
    and to leave enter EXIT.
    unknown command beginning "throws SQL..." - rest of line ignored.
    unknown command "{" - rest of line ignored.
    unknown command beginning "File path ..." - rest of line ignored.
    unknown command beginning "String[] l..." - rest of line ignored.
    For a list of known commands enter HELP
    and to leave enter EXIT.
    unknown command beginning "String ele..." - rest of line ignored.
    unknown command beginning "for(int i ..." - rest of line ignored.
    unknown command "{" - rest of line ignored.
    unknown command beginning "element = ..." - rest of line ignored.
    For a list of known commands enter HELP
    and to leave enter EXIT.
    unknown command beginning "#sql { INS..." - rest of line ignored.
    unknown command beginning "VALUES (:e..." - rest of line ignored.
    unknown command "}" - rest of line ignored.
    unknown command "}" - rest of line ignored.
    For a list of known commands enter HELP
    and to leave enter EXIT.
    unknown command "}" - rest of line ignored.
    and compile java source named "DirList"
    ERROR at line 2:
    ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 17.
    Was expecting:
    I researched it on metalink with no luck. I'm running it on my local database (Oracle8i Release 8.1.7.0.0 - Production JServer Release 8.1.7.0.0 - Production) so this may be the problem.
    Help!
    Lisa

  • Loop through XML

    I am looking for an example of how to loop through an xml structure, preferrably in VBScript, but I will take a Javascript example and try to figure out how to adapt it.
    Is a FOR EACH loop possible? In normal VBScript you can do something like this...
    ‘strQuery = “/ProfilesInfo/Profiles/ProfileInfo/Profile/Fields/Field [Name='ProfileUri' or Name= 'Age'] /(Name|Value)”
    Set colNodes = xmlDoc.selectNodes( strQuery )
    If colNodes.length>0 Then
    For Each objNode in colNodes
    Print objNode.nodeName & “: ” & objNode.text
    Next
    is it possible to do something like this with XML? Maybe something like
    For each node in myDocument.XMLElements.Item(1)
         {do something}
    Next
    If there is a better way, and I am sure there is, I'll take an example of that instead. 
    I am sure there is probably a way to do it with XPath, but I haven't been able to find any examples of using XPath with VBScript. 
    If anyone has an example of how to use XPath with VBScript I would greatly appreciate it.
    Thank you

    Kasyan, thank you for the reply.  I looked at that part in the book and I have tried using the example code, but I am having difficulty in understanding how it is being used, maybe you, or someone can help to explain it. 
    So in an example like this:
    Class ProcessChildrenRule
         Public Property Get name
              name = "ProcessChildrenRule"
         End Property
         Public Property Get xpath
              xpath = "//XMLElement"
         End Property
         Public Function apply(myXMLElement, myRuleProcessor)
              glueCode_processChildren(myRuleProcessor)
              With myXMLElement
                   myXMLElement.XMLattributes.Item(1).Value
                   myStory.InsertionPoints.Item(-1).Contents =
                   .XMLAttributes.Item(1).Value & vbCr
              End With
         apply = false
         End Function
    End Class
    There are 5 things that I am not understanding. 
    1.  How is "xpath" being used?  I don't see another occurance of it other than when the variable xpath is set.
    2.  How is name being used?  I don't see another occurance of it other than when the variable name is set.
    3.  Why is "Public Function apply" created in each class?  In the examples in the book, that function exists in each Class.  Why not just create the function outside of the class and call it from inside the class?
    4. Where is the "apply" function being called from? It doesn't get called from inside or outside the class on the example pages anywhere?
    5. Where are the values of myXMLElement and myRuleProcessor being set before they are used in the function?
    Even in the examples you gave, once I set the xpath value, what do I do with it after that?  How do I write out the value of what I am searching for with the xpath?
    So going back to my original question, if I set xpath = "/devices/device", how do I loop through each "device" node and write them out?  That is where it is breaking down for me.  I haven't seen any examples in the book or in the downloaded example code that show how to do that. 

Maybe you are looking for