At JBoss, we made the decision to use the Xerces Schema API to represent our Schema Model. An issue we found was that the schema model is more of a flat/read-only model, which when built has no hierarchical information and has lost track of custom prefixes etc.
So approach by JBoss:
1) Parse a schema file into a XSModel.
- Use Xerces Implementation of the XSModel.
2) Construct manually a Schema Model with the hope of adding types/ elements/attributes etc.
- Use JBossXSModel.
Now anytime, you built a Schema Model by parsing from a file, you are stuck. You get the Xerces Impl of XSModel which is read only.
Do not despair. There is a utility class called WSSchemaUtils that has a method called getJBossXSModel as follows:
| public JBossXSModel getJBossXSModel(XSModel)
|
You can use this utility method to obtain a JBossXSModel from any implementation of XSModel.
This inconvenience is regretted. But I could not help the read only nature of Xerces impl of XSModel. In fact, the Xerces Schema API by itself is a flat read only model.
Another interesting thing about JBossXSModel, is that it can serialize itself into a String. This String can be written to a file or a Stream, after serialization.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3887519#3887519
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3887519
|