|
(classes created based on my XSD by castor
generator)
1) I UNMARSHALL an XML file that validates
against my XSD.
2) I modify the data inside java
3) I MARSHALL the data, and the data is in a
completely different XML format than it started
(I am not using a mapping file, because I dont need
it)
I can see where the marshalling derives the fields
it serialized, but they are not the fields it originally
unmarshalled
===================================
ORIGINAL XML FILE
===================================
<?xml version="1.0"
encoding="UTF-8"?>
<service id="ADVANTAGE_PUSH" type="SCHEDULABLE" clientId="AVIATION" entityId="AN.C_20_BOX" name="Update Advantage" object="com.mh.efulfillment.businessobjects.BOAdvantageUpdate" clientName="Aviation Week" entityName="Aviation Week AN.C server"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="D:\jakarta-tomcat-4.1.12\webapps\fwsf\WEB-INF\service.xsd">
<parameters> <parameter name="source_uri">127.0.0.1</parameter> <parameter name="destination1_uri">152.159.100.34:80</parameter> <parameter name="destination2_uri">152.159.100.34:443</parameter> </parameters> <default> <start>Wed, Oct 30 2002 16:10</start> <interval>20</interval> <comments><![CDATA[(put comments here)]]></comments> </default> <latest> <start>Thu, Nov 21 2002 12:00</start> <interval>60</interval> <comments><![CDATA[Ulysesa Sweatt]]></comments> </latest> </service> ===================================
XML FILE AFTE MARSHALLING
===================================
<?xml version="1.0" encoding="UTF-8"?>
<concrete-service
xsi:schemaLocation="D:\jakarta-tomcat-4.1.12\webapps\fwsf\WEB-INF\service.xsd"
active-status="false"
short-circuited="true"
time-remaining="2565847"
short-circuit-next="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<client-id>AVIATION</client-id>
<file-id>TEST_VALID.xml</file-id>
<client-name>Aviation
Week</client-name>
<entity-id>AN.C_20_BOX</entity-id>
<service-name>Update
Advantage</service-name>
<entity-name>Aviation Week AN.C
server</entity-name>
<next-execution>Sun, Dec 15 2002
18:00</next-execution>
<service-id>ADVANTAGE_PUSH</service-id>
<parameters empty="false"/>
</concrete-service>
===================================
MY XSD
===================================
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <!-- ################################ ELEMENTS ################################ --> <xs:element name="service"> <xs:complexType> <xs:sequence> <xs:element ref="parameters" minOccurs="0"/> <xs:element ref="default" minOccurs="0"/> <xs:element ref="latest" minOccurs="0"/> </xs:sequence> <xs:attribute name="id" type="ServiceId" use="required"/> <xs:attribute name="type" type="ServiceType" use="required"/> <xs:attribute name="clientId" type="RegisteredClient" use="required"/> <xs:attribute name="entityId" type="ServiceEntity" use="required"/> <xs:attribute name="name" type="xs:normalizedString" use="required"/> <xs:attribute name="object" type="xs:normalizedString" use="required"/> <xs:attribute name="clientName" type="xs:normalizedString" use="required"/> <xs:attribute name="entityName" type="xs:normalizedString" use="required"/> </xs:complexType> </xs:element> <xs:element name="parameters"> <xs:complexType> <xs:sequence> <xs:element ref="parameter" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="parameter"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:normalizedString"> <xs:attribute name="name" type="xs:ID" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="default"> <xs:complexType> <xs:sequence> <xs:element ref="start"/> <xs:element ref="interval"/> <xs:element ref="comments"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="latest"> <xs:complexType> <xs:sequence> <xs:element ref="start"/> <xs:element ref="interval"/> <xs:element ref="comments"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="start" type="CustomDateFormat"/> <xs:element name="interval" type="xs:integer"/> <xs:element name="comments" type="xs:string"/> <!-- ################################ CUSTOM TYPES ################################ --> <xs:simpleType name="ServiceId"> <xs:restriction base="xs:ID"> <xs:enumeration value="ADVANTAGE_PUSH"/> <xs:enumeration value="ADVANTAGE_PULL_CLAIM_FEED"/> <xs:enumeration value="ADVANTAGE_PULL_UPDATE_FEED"/> <xs:enumeration value="HORIZON_PUSH"/> <xs:enumeration value="HORIZON_PULL"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="ServiceType"> <xs:restriction base="xs:ID"> <xs:enumeration value="SCHEDULABLE"/> <xs:enumeration value="NONSCHEDULABLE"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="RegisteredClient"> <xs:restriction base="xs:ID"> <xs:enumeration value="AVIATION"/> <xs:enumeration value="PLATTS"/> <xs:enumeration value="SP"/> <xs:enumeration value="EDUCATION"/> <xs:enumeration value="CONSTRUCTION"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="ServiceEntity"> <xs:restriction base="xs:ID"> <xs:enumeration value="AN.C_33_BOX"/> <xs:enumeration value="AN.C_20_BOX"/> <xs:enumeration value="AN.C_DEV_BOX"/> <xs:enumeration value="AN.C_STAGE_BOX"/> <xs:enumeration value="AW_33_BOX"/> <xs:enumeration value="AW_20_BOX"/> <xs:enumeration value="AW_DEV_BOX"/> <xs:enumeration value="AW_STAGE_BOX"/> <xs:enumeration value="MGE_APP1_PROD"/> <xs:enumeration value="MGE_APP2_PROD"/> <xs:enumeration value="MGE_APP1_STAGING"/> <xs:enumeration value="MGE_APP2_STAGING"/> <xs:enumeration value="MGE_APP1_DEV"/> <xs:enumeration value="MGE_APP2_DEV"/> <xs:enumeration value="MHC_SWEETS_PROD"/> <xs:enumeration value="MHC_SWEETS_STAGE"/> <xs:enumeration value="MHC_SWEETS_DEV"/> <xs:enumeration value="MHC_PNP_PROD"/> <xs:enumeration value="MHC_PNP_STAGE"/> <xs:enumeration value="MHC_PNP_DEV"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="CustomDateFormat"> <xs:annotation> <xs:documentation>matches this format Wed, Oct 30 2002 16:10</xs:documentation> </xs:annotation> <xs:restriction base="xs:string"> <xs:pattern value="[A-Z][a-z][a-z],\s[A-Z][a-z][a-z]\s[0123][0-9]\s\d{4}\s[012][0-9]:[012345]0"/> </xs:restriction> </xs:simpleType> </xs:schema> |
