PHP5 DOM Problem
| From: | Craig Whitmore | Date: | Fri, 05 Dec 2008 23:22:25 +0000 |
| Subject: | PHP5 DOM Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-284214@lists.php.net to get a copy of this message | ||
Hi there. I don't kno id this is the correct place to post but...
I am using the PHP5 DOM to make up RSS Feeds ..
A Problem I have is I want to make this up for itunes..
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.00" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
....
etc..
I use..
$p_dom = new DOMDocument('1.0','UTF-8');
$p_rss = $p_dom->createElement('rss');
$p_rss->setAttribute('version', '2.00');
$p_rss->setAttribute('xmlns:itunes','http://www.itunes.com/dtds/podcast-1.0.dtd');
$p_dom->appendChild($p_rss);
which is working for me.. Debian (PHP 5.2.6-2+b1)
but doesn't work on some other people with other versions of php5 ( I don't know yet
which version they have)
they only get
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.00">
So the name space is missing..
So I looked up http://nz2.php.net/manual/en/domelement.setattribute.php
and it says the "correct" way is to use createElementNS.. but I have tried and tried and I
cannot get it to make up what I want it to do.
can someone help?
I also want to make something like
<?xml version="1.0" encoding="UTF-8"?>
<rss version="0.91" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:gm="http://www.google.com/schemas/gm/1.1"
xmlns:av="http://www.searchvideo.com/schemas/av/1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/">
for mediarss feeds + other types . but I can't seem to be able to use CreateElementNS to make
this up either
Can someone help??