On Mon, Jul 25, 2022 at 5:43 PM Norbert Kiesel <[email protected]> wrote:
>
> What you described seems to be for serializing to XML. However, my issue is
> to deserialize/parse existing XML with configured and applied NS for all
> tags. I did not see a corresponding "setDefaultNamespace" for parsing.
Oh! My bad then.
No, there is no such functionality and it would seem to me to be
against XML specification: namespace binding information must be
contained within the incoming XML document/content. The default
namespace is by default unbound (namespace URI of "") but can be bound
to non-empty namespace URI. But it is a fundamental property of the
document and not externally configurable.
I suspect I still misunderstand what you are asking?
-+ Tatu +-
>
> On Monday, July 25, 2022 at 2:23:51 PM UTC-7 Tatu Saloranta wrote:
>>
>> Underlying `XMLStreamWriter` does offer a way to bind the default
>> namespace, at least in "repairing mode"; if so, calling:
>>
>> sw.setDefaultNamespace(defaultNsURI);
>>
>> should bind the default namespace and result in namespace declaration
>> also being written.
>>
>> But if so, you will need to manually construct the generator through
>> XmlFactory or XmlMapper, passing pre-constructed
>> XMLStreamWriter.
>> For XmlMapper that'd be method:
>>
>> public void writeValue(XMLStreamWriter w, Object value) throws
>> IOException { }
>>
>> I think there is may be an issue requesting Jackson functionality to
>> make this easier as well so support may be
>> added in future.
>>
>> -+ Tatu +-
>>
>> On Mon, Jul 25, 2022 at 11:07 AM Norbert Kiesel <[email protected]> wrote:
>> >
>> > Is it possible to configure a default namespace for the parser? Right now
>> > I add a @JacksonXmlProperty(namespace=“myns”) to every field.
>> >
>> > --
>> > 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 view this discussion on the web visit
>> > https://groups.google.com/d/msgid/jackson-user/6f4bce52-a30d-4692-bf7c-1b10f468a5c8n%40googlegroups.com.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/jackson-user/edf16e04-35cc-43a1-9016-2f26607180aen%40googlegroups.com.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/jackson-user/CAL4a10g1sSaAweMtBcstVm-_CqYUb8Qy%3D61-vt9WgkLZQk2BVw%40mail.gmail.com.