Hi folks,
I just checked in the implementation of Schema CM API. Please try it out
(if possible). Any comments/feedback/bug-report are welcome.
All interfaces in impl.xs.psvi package except XSAnnotation are implemented.
As I mentioned before, there will be two ways to get at XSModel:
1. From PSVI
2. From preparsed grammars
We don't have full PSVI support yet. I'll be working on that soon. And as I
mentioned in a previous message "[Schema CM API] How it works with grammar
loading", it's not clear yet how to get XSModel from preparsed grammars. So
it seems that this exciting functionality can't be accessed at all.
Well, it is true. :-( But for prototyping purposes, interested users can
use DOMASBuilder to construct ASModel, cast it to ASModelImpl, get grammars
from it, then construct an XSModelImpl from the grammars. Here is some
sample code that shows how this can be done:
import org.apache.xerces.dom3.as.ASModel;
import org.apache.xerces.dom.ASModelImpl;
import org.apache.xerces.impl.xs.psvi.*;
import org.apache.xerces.impl.xs.XSModelImpl;
import org.apache.xerces.impl.xs.SchemaGrammar;
import java.util.Vector;
...
XSModel as2xsModel(ASModel asmodel) {
ASModelImpl model = (ASModelImpl)asmodel;
Vector models = model.getInternalASModels();
SchemaGrammar[] grammars = new SchemaGrammar[models.size()];
for (int i = 0; i < models.size(); i++)
grammars[i] = ((ASModelImpl)models.elementAt(i)).getGrammar();
return new XSModelImpl(grammars);
}
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]