Hello -
I have been working with Castor for a few days now, and have run into a
problem with my XML file (XML file included below).
I have this XML schema which I created based on my newbie knowledge of
XML schema's, and have verified it's validity with a schema checker
(xmlqualchckr).
When I try to generate code using Castor's Source Generator, and I get
the exception (java.lang.StackOverflowError). (Stacktrace is attached
below the XSD FILE).
However, if I change the XML file by commenting out the additional
recursion line which I am needing (see XSD file), then SourceGenerator
generates the source from the XSD file and everything works fine.
Any helpful suggestions are greatly appreciated.
Regards,
Vanita
XSD SOURCE FILE
BEGINNING OF SOURCE
-------------------------------------------------------
<?xml version ="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.anyplace.com"
xmlns="http://www.anyplace.com">
<xsd:element name="Section">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Section" minOccurs="0"
maxOccurs="unbounded" />
<xsd:element ref="Application" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="text" type= "xsd:string" use="required"
/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Application">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="SubCategory" minOccurs="0"
maxOccurs="unbounded" />
<xsd:element ref="Attr" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string" use="required"
/>
</xsd:complexType>
</xsd:element>
<xsd:element name="SubCategory">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Attr" minOccurs="1"
maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="text" type= "xsd:string" use="required"
/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Attr">
<xsd:complexType>
<xsd:sequence>
<!-- If the following line is commented out, no errors occur -->
<!-- Beginning of section causing error? -->
<xsd:element ref="SubCategory" minOccurs="0"
maxOccurs="unbounded" />
<!-- End of section causing error. -->
<xsd:element ref="Attr" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="name" type= "xsd:string" use="required"
/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
------------------------------------------------------------
END OF SOURCE
SNIPPET of StackTrace
----------------------------------
Exception in thread "main" java.lang.StackOverflowError
at
org.exolab.castor.builder.types.XSPatternBase.<init>(XSPatternBase.java:
69)
at
org.exolab.castor.builder.types.XSString.<init>(XSString.java:90)
at
org.exolab.castor.builder.TypeConversion.convertType(TypeConversion.java
:286)
at
org.exolab.castor.builder.MemberFactory.createFieldInfo(MemberFactory.ja
va:177)
at
org.exolab.castor.builder.SourceFactory.processComplexType(SourceFactory
.java:1256)
at
org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactory.j
ava:237)
at
org.exolab.castor.builder.SourceFactory.processContentModel(SourceFactor
y.java:1364)
.......
---------------------------------
____________________________
Vanita Browne
Software Engineer
Prisa Networks
6620 Mesa Ridge Road, Suite 200
San Diego, CA 92121
mailto:[EMAIL PROTECTED]
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev