Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6609835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:45:53+00:00 2026-05-25T19:45:53+00:00

Here is my XML fragment: <?xml version=1.0 encoding=UTF-8?> <ns:searchResult xmlns:ns=http://outerx.org/daisy/1.0> … <ns:rows> <ns:row documentId=1440-DFO_MPO

  • 0

Here is my XML fragment:

<?xml version="1.0" encoding="UTF-8"?>
<ns:searchResult xmlns:ns="http://outerx.org/daisy/1.0">
...
    <ns:rows>
        <ns:row documentId="1440-DFO_MPO" branchId="1" languageId="2"
            access="read,fullRead,write,publish">
            <ns:value>1440-DFO_MPO</ns:value>
            <ns:value>Navigation for Multimedia</ns:value>
        </ns:row>
    </ns:rows>
...

Here is my current PHP Code:

$dom = new DOMDocument();
$dom->load($xml);
$docs = $dom->getElementsByTagNameNS('http://outerx.org/daisy/1.0','row');

print "<ul>";
$c = 0;    
foreach ($docs as $elem) {
    print "<li>".$c."</li>";
    $c = $c + 1;
}    
print "</ul>";

AFAIK, this snippet should output a list of one item based on the XML fragment. However, it doesn’t.

I’ve also tried (without success):

$docs = $dom->getElementsByTagName('row');

Edit #1 – Solution

Changed $dom->load($xml) to $dom->loadXML($xml);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:45:54+00:00Added an answer on May 25, 2026 at 7:45 pm

    Your code works for me. I assume you are passing the XML content in $xml when load() expects it to be a filename or URI. To load XML content directly you have to use

    • DOMDocument::loadXML — Load XML from a string

    See http://codepad.org/oy3U1fmE

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the XML: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <feed xmlns=http://www.w3.org/2005/Atom xmlns:dc=http://purl.org/dc/elements/1.1/> <title>Rated Images</title> <link
Here is my XML Response: <DIDL-Lite xmlns=urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/ xmlns:dc=http://purl.org/dc/elements/1.1/ xmlns:upnp=urn:schemas-upnp-org:metadata-1-0/upnp/ <item id=1182 parentID=40 restricted=1> <title>Hot
With glassfish, my persistence.xml is not loaded. my.ear META-INF/persistence.xml lib/entities.jar <!-- no persistence.xml here
Here is my XML: <section> <para>part1 <breakline/> part2 <list> <para>list1 </para> <para>list2 </para> </list>
here is my xml DOM. <entities> <entity id=7006276> <title>xxx</title> <entities> <entity id=7877579> <title>xxx</title> <entities>
Here is my XML: [link]=> array(2) { [0]=> object(SimpleXMLElement)#244 (1) { [@attributes]=> array(3) {
here is the XML file : <com.google.android.maps.MapView android:layout_width=fill_parent android:layout_height=fill_parent android:apiKey=0q7NUYm4bgzeXlqXtKYVPJDRWUJmt8Cu0gvbWMx android:id=@+id/map_view /> and Manifest
here is the xml data : <root> <recommendedMaterials> <value label=Aluminium data=0 /> <value label=Iron
I am new to xml and android programming.Here is my xml code... I don't
I'm trying to learn some XML Parsing here and I've been given some code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.