[PHP] SimpleXML error

2007-11-26 Thread Skip Evans

Hey all,

I have some XML files I need to parse and then 
display (they have HTML formatting in them as well).


They contain the following:

?xml version=1.0 ?
!DOCTYPE html PUBLIC -//Gale//DTD Gale eBook 
Document DTD 20031113//EN galeeBkdoc.dtd

html gale:versionNumber=OEB 1.2, Gale 1.3
head
gale:docName gale:zzNumber=2536600565/
gale:documentCitation
gale:pageRange214-215/gale:pageRange
/gale:documentCitation
titleThomas Jefferson and the Revision of the 
Virginia Laws/title

/head

I am then attempting to extract the title with this:

$xml = 
simplexml_load_file(BASE_DIR.'/content/'.$r['filename']);

$title= $xml-title;

But in the browser I get the following warning.

namespace error : Namespace prefix gale for 
versionNumber on html is not defined...


Is this because it is not locating the file 
galeeBkdoc.dtd, which defines all the elements in 
the XML files?


It is located in the same directory as the 
content. I have also tried putting the complete 
path via HTTP in with the name of the DTD file 
with no luck.



Suggestions would be greatly appreciated.

Thanks!
Skip

--
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX  DHTML development framework.
http://phpenguin.bigskypenguin.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SimpleXML error

2007-11-26 Thread Casey

I'm not sure, but try casting $xml-title to string, like this:

$title = (string) $xml-title;


On Nov 26, 2007, at 1:44 PM, Skip Evans [EMAIL PROTECTED] wrote:


Hey all,

I have some XML files I need to parse and then display (they have  
HTML formatting in them as well).


They contain the following:

?xml version=1.0 ?
!DOCTYPE html PUBLIC -//Gale//DTD Gale eBook Document DTD  
20031113//EN galeeBkdoc.dtd

html gale:versionNumber=OEB 1.2, Gale 1.3
head
gale:docName gale:zzNumber=2536600565/
gale:documentCitation
gale:pageRange214-215/gale:pageRange
/gale:documentCitation
titleThomas Jefferson and the Revision of the Virginia Laws/title
/head

I am then attempting to extract the title with this:

$xml = simplexml_load_file(BASE_DIR.'/content/'.$r['filename']);
$title= $xml-title;

But in the browser I get the following warning.

namespace error : Namespace prefix gale for versionNumber on html is  
not defined...


Is this because it is not locating the file galeeBkdoc.dtd, which  
defines all the elements in the XML files?


It is located in the same directory as the content. I have also  
tried putting the complete path via HTTP in with the name of the DTD  
file with no luck.



Suggestions would be greatly appreciated.

Thanks!
Skip

--
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX  DHTML development framework.
http://phpenguin.bigskypenguin.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php