You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by dara <da...@risaris.com> on 2005/12/14 16:56:26 UTC

Importing node tree with another namespace

Hi all,

I have a question re namespaces and manipulation of them in a DOM with 
Xerces.

I have a document that i'm trying to allow updates to segments of.

The complete document is in namespace A, and the update documents - 
which essentially will contain only segments of a document from 
namespace A - are in namespace B.
(since they have differeing constraints on what is required/allowed, 
they have each their own XSD and thus I gave them each their own namespace).

After receiving and paarsing (with validation on) an update document, I 
wish to import it into a full document.

The trouble I am having is, how do I get this update from namespace B to 
be in namespace A at this point ?

If I just import it, the node imported retains it's namespace.

Is there a way in to set the namespace Uri for a tree in the DOM, or for 
each node individually using a DOM iterator ?

I'd be interested to hear if anybody is doing anything like this and 
what solutions they are using if so.

Thanks in advance, and apologies if I've missed something obvious 
here....still looking...


Best Regards

Dara





Re: Importing node tree with another namespace

Posted by dara <da...@risaris.com>.
Thanks a Bunch Alberto,

Regards

Dara

Alberto Massari wrote:

> Hi Dara,
> namespace is a part of the node, and when you import or clone, it is 
> replicated in the new copy. If you want to change the namespace of an 
> element you need to invoke DOMDocument::renameNode(elem, newURI, 
> elem->getLocalName()) on each element.
>
> Alberto
>
> At 15.56 14/12/2005 +0000, dara wrote:
>
>> Hi all,
>>
>> I have a question re namespaces and manipulation of them in a DOM 
>> with Xerces.
>>
>> I have a document that i'm trying to allow updates to segments of.
>>
>> The complete document is in namespace A, and the update documents - 
>> which essentially will contain only segments of a document from 
>> namespace A - are in namespace B.
>> (since they have differeing constraints on what is required/allowed, 
>> they have each their own XSD and thus I gave them each their own 
>> namespace).
>>
>> After receiving and paarsing (with validation on) an update document, 
>> I wish to import it into a full document.
>>
>> The trouble I am having is, how do I get this update from namespace B 
>> to be in namespace A at this point ?
>>
>> If I just import it, the node imported retains it's namespace.
>>
>> Is there a way in to set the namespace Uri for a tree in the DOM, or 
>> for each node individually using a DOM iterator ?
>>
>> I'd be interested to hear if anybody is doing anything like this and 
>> what solutions they are using if so.
>>
>> Thanks in advance, and apologies if I've missed something obvious 
>> here....still looking...
>>
>>
>> Best Regards
>>
>> Dara
>>
>>
>>
>
>
>
>


-- 
Regards,

Dara Mulvihill,

Rísarís Ltd,

http://www.risaris.com

++353 404 64009





Re: Importing node tree with another namespace

Posted by Alberto Massari <am...@datadirect.com>.
Hi Dara,
namespace is a part of the node, and when you import or clone, it is 
replicated in the new copy. If you want to change the namespace of an 
element you need to invoke DOMDocument::renameNode(elem, newURI, 
elem->getLocalName()) on each element.

Alberto

At 15.56 14/12/2005 +0000, dara wrote:
>Hi all,
>
>I have a question re namespaces and manipulation of them in a DOM with Xerces.
>
>I have a document that i'm trying to allow updates to segments of.
>
>The complete document is in namespace A, and the update documents - 
>which essentially will contain only segments of a document from 
>namespace A - are in namespace B.
>(since they have differeing constraints on what is required/allowed, 
>they have each their own XSD and thus I gave them each their own namespace).
>
>After receiving and paarsing (with validation on) an update 
>document, I wish to import it into a full document.
>
>The trouble I am having is, how do I get this update from namespace 
>B to be in namespace A at this point ?
>
>If I just import it, the node imported retains it's namespace.
>
>Is there a way in to set the namespace Uri for a tree in the DOM, or 
>for each node individually using a DOM iterator ?
>
>I'd be interested to hear if anybody is doing anything like this and 
>what solutions they are using if so.
>
>Thanks in advance, and apologies if I've missed something obvious 
>here....still looking...
>
>
>Best Regards
>
>Dara
>
>
>