users@jaxb.java.net

Re: Parsing xml files that have a Microsoft schema

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Sun, 22 Nov 2009 21:49:53 +0100

xjc is for the W3C XML Schema language only.

Workarounds?
One solution would be to find or write an equivalent W3C XML schema.
Or code the Java classes according to the MS schema by hand (and
annotate where necessary).

-W


On Tue, Nov 17, 2009 at 5:04 PM, Timothy Astle <tastle_at_hotmail.com> wrote:
>
> When I run xjc on the test.xsd below, I get the following errors:
>
>
> [ERROR] s4s-elt-schema-ns: The namespace of element 'Schema' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
> line 2 of file:/D:/Temp/jaxb-ri-20061211/bin/test/test.xsd
>
> [ERROR] s4s-elt-invalid: Element 'Schema' is not a valid element in a schema document.
> line 2 of file:/D:/Temp/jaxb-ri-20061211/bin/test/test.xsd
>
> [ERROR] schema_reference.4: Failed to read schema document 'file:/D:/Temp/jaxb-ri-20061211/bin/test/test.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
> line 2 of file:/D:/Temp/jaxb-ri-20061211/bin/test/test.xsd
>
>
>
> test.xsd
>
>
> <Schema xmlns='urn:schemas-microsoft-com:xml-data'
>
> xmlns:dt='urn:schemas-microsoft-com:datatypes'>
>
> <ElementType name='test' content='textOnly' dt:type='ui4' dt:minLength='1'/>
> </Schema>
>
>
>
>
> I think that the SchemaFactory just cannot handle the Microsoft schema namespaces.  Is this correct?  If so, what is a good workaround for this?
>
> ________________________________
> Windows Live: Keep your friends up to date with what you do online.