You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by Sewwandi Perera <sp...@outlook.com> on 2014/08/19 18:23:23 UTC
FW: How to remove namespace prefix from an OMelement attribute
Hi,
My requirement is to remove namespace prefix of an attribute when the namespace prefixes of both the attribute and the belonging OMElement are same.
Example:
Input: <ns1:Location ns1:type="attribute">
Output: <ns1:Location type="attribute">
I used "namespace repairing" property in XMLStreamWriter as given in links [1], [2] to get this done but it didn't work for me.
please let me know what is the recommended way to achieve this.
[1] http://www.javadocexamples.com/javax/xml/stream/javax.xml.stream.XMLOutputFactory.html[2] http://ws.apache.org/axiom/devguide/ch05.html#d5e623
Thanks and Regards,Sewwandi
Re: FW: How to remove namespace prefix from an OMelement attribute
Posted by Andreas Veithen <an...@gmail.com>.
On Tue, Aug 19, 2014 at 5:23 PM, Sewwandi Perera <sp...@outlook.com> wrote:
> My requirement is to remove namespace prefix of an attribute when the
> namespace prefixes of both the attribute and the belonging OMElement are
> same.
That requirement doesn't make sense. Can you please explain why you
would want to do this?
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
Re: FW: How to remove namespace prefix from an OMelement attribute
Posted by Michael Pigott <mp...@gmail.com>.
Sewwandi,
I suspect that you cannot get it to work because attributes without a
prefix are not in the default namespace: they have no namespace. [1]
So the document in the new format would not validate against the original
schema.
You might have to fiddle with your own implementation of
NamespaceContext to get what you want.
[1] http://docstore.mik.ua/orelly/xml/schema/ch10_03.htm
Good luck!
Mike
On Aug 19, 2014 12:23 PM, "Sewwandi Perera" <sp...@outlook.com> wrote:
> Hi,
>
> My requirement is to remove namespace prefix of an attribute when the
> namespace prefixes of both the attribute and the belonging OMElement are
> same.
>
> Example:
>
> Input: <ns1:Location ns1:type="attribute">
>
> Output: <ns1:Location type="attribute">
>
> I used "namespace repairing" property in XMLStreamWriter as given in links
> [1], [2] to get this done but it didn't work for me.
>
> please let me know what is the recommended way to achieve this.
>
>
> [1]
> http://www.javadocexamples.com/javax/xml/stream/javax.xml.stream.XMLOutputFactory.html
> [2] http://ws.apache.org/axiom/devguide/ch05.html#d5e623
>
> Thanks and Regards,
> Sewwandi
>