« Return to Thread: How to marshall objects using default namespace?

Re: How to marshall objects using default namespace?

by polly.c.chang :: Rate this Message:

Reply to Author | View in Thread

Hi Matt,

Ah, ok.  Thanks for the XML snippets.  I'll give it a try!  :)

Thanks,
Polly


Matt MacIvor wrote:
Hi Polly,

The support for the default namespace has been added into the runtime,
but hasn't been implemented in the Mapping Workbench yet. Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=236491 
to track the support in the workbench.

In order to make use of this before the mapping workbench feature is
completed, you would have to either manually modify your mappings xml
file, or modify your mappings in code during an afterloads.

In the mapping .xml file, you'd want to add your default namespace to
any namespace resolvers in the document:
<namespace-resolver>
  <namespaces>
    ...
  </namespaces>
  <default-namespace-uri> http://www.foo.com/bar/baz </default-namespace-uri>
</namespace-resolver>

Then you'd want to modify the xpath of any mapping or default-root-element that was currently prefix-qualified, to remove the prefix:

<default-root-element>ns1:Description</default-root-element>

becomes:

<default-root-element>Description</default-root-element>


<attribute-mapping xsi:type="xml-direct-mapping">
  ...
  <field name="ns1:CityName/text()" xsi:type="node"/>
</attribute-mapping>

becomes:

<attribute-mapping xsi:type="xml-direct-mapping">
  ...
  <field name="CityName/text()" xsi:type="node"/>
</attribute-mapping>

Hope that helps,

-Matt

 « Return to Thread: How to marshall objects using default namespace?