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 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
I'm calling the Bing Maps Service to return some XML here: http://dev.virtualearth.net/REST/v1/Locations/Encoded_Address?o=xml&key=Maps_Key For the
Here's the XML file i'm working on: <list> <activity>swimming</activity> <activity>running</activity> <activity>soccer</activity> </list> The index.php,
Here's the XML code I'm working with: <inventory> <drink> <lemonade supplier=mother id=1> <price>$2.50</price> <amount>20</amount>
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) {
Consider this simple XML document. The serialized XML shown here is the result of
Here is my sample code: from xml.dom.minidom import * def make_xml(): doc = Document()
Here is part of my web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:application-config.xml </param-value> </context-param> application-config.xml uses
Here is my first attempt at validating XML with XSD. The XML file to

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.