Kenneth,
You need to compile the *Descriptor.java classes.
I can tell right away that Castor is defaulting to introspecting your classes (because you get the valid="true" in the output - only happens when Castor introspects the generated sources.) which is why you get the wrong order.
If you compile all the *Descriptor.java files, you'll get the correct output.
--Keith
Kenneth Stephen wrote:
Hi,
Here is the schema file that I'm using :
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://w3.ibm.com/xmlns/srv/cs/catalog" xmlns:catalog="http://w3.ibm.com/xmlns/srv/cs/catalog">
<xsd:complexType name="LocaleInfo"> <xsd:sequence> <xsd:element name="language"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="[a-z]{2}"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="country"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Z]{2}"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType>
<xsd:element name="locale" type="catalog:LocaleInfo"/> </xsd:schema>
I've run the SourceGenerator against this, and compiled the resulting code. I then use the following test class :
import java.io.PrintWriter; import services.ice.catalog.Locale; import services.ice.catalog.LocaleInfo;
public class Test { public static void main(String [] args) throws Exception { Locale l = new Locale(); l.setLanguage("en"); l.setCountry("GB"); l.marshal(new PrintWriter(System.out)); } }
....where services.ice.catalog is the package that I generated the Java for. When I execute this code, I get the following XML :
<?xml version="1.0" encoding="UTF-8"?>
<locale xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" valid="true"
xsi:type="java:services.ice.catalog.Locale">
<country>GB</country>
<language>en</language>
</locale>
Given my use of the xsd:sequence model group in the schema, I was expecting the language element to precede the country element in the XML. What am I doing wrong?
Thanks, Kenneth
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
