Re: Simple XML, (x)html, and xpath
| From: | marco@behnke.biz | Date: | Fri, 25 May 2012 08:27:49 +0000 |
| Subject: | Re: Simple XML, (x)html, and xpath | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317996@lists.php.net to get a copy of this message | ||
Gary <listgj-phpgeneral@yahoo.co.uk> hat am 25. Mai 2012 um 09:57
geschrieben:
> If I use simplexml_load_string to create an XML object with the
> following XHTML
> ,----
> | <?xml version="1.0"?>
> | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> | "http://www.w3.org/TR/
> | xhtml1/DTD/xhtml1-strict.dtd">
> | <html xmlns="http://www.w3.org/1999/xhtml">
> | <head><meta http-equiv="Content-Type" content="text/html;
charset=UTF-8"
> | />
> | <title>test title</title>
> | </head>
> | <body>
> | <!-- comment -->
> | </body>
> | </html>
> `----
>
> I get this SimpleXMLElement back
> ,----
> | object(SimpleXMLElement)#1 (2) {
> | ["head"]=>
> | object(SimpleXMLElement)#2 (1) {
> | ["title"]=>
> | string(10) "test title"
> | }
> | ["body"]=>
> | object(SimpleXMLElement)#3 (1) {
> | ["comment"]=>
> | object(SimpleXMLElement)#4 (0) {
> | }
> | }
> | }
> `----
>
> but I cannot seem to get anything out of an xpath expression, no matter
> what I try.
>
> If, however, I remove the
> 'xmlns="http://www.w3.org/1999/xhtml"' in the
> html element, it works fine. So yeah, I can just remove that text,
> but... is there something wrong here, in my expectation or in the xpath
> function?
Maybe you can show us your xpath expression?
>
> TIA.
>
> --
> Gary Please do NOT send me 'courtesy' replies off-list.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: marco@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz