[MOXy] how to write out schema location?

View: New views
3 Messages — Rating Filter:   Alert me  

[MOXy] how to write out schema location?

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

Reply to Author | View Threaded | Show Only this Message

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

Re: [MOXy] how to write out schema location?

by Blaise Doughan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
>  
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Re: [MOXy] how to write out schema location?

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

Reply to Author | View Threaded | Show Only this Message

Thanks!

--Polly

Blaise Doughan wrote:
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
>  
_______________________________________________
eclipselink-users mailing list
eclipselink-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/eclipselink-users