File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jaxb recursive nodes

 
Ramans mann
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any body tell me how to fix this .I am using http://jaxb.java.net/ latest version


<xsd:element name="aaa">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="aaa_structure">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="study" type="exceptionType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="exceptionType">
<xsd:sequence>
<xsd:element name="study" type="exceptionType"/>
</xsd:sequence>
</xsd:complexType>

</xsd:sequence>
<xsd:attribute name="app_id" type="xsd:string" />
</xsd:complexType>
</xsd:element>




I got this error

[java] [ERROR] src-resolve: Cannot resolve the name 'exceptionType' to a(n) 'type definition' component.
[java] line 22 of file:/Jaxb/src/MySchema.xsd

[java] [ERROR] s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: complexType.
[java] line 26 of file:/Jaxb/src/MySchema.xsd
 
Ramans mann
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is a problem with JAXB Reference APi i am using (http://jaxb.java.net/ latest version )

It does not seems to be supporting "name" attribute

<xsd:complexType name="exceptionType">
 
Ramans mann
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java mann wrote:I think it is a problem with JAXB Reference APi i am using (http://jaxb.java.net/ latest version )

It does not seems to be supporting "name" attribute

<xsd:complexType name="exceptionType">


I am not sure if this is the rigth approuch
 
g tsuji
Ranch Hand
Posts: 649
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>I think it is a problem with JAXB Reference APi i am using (http://jaxb.java.net/ latest version )
Not really.

>It does not seems to be supporting "name" attribute
That's an illusion. You've not read the error message properly and that you've an invalid schema per w3c schema recommendation.

>[java] [ERROR] src-resolve: Cannot resolve the name 'exceptionType' to a(n) 'type definition' component.
[java] line 22 of file:/Jaxb/src/MySchema.xsd

That means the type "exceptionType" cannot be found as a top level element of xsd:complexType with name="exceptionType". This is how to fix your schema fragment.

Move the block:

and reposition it outside of the block <xsd:element name="aaa">...</xsd:element> and as a child element directly under xsd:schema element.

>[java] [ERROR] s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: complexType.
[java] line 26 of file:/Jaxb/src/MySchema.xsd

This is another aspect of the same error of positioning the block xsd:complexType directly under xsd:sequence element. It literally means xs:complexType cannot be an immediate child element of xsd:sequence.

In fact, jaxb does a good job on pulling out these two error messages.

 
g tsuji
Ranch Hand
Posts: 649
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Furthermore, I forgot to mention, when you do any kind of recursive algorithm or templating or type declaration, you should implement an exit provision one way or another. The same here.

<xsd:element name="study" type="exceptionType"/>


It is on the complexType and you need at least one occurrence of the element study as parent. If it is further on the outer element declaration as well, the parent study may not occur at all.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic