Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-28-2008, 09:31 PM Php Dom Xml->xmlns
Moldarin's Avatar
Extreme Talker

Latest Blog Post:
Keyword Density and Title Tags
Posts: 201
Trades: 0
Hi, ☺

How do I use PHP DOM XML to output all XMLNS declared troughout the DOM to the root element? See below code, and the actual output and the desired output.

PHP Code:
<?php
    $XML 
= new DOMDocument("1.0""UTF-8");
    
$Atom $XML->appendChild($XML->createElementNS("http://www.w3.org/2005/Atom""feed"));
    
$Atom->appendChild($XML->createElementNS("http://www.w3.org/1999/xhtml""xht:strong""fet tekst"));
    
$Atom->appendChild($XML->createElementNS("http://www.w3.org/1999/xhtml""xht:strong""fet tekst2"));
    
$XML->formatOutput true;
    
printf($XML->saveXML()); ?>
Quote:
Originally Posted by Output
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<xht:strong xmlns:xht="http://www.w3.org/1999/xhtml">fet tekst</xht:strong>
<xht:strong xmlns:xht="http://www.w3.org/1999/xhtml">fet tekst2</xht:strong>
</feed>
Quote:
Originally Posted by Desired output
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:xht="http://www.w3.org/1999/xhtml">
<xht:strong>fet tekst</xht:strong>
<xht:strong>fet tekst2</xht:strong>
</feed>
__________________
I do not share ad revenue.
Moldarin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Php Dom Xml->xmlns
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45233 seconds with 12 queries