php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14739 xmltree
Submitted: 2001-12-28 12:26 UTC Modified: 2001-12-28 14:12 UTC
From: sebastien dot barbieri at itn dot skynet dot be Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.1.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sebastien dot barbieri at itn dot skynet dot be
New email:
PHP Version: OS:

 

 [2001-12-28 12:26 UTC] sebastien dot barbieri at itn dot skynet dot be
The xmltree function works very well (faster and shorter to write) but it seems that there is a problem when the DTD is in the header of the xml source.
I know it's an experimental function and I know that XML it's not fixed. I just wanted to notice you this little problem.

In my case when the DTD is send in the header, the xmltree function return false.

Well ... I will not use and abuse of this wonderful function right now.

This bug was not mentionned in the 4.1.0 -> 4.1.1 modification list. So it's probably still in.

Thanks anyway for reading this mail.

Regards.

P.S.: sorry for the English :)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-28 13:20 UTC] mfischer@php.net
Please provide a short, self-contained example for further references (you know, single php file with xml source in a variable and then you call xmltree).

Fedback.
 [2001-12-28 13:45 UTC] sebastien dot barbieri at itn dot skynet dot be
Here is a "short" exemple:
<pre>
$myXML = '<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE x_msgl[
  <!ELEMENT x_msgl (cdsdata|cdserr)>
    <!ATTLIST x_msgl
      p2 CDATA #REQUIRED
      p3 CDATA #REQUIRED
      p4 CDATA #REQUIRED
      p5 CDATA #REQUIRED
      p6 CDATA #REQUIRED
      p7 CDATA #REQUIRED>
    <!ELEMENT cdsdata (headers)>
      <!ELEMENT headers (header+)>
        <!ATTLIST headers
          count CDATA #REQUIRED>
        <!ELEMENT header (date,time,category,title, keywords)>
          <!ATTLIST header
            id CDATA #REQUIRED>
          <!ELEMENT date (#PCDATA)>
          <!ELEMENT time (#PCDATA)>
          <!ELEMENT category (dutch, french)>
            <!ATTLIST category
              id CDATA #REQUIRED>
            <!ELEMENT dutch (#PCDATA)>
            <!ELEMENT french (#PCDATA)>
          <!ELEMENT title (#PCDATA)>
          <!ELEMENT keywords (keyword*)>
            <!ATTLIST keywords
              count CDATA #REQUIRED>
            <!ELEMENT keyword (#PCDATA)>
              <!ATTLIST keyword
                id CDATA #REQUIRED>
    <!ELEMENT cdserr (#PCDATA)>
]>
<x_msgl p2="nl" p3="7" p4="53" p5="0" p6="0" p7="1" >
  <cdsdata>
     <headers count="1">
        <header id="26466">
          <date>20011228</date>
          <time>1903</time>
          <category id="7">
            <dutch>Economie</dutch>
            <french>Economie</french>
          </category>
          <title>VGAirlines vliegt vanaf maart dagelijks naar New York</title>
          <keywords count="8">
            <keyword id="5">BELGABRIEF</keyword>
            <keyword id="53">ECONOMIE</keyword>
            <keyword id="51">BELGIE</keyword>
            <keyword id="44">BEDRIJVEN</keyword>
            <keyword id="78">LUCHTVAART</keyword>
            <keyword id="1255">TRANSPORT</keyword>
            <keyword id="835">AGENDA</keyword>
            <keyword id="7">VS</keyword>
          </keywords>
        </header>
      </headers>
  </cdsdata>
</x_msgl>';

$docTree = xmltree($myXML); 
print("< pre>"); 
var_dump($docTree);
print( "</ pre>" ); 
</pre>
 [2001-12-28 14:12 UTC] mfischer@php.net
I even get a segfault with your sample under 4.1.0 but this is fixed in 4.1.1

Except that ATTLIST is not supported the xmltree() works for me (i.e. I don't get false back with 4.1.1).

I'm closing it as there's already a feature request open for ATTLIST.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 15:01:30 2025 UTC