Reply to Re: DOM namespace prefix troubles

Your name:

Reply:


Posted by Rob on 11/02/05 21:21

Ace McKool wrote:

> What I'm trying to create is something like the following:
> <?xml version="1.0" encoding="UTF-8" ?>
> <Notes xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:
> CommonAggregateComponents-1.0">
> <cac:Note />
> </Notes>
> I am unable to create the "<cac:Note />" element with the "cac:" namespace
> prefix. Any suggestions would be appreciated!
>

$dom = new DOMDocument("1.0", "UTF-8");
$root = $dom->createElement('Notes');
$dom->appendChild($root);

$root->setAttributeNS("http://www.w3.org/2000/xmlns/", 'xmlns:cac',

'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0');

$child =
$dom->createElementNS('urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-1.0',

'cac:Note');

$root->appendChild($child);

Hope that helps.

Rob

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация