sorry, I am resending this e-mail post, because the
XML code snippet did not show up in my previous
e-mail.

-----

Hi,

I have been writing some Java code to dynamically
generate an XML file. The generated xml file is then
submitted to a web service. I have been using dom4j to
dynamically create the xml document, and it works
fine. The problem is that the web service performs a
schema validation on the xml request that I submit to
it, and my generated xml request is failing the schema
validation. The reason is because the schema xsd file
in the web service uses the <sequence> tag and
requires that the xml tags must be in a particular
order.

So for example, it might require the FirstName,
LastName, and then Age tags in that order:

&lt;Document&gt;
  &lt;RecordsList&gt;
    &lt;FirstName&gt;John&lt;/FirstName&gt;
    &lt;LastName&gt;John&lt;/LastName&gt;
    &lt;Age&gt;55&lt;/Age&gt;
  &lt;/RecordsList&gt;
&lt;/Document&gt;

But dom4j does not preserve the order of the xml
elements in the order in which I create them. So the
resulting xml has the correct structure but the order
of the elements are different; so for example the
LastName tag might appear before the FirstName tag.
Does anybody know how I can use dom4j or jdom or some
other Java implementation to generate an xml document
while preserving the order of the xml elements?

Thanks.

P.S. changing the xsd to not require the xml tags to
be ordered is not an option. I do not have the
authority to modify the xsd of the web service to
remove the sequence requirement.


**********************************************************
* Saladin Sharif
* e-mail:  [EMAIL PROTECTED]
* Visit homepage @ http://gaia.ecs.csus.edu/~sharifs
**********************************************************


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to