JAVA-XML

Hi All,

I posted this in XML forum, but didn't got any reply.. but since it is related to Java also, so posting it here as well...

Please help!!!

I am very new to XML.. never done it, so kindly be patient..

I want to build a xml

where I have order
 in order there can be many allocations
 in allocation there can be many execution

also, order has price, quantity, clientId etc fields
allocation has price, quantity, account etc fields
exeuctions has price quantity, id etc fields

I want to do it the right way --- to build schema or dtd first and based on that create a xml

objective is that finally we will use this dtd/schema to automatically create XML using java ...

and then somehow based on XML-- build automatically the java objects  ---  like Order Object ..  Allocation Object etc..

I have all these objects in java already but rest of the stuff needs to be done..

Please help me create this...

again, sorry, I am very new to XML -- don't know much about basics of it.. so kindly be patient answering my basic questions...

thanks
shivaniAsked:
Who is Participating?
 
hoomanvCommented:
I also dont know much about xml. :-)
here is a good place to start learning java's APIs for xml
http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/

Processing XML with Java: http://www.cafeconleche.org/books/xmljava/
0
 
Mayank SAssociate Director - Product EngineeringCommented:
You should create the XSD first. Take a sample XML if you want. For your case, it might be like:

<Orders>
  <Order ID = "....">
    <ClientID>....</ClientID>
    <Price>....</Price>
    <Quantity>....</Quantity>
    <Allocations>
      <Allocation ID = "....">
        <Account>....</Account>
        .... // other fields
      </Allocation>
    </Allocation>
  </Order>
</Orders>

You will need to define an XSD containing data-types of all of these and constraints like how many times a node can occur, etc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.