Do you have a snippet of the code that constructs the elements? I believe
you just need to create the namespace attribute declaration correctly. In
your example you have 'xmlns:ced="namespace"', but what you want is
'xmlns="namespace"', but that could just be a typo.


-----Original Message-----
From: Stéphane Rault [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 21, 2005 8:44 AM
To: [EMAIL PROTECTED]
Subject: Serialisation with no default namespace prefix

Hello all. 

I want to serialize some Xml Documents with namespace inside but with a
defaultNamespace and no prefix for this namespace. How can I do it ?

// Piece of code
            OutputFormat format = new OutputFormat("xml", "ISO-8859-1",
true);

            XMLSerializer serialiseur = new XMLSerializer(format);

            StringWriter sw = new StringWriter();
            serialiseur.setOutputCharStream(sw);
            serialiseur.asDOMSerializer();
            serialiseur.setNamespaces(true);

            serialiseur.serialize(anElement);
// End Piece of code

If I use it I have an output like that : 

// What I don't want
<?xml version="1.0" encoding="ISO-8859-1"?>
<ced:traceReceipt xmlns:ced="MyNamespace">
    <ced:taskName>MyContent</ced:taskName>
</ced:traceReceipt>
// End What I don't want

I want to obtain instead : 

// What I want
<?xml version="1.0" encoding="ISO-8859-1"?>
<traceReceipt xmlns:ced="MyNamespace">
    <taskName>MyContent</taskName>
</traceReceipt>
// End What I want

Thanks in advance




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to