Hi,
I am new to this and think it is repeated before by looking at the mail list but
still am not able to set this right.
The generated java source code along with descriptor files are compiled and put on
classpath.
My piece of code
FileReader reader = new FileReader("test.xml");
System.out.println(" reader "+reader);
//Unmarshaller unmarshaller = new Unmarshaller("List.class");
Unmarshaller unmarshaller = new Unmarshaller(new List());
List list = (List)unmarshaller.unmarshal(reader);
And am getting the foll.exception:
Exception in thread "main" org.xml.sax.SAXException: Illegal Text data found as
child of: listItem
value: "String"
at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.ja
va:737)
at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.ja
va:918)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLVa
lidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.disp
atch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
canner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:583)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:491)
at Test.main(Test.java:17)
Following is my xsd file:
<?xml version="1.0" ?>
<xs:schema id="list" targetNamespace="http://www.wisl.co.uk/schemas"
xmlns="http://www.wisl.co.uk/schemas" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<!--********************************************************-->
<!-- Version : 1.0.1
-->
<!-- Property of TransactorGSL
-->
<!--********************************************************-->
<xs:element name="list">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="listItem" nillable="true">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute
name="ID" form="unqualified" type="xs:string" />
<xs:attribute
name="Default" form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
And my xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by jatin (lutech) -->
<!--Sample XML file generated by XMLSPY v2004 rel. 2 U (http://www.xmlspy.com)-->
<list xmlns="http://www.wisl.co.uk/schemas"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wisl.co.uk/schemas
D:\list\List.xsd">
<listItem ID="String" Default="String">String</listItem>
</list>
Any help on 'why' would be very appreciated
Jatin
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev