Hello all. I stumbled upon an issue while marshalling my object into xml, and wanted to see if anyone has experienced my problem. Basically what I'm trying to do is the following:
I need to define/declare more than one default namespace for a single mapping. This seems as though it would be a pretty common occurrence, however I have been unsuccessful. Here is a sample of the desired output:
<customer phone="888.555.1234"
xmlns="http://www.sosnoski.com/ns1"
xsi:schemaLocation="http://www.sosnoski.com/ns1_2">
Here is a snippet of the binding that I am using:
<binding>
<namespace uri="http://www.sosnoski.com/ns1_2" prefix="xsi" default="none"/>
<mapping name="customer" class="example9.Customer">
<namespace uri="http://www.sosnoski.com/ns1" default="elements"/>
<value style="attribute" ns="http://www.sosnoski.com/ns1_2" name="schemaLocation" get-method="getSchemaLocation"
set-method="setSchemaLocation" usage="optional"/>
<structure field="person"/>
. . .
</mapping>
</binding>
Here is the exception I receive:
UnmarshallException: exception while unmarshalling UnmarshallException: Error unmarshalling XML: Error parsing document (line 2, col 162)
XmlUnmarshaller.unmarshallXml(XmlUnmarshaller.java:80)
TestFxSimpleOption.testDisconfactors(TestFxSimpleOption.java:219)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
with the output xml:
<customer phone="888.555.1234"
xmlns="http://www.sosnoski.com/ns1"
xmlns:xsi:schemaLocation="http://www.sosnoski.com/ns1_2">
Any suggestions/input would be greatly appreciated!
Many thanks!
Simone
This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates.
