Jump to content

Recommended Posts

Hello requinix.

I am taking advantage of this thread to expose my problem:

It looks like the load function does NOT work properly and I CANNOT find the reason why:

$xml = new DOMDocument();
$xml->load("data/slides.xml");

 

In debugging, I can see the creation of a DOMDocument but the load function does not fill the $xml with the relative data even if it returns True:

<?xml version="1.0" encoding="UTF-8"?>
<album>
        <slide url="data/327.jpg" rel_URL="show_craft.php?id=327" title="Art. 327"></slide>
        <slide url="data/330.jpg" rel_URL="show_craft.php?id=330" title="Art. 330"></slide>
        <slide url="data/311.jpg" rel_URL="show_craft.php?id=311" title="Art. 311"></slide>
        <slide url="data/239.jpg" rel_URL="show_craft.php?id=239" title="Art. 239"></slide>
        <slide url="data/275.jpg" rel_URL="show_craft.php?id=275" title="Art. 275"></slide>
        <slide url="data/IMG_2691.jpg" rel_URL=" " title="Art. IMG_2691"></slide>
        <slide url="data/IMG_2684.jpg" rel_URL=" " title="Art. IMG_2684"></slide>
        <slide url="data/crafts 023.jpg" rel_URL=" " title="Art. crafts 023"></slide>
</album>

 

I use XAMPP 1.7.7.  In php.net, under DOMDocument::load page, there is a post  that says "Function will not work if using XML DOM PECL module".

In my phpinfo() there is only the "PECL Module version 2.0-dev $Id: sqlite.c 306939 2011-01-01 02:19:59Z felipe $ " under SQLite section enabled.

I tried many things like changing xml path, replacing the xml file with a simpler one from, for example, w3schools but with no avail.

I still get an empty document. I don't know where to bang my head since it looks like it's only me having this issue (search the web extensively).

Any help is greatly appreciated.

Thank you

Link to comment
https://forums.phpfreaks.com/topic/251614-dom-xml-parsing-help/
Share on other sites

Please don't tack your problem on to an existing thread that has already been solved.  Your post has been split off into its own thread.

 

Do you have any errors to show us?  you say that you can see things working, what else do you see?

 

As this is XML, you may want to look into the SimpleXML library instead of the DOM.

 

-Dan

I am sorry about that. It was my first post.

No errors whatsoever. The function simply does not fill the Dom Document with the xml file ($xml remains empty). And the funny thing is that it returns True (1).

The plan is to replace/modify/delete single nodes and the Dom Document is better than simplexml. But at this point I really want to know why it is doing this.

Is it a configuration problem like "syntaxiko 05-Apr-2009 06:16" suggested on php.net? Or what?

Thank you again.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.