Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2005
    Posts
    15

    XML Get Attribute

    Hi. Currently I am evaluating True Update for a project my company is working on. I have been impressed by its easy to use interface and strong features.

    However, I am having trouble understanding how the XML.GetAttribute action works. I have an XML file that I need to read from. It's format is very similar to the one below. How would I extract the "Value" of the "ServerLocation" attribute?

    serverPath = XML.GetAttribute("ItemSearchResponse/OperationRequest/Arguments/Argument Name", "Value");??

    <?xml version="1.0" encoding="UTF-8" ?>
    <ItemSearchResponse>
    <OperationRequest>
    <Arguments>
    <Argument Name="Service" Value="AWSECommerceService" />
    <Argument Name="ItemPage" Value="11" />
    <Argument Name="ServerLocation" Value="\\server\share" />
    </Arguments>
    </OperationRequest>
    </ItemSearchResponse>
    THANKS

  2. #2
    Join Date
    Aug 2005
    Posts
    15

    Thumbs down Figured it out

    I answered my own question
    The code is:
    serverPath = XML.GetAttribute("ItemSearchResponse/OperationRequest/Arguments/Argument Name:3", "Value");

  3. #3
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Excellent! Thanks for posting your answer so others can benefit from it.

  4. #4
    Join Date
    Feb 2001
    Location
    Indigo Rose Software
    Posts
    2,728
    Quote Originally Posted by NickT
    I answered my own question
    The code is:
    serverPath = XML.GetAttribute("ItemSearchResponse/OperationRequest/Arguments/Argument Name:3", "Value");
    Careful...I think you should actually be using:
    Code:
    serverPath = XML.GetAttribute("ItemSearchResponse/OperationRequest/Arguments/Argument:3", "Value");
    ...since Name is an attribute, and the name of the element is "Argument" and not "Argument Name."
    --[[ Indigo Rose Software Developer ]]

  5. #5
    Join Date
    Aug 2005
    Posts
    15
    Hey - thanks for the reply!

    Quote Originally Posted by Lorne
    Careful...I think you should actually be using:
    Code:
    serverPath = XML.GetAttribute("ItemSearchResponse/OperationRequest/Arguments/Argument:3", "Value");
    ...since Name is an attribute, and the name of the element is "Argument" and not "Argument Name."
    Your code does make more sense than mine. Oddly, when I retested both statements, they both produced the same result. However, I will change my code to the statement you suggested.
    Thanks!

Similar Threads

  1. XML format
    By TJ_Tigger in forum AutoPlay Media Studio 5.0
    Replies: 6
    Last Post: 10-04-2005, 12:47 PM
  2. Need help. How to add element to XML???
    By dmla in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 11-10-2004, 02:05 AM
  3. XML plugin Project example - XML Weather from weather.com
    By kpsmith in forum AutoPlay Media Studio 5.0
    Replies: 8
    Last Post: 06-03-2004, 05:25 PM
  4. Spotlight: XML Actions Plugin
    By Desmond in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 03-15-2004, 03:56 PM
  5. Using XML Or INI files during install
    By djpyne in forum Setup Factory 6.0
    Replies: 0
    Last Post: 10-15-2003, 10:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts