users@jaxb.java.net

Re: can someone show me a working xsd:any example?

From: <dev_at_samizdatdigital.org>
Date: Wed, 23 Jun 2004 16:42:40 -0700

thanks. here's the ant output:

       [xjc] Compiling file:/Users/gold/tmp/test.xsd
       [xjc] [ERROR] src-resolve.4.2: Error resolving component
'xsd:any'. It was detected that 'xsd:any' is in namespace
'http://www.w3.org/2001/XMLSchema', but components from this namespace
are not referenceable from schema document 'file:test.xsd'. If this is
the incorrect namespace, perhaps the prefix of 'xsd:any' needs to be
changed. If this is the correct namespace, then an appropriate 'import'
tag should be added to 'file:test.xsd'.
       [xjc] line 12 of test.xsd

here's test.xsd:

<xsd:schema targetNamespace="http://somewhere.com/somepackage"
             xmlns:this="http://somewhere.com/somepackage"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- bunch of other unrelated complexType defs snipped here for clarity
-->

<xsd:complexType name="ResponseType">
     <xsd:choice>
         <xsd:sequence>
             <xsd:element name="Results" type="xsd:any"
maxOccurs="unbounded"/>
         </xsd:sequence>
         <xsd:element name="Error" type="xsd:string"/>
     </xsd:choice>
</xsd:complexType>

<xsd:element name="Response" type="this:ResponseType"/>

</xsd:schema>

i ran it through a schema validator and it seems okay. also, if i
change the xsd:any to something else (xsd:string, xsd:integer),
everything works fine.

jon

On Jun 23, 2004, at 4:12 PM, Kohsuke Kawaguchi wrote:

>
>> i'm trying to use xsd:any and xjc (via ant) is complaining that
>> xsd:any
>> isn't part of the namespace (i'm using the standard xmlns:xsd="blah"
>> on
>> the schema element), and suggesting that i use an import. i actually
>> tried this and did an xsd:import with
>> schemaLocation="http://www.w3.org/2001/XMLSchema.xsd", but nada. also,
>> i tried redefining the namespace on all inner elements, but this
>> didn't
>> work either. i also tried <xjc extension="true" ... > to no avail.
>
> It probably helps to copy the exact error message to the e-mail and
> post
> the relevant portion of your schema.
>
> Also, you should check the correctness of your schema by using a tool,
> if possible. That would help you isolate the problem (whether it's your
> schema problem or it's a JAXB problem.)
>
> regards,
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net