users@jaxb.java.net

Re: Handling repeating element names inside a complex type

From: Kris Easter <Kris.Easter_at_colorado.edu>
Date: Tue, 03 Aug 2010 15:02:28 -0600

Glen,

The last answer from you actually addressed a different sort of problem
I'm having with the same application. For the last answer you provided
that problem has to do with the same simpleType defined in two different
XSD files. I might have a solution to that but it's really a different
problem then the one I posted here.

Thanks,
Kris

On Tue, 2010-08-03 at 14:40 -0600, Glen Mazza wrote:
> Was the latest answer I provided
> (http://forums.java.net/jive/thread.jspa?messageID=479242#479242) not
> correct? (It may not have been, I'm not an expert at this.)
>
> Glen
>
> Kris Easter wrote:
> > I'm trying to parse a XSD with JAXB that has elements with the same name
> > inside sequences inside a complex type. I posted a variant on the
> > problem on the Metro web forum using wsimport but I think I've got it
> > narrowed down to a JAXB question so I thought I'd ask about it here.
> > Hopefully this won't be considered a cross-post.
> >
> > With this:
> >
> > xjc TestRepeatingSchema.xsd
> >
> > I get this:
> >
> > [ERROR] Element "{http://www.example.org/TestRepeatingSchema}PSCAMA"
> > shows up in more than one properties.
> >
> > I've tried adding in line annotations like:
> >
> > <xsd:element minOccurs="0" name="PSCAMA" type="xsd:string">
> > <xsd:annotation>
> > <xsd:appinfo>
> > <jxb:property name="PSCAMA1" />
> > </xsd:appinfo>
> > </xsd:annotation>
> > </xsd:element>
> >
> > And a similar approach with a .xjb file. The inline annotations result
> > in:
> >
> > [ERROR] compiler was unable to honor this property customization. It is
> > attached to a wrong place, or its inconsistent with other bindings.
> >
> > The .xjb file throws an xpath violation:
> >
> > [ERROR] XPath evaluation of ".//xs:element[@name='PSCAMA']" results in
> > too many (2) target nodes
> >
> > Can someone tell me what I'm doing wrong and how to get JAXB to parse
> > this correctly? I believe it's a "valid" schema but if it's not I can
> > at least take that back to the developer of the webservice and see if
> > they'll change the schema.
> >
> > A sample schema that shows the problem is:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> > jxb:version="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://www.example.org/TestRepeatingSchema"
> > xmlns="http://www.example.org/TestRepeatingSchema"
> > elementFormDefault="qualified">
> >
> > <xsd:complexType name="SCC_SM_SERVICEMsgDataRecord_TypeShape">
> >
> > <xsd:sequence>
> >
> > <xsd:sequence minOccurs="0" maxOccurs="unbounded">
> > <xsd:element name="SCC_SM_RULE_VW" type="xsd:string" />
> > <xsd:element minOccurs="0" name="PSCAMA" type="xsd:string"/>
> > </xsd:sequence>
> >
> > <xsd:sequence minOccurs="0" maxOccurs="unbounded">
> > <xsd:element name="SCC_SM_PRSN_VW" type="xsd:string" />
> > <xsd:element minOccurs="0" name="PSCAMA" type="xsd:string">
> >
> > <!--<xsd:annotation>
> > <xsd:appinfo>
> > <jxb:property name="PSCAMA1" />
> > </xsd:appinfo>
> > </xsd:annotation>
> > -->
> > </xsd:element>
> >
> > </xsd:sequence>
> > </xsd:sequence>
> > </xsd:complexType>
> >
> > </xsd:schema>
> >
> > Thanks for any help you can offer.
> >
> > Kris
> >
> >
> > ---------------------------------------------------------------------
> > 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
>