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]
|