Hello!
Thanks for your reply!
I guess you think this is a bit stupid then? Perhaps I should reconsider my approach!
How would you attack this problem:
You should dynamically generate a XML-structure with Java. For this task you got a XSD-file describing the XML-structure.
Would you:
1) Manually creata a XML-skeleton-file from the known xsd.
2) Load it with:
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse("xml_xsd/ProductModel.xml");
3) Fill it with some data.
4) Perhaps do some validation like:
documentBuilderFactory.setValidating(true);
documentBuilderFactory.setAttribute("
http://java.sun.com/xml/jaxp/properties/schemaLanguage", "
http://www.w3.org/2001/XMLSchema");
documentBuilderFactory.setAttribute("
http://java.sun.com/xml/jaxp/properties/schemaSource", "file:xml_xsd/ProductModel.xml");
Or do you got any nicer way to build the XML-structure dynamically?
Best regards
Fredrik