Hi, I'm looking for the best way to work with a datatyped xml document. I've read the validation section in the cookbook and had a flick over the relevant jdocs, but I am still unsure of how to accomplish what I want.
For instance, lets say I have an xsd schema and document po.xsd and po.xml. (PurchaseOrder) And one of the elements is a Price which is required and typed as Integer I first validate the po.xml against po.xsd then create the Document. (<-- not quite sure how to do this but it shouldn't be too hard) Now that I have the document, I want to be able to determine the Datatype of an element or attribute so I can act accordingly, how do I this? I would need this in a situation where I have a List of PO's and would like to sum the prices of all the PO's. However, the above situation is determined dynamically and I can't hard code anything in because I don't know what type of document I'll be getting, I just know that I might have to add different fields in any schema and document pair. I would like to be able to do something like: Element price1 = doc1.getElement("Price") Element price2 = doc2.getElement("Price") if(schema.getDataType(price1) == Integer) { int price1Int = Integer.parseInt(price1.getText()); int price2Int = Integer.parseInt(price2.getText()); System.out.println(price1Int + price2Int); } else if (schema.getDataType(price1) == Float) { etc etc } Whats the best way to go about something like this? Regards, Beri __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by: DEDICATED SERVERS only $89! Linux or FreeBSD, FREE setup, FAST network. Get your own server today at http://www.ServePath.com/indexfm.htm _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user