On Wed, Jan 24, 2018 at 6:48 AM, Johann Schausberger <
[email protected]> wrote:

> Hello,
>
> i am using jackson-dataformat-xml 2.9.3 with woodstox.
>
> My goal i to write namespace prefixes, like this:
>
> <parent xmlns:dc="http://some-url";>
>   <dc:child>value</dc:child>
> <parent>
>
>
> So the key part is to have a namespace like: xmlns*:dc *and to use it on
> child tags/attributes: <*dc:*child>
>
> Is this possible with jackson?
> If not, can this be acheived with overriding some woodstox functionality?
>


Adding namespace is easy enough: use `@JacksonXmlProperty` annotation,
specifically with `namespace` property set to URI.

There is no way to directly suggest prefix to use; one generated
automatically will be used ("wstxns1" etc I think by default).
Since prefixes have no semantics, this should not matter for processors;
processing only considers namespace URIs, not prefixes.

If you care deeply about mappings, yes, Woodstox does have means to suggest
bindings to use: either for basename ("wstxns"),
or, for suggesting specific prefix for namespace URI. For latter I don't
remember if this is via factory or does it require actual
XMLStreamWriter.

-+ Tatu +-



>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to