Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] [MOXy] how to write out schema location?

Hi Polly,

The schemaLocation and noNamespaceSchemaLocation are set on the XMLMarshaller:

xmlMarshaller.setSchemaLocation("http://www.foo.com/bar/baz c:\stuff\blah.xsd");

-Blaise


amphoras wrote:
Hi,

I have just noticed that my marshalled XML document does not contain the
xsi:schemaLocation attribute in the root element.  What do I need to specify
to get this to show up?  I already have this in my class mapping for the
root element:

         <namespace-resolver>
            <namespaces/>
<default-namespace-uri>http://www.foo.com/bar/baz</default-namespace-uri>
         </namespace-resolver>

         <schema xsi:type="schema-file-reference">
            <resource>..\..\..\..\..\blah.xsd</resource>
            <schema-context>/FooType</schema-context>
            <node-type>complex-type</node-type>
         </schema>

I expected the schemaLocation to be generated to be something like this:

xsi:schemaLocation='http://www.foo.com/bar/baz c:\stuff\blah.xsd'

Note that I noticed this for a basic one root-element to one Java class
mapping, though I wouldn't be surprised if I hosed something in my
experiments with multiple root-elements.

Any help would be greatly appreciated.

Thanks,
Polly


Back to the top