dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: Get value of certain attributes from XML response

  1. #1
    Join Date
    Jul 2017
    Posts
    2

    Get value of certain attributes from XML response

    Hi guys,
    I hope everybody is well!
    I have an issue which I'm not able to solve. I'm pretty much a beginner but I tried a lot to somehow find a solution.
    I have an XML response like this:
    HTML Code:
    <?xml version='1.0' ?>
    <result called_on="2017-07-04 07:01:55.745058+00">
      <entities count="4" start="0">
        <entity name="Demographics" idone="28" type="segment" version="1">
          <prop name="audience_vendor_idone" value="6" />
          <prop name="parent_segment_idone" value="21372" />
          <prop name="name" value="Demographics" />
          <prop name="buyable" value="0" />
          <prop name="created_on" value="2012-07-12T19:06:28" />
          <prop name="updated_on" value="2017-06-28T01:53:40" />
          <prop name="type" value="normal" />
          <prop name="full_path" value="Demo" />
          <prop name="child_count" value="289" />
        </entity>
        <entity name="Financials" idone="295" type="segment" version="1">
          <prop name="audience_vendor_idone" value="6" />
          <prop name="parent_segment_idone" value="21372" />
          <prop name="name" value="Financials" />
          <prop name="buyable" value="0" />
          <prop name="created_on" value="2012-07-12T19:06:28" />
          <prop name="updated_on" value="2017-06-28T01:53:40" />
          <prop name="type" value="normal" />
          <prop name="full_path" value="Finan" />
          <prop name="child_count" value="287" />
        </entity>
        <entity name="Lifestyles &amp; Interests" idone="296" type="segment" version="1">
          <prop name="audience_vendor_idone" value="6" />
          <prop name="parent_segment_idone" value="272" />
          <prop name="name" value="Lifestyles &amp; Interests" />
          <prop name="buyable" value="0" />
          <prop name="created_on" value="2012-07-12T19:06:28" />
          <prop name="updated_on" value="2017-06-28T01:53:40" />
          <prop name="type" value="normal" />
          <prop name="full_path" value="Terest" />
          <prop name="child_count" value="408" />
        </entity>
        <entity name="Travel" idone="14060" type="segment" version="0">
          <prop name="audience_vendor_idone" value="6" />
          <prop name="parent_segment_idone" value="272" />
          <prop name="name" value="Travel" />
          <prop name="buyable" value="0" />
          <prop name="created_on" value="2015-06-23T14:37:20" />
          <prop name="updated_on" value="2017-06-28T01:53:40" />
          <prop name="type" value="normal" />
          <prop name="full_path" value="Travel" />
          <prop name="child_count" value="138" />
        </entity>
      </entities>
      <status code="ok" />
    </result>
    What I want to do know is to get the value of the attribute "value" where the other attribute value is "full_path". And the I want to just output it.
    In my example I would like to output:

    Demo
    Finan
    Terest
    Travel

    How can I do that with Javascript? Thanks a lot for your help guys!

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    4,722
    Shouldn't your question be here : http://www.webdeveloper.com/forum/fo...play.php?5-XML
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

  3. #3
    Join Date
    Oct 2013
    Location
    Sheboygan, Wisconsin
    Posts
    1,381
    Moved.

  4. #4
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,816
    Hi there Kikone,

    and a warm welcome to these forums.

    Check out the attachment which contains a working example.

    Note, though, that it will only work locally with "Firefox".

    For other browsers, such as "IE" or "Chrome" it will only work
    on a server such as "XAMPP" or your host server.

    coothead
    Attached Files Attached Files
    ~ the original bald headed old fart ~

  5. #5
    Join Date
    Jul 2017
    Posts
    2
    Hi Coothead,

    thanks a lot for your help and the warm welcome!
    Really helpful and I really appreciate it!

    Kikone

  6. #6
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,816

    No problem, you're very welcome.

    coothead
    ~ the original bald headed old fart ~

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles