I want to be able to programmatically read an XSD, prompt a user to input values for the required elements, and then generate the appropriate XML string. I do not want the implementation to be tied to a specific XSD definition, but to be able to read and prompt for any provided XSD. It should get the names of elements and ask for the appropriate kind of input (int,string,etc).
I’ve found lots of places explaining how to read an XSD and use it to validate some piece of XML provided to the application. I have not, however, found any way to find out what elements are defined, of what type, and with what attributes. I found SchemaFactory and Schema, but no way to get any information about the schema, just how to use it for validation. Does anyone know of a way to get element information from the schema?
I’m not sure if I understand exactly what you want to do but consider this:
XSDs are XML documents themselves and there is a XSD for XSD documents.
So parse the XSDs as normal XML documents and try to extract the informations you need.
You could even generate JAXB classes using the mentioned XSD XSD.