Xerces XmlSerializer + namespaces?

M

Mark

Sorry if this has been answered before - I searched but could not find
the answer.

If I serialize an element from within a document is there a way to
force the output of the namespaces that are in scope on that element?

E.g. suppose I have:

<doc xmlns:fred="uri:fred">
<element attr="fred:something"/>
</doc>

And I serialize <element> is there a way I can force the output of the
xmlns:fred declaration too?

If you wonder where this question is coming from I'm actually working
on using Castor to analyse the schema definitions from within a WSDL
types definition!

Many thanks in advance for any intelligent answers!
 
P

Philippe Poulard

Mark said:
Sorry if this has been answered before - I searched but could not find
the answer.

If I serialize an element from within a document is there a way to
force the output of the namespaces that are in scope on that element?

E.g. suppose I have:

<doc xmlns:fred="uri:fred">
<element attr="fred:something"/>
</doc>

And I serialize <element> is there a way I can force the output of the
xmlns:fred declaration too?

If you wonder where this question is coming from I'm actually working
on using Castor to analyse the schema definitions from within a WSDL
types definition!

Many thanks in advance for any intelligent answers!

hi,

did you check if your serializer didn't have an option such as "force
output for unused xmlns declaration" ?
if your serializer doesn't have this feature, maybe you should change
for another one (however, it seems that such a feature is somewhat
unusual, i don't know if an existing serializer support it, sorry)

here is also a dirty hack :
<doc xmlns:fred="uri:fred" fred:xmlns="">
<element attr="fred:something"/>
</doc>
using xmlns as a local name could have a special meaning "don't
serialize this attribute" (but as it is present, serialize the xmlns
declaration that declares the prefix) ; what people are thinking about
that ?
--
Cordialement,

///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top