You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Siegfried Baiz <ba...@sulzer.de> on 2007/02/14 20:33:50 UTC
How to get acces to a (non buildIn) SchemaTypeSystem for included
Schemas at runtime (via xsi:schemaLocation)
Hi, can anyone help me
with the following problem on "SchemaTypeSystem"?
I have to load Xml-Instances without knowing the corresponding
Schema-Definition.
That means
a) I cannot precompile Schemas to Java-Models.
b) I load my Xml-Files using XmlObject.Factory.parse(aFile).
On the other hand most of my input files reference to a
dedicated schema-definition (via xsi:schemaLocation)
and I would like to make XmlBeans providing me XmlObjects
with an "integrated" schema type system that represent
the referenced (xsi:schemaLocation) schema-definition.
Under
http://xmlbeans.apache.org/docs/2.0.0/guide/conIntroToTheSchemaTypeSystem.html
I found the following statement:
/When you compile schema, the API generated from your schema is
integrated with the XMLBeans type system that represents the
underlying XML schema. All together, these types make up the /schema
type system/ to which your code has access. [...] when you want to
get information about the schema itself, you use the schema type
system API.
/
As I want to get information about the referenced schema at runtime
I'm wondering if anything comparable would be possible without apriori
compiling schemas.
I've tried the folling code without succes:
protected XmlObject buildDoc(File input) throws
XmlException, IOException {
XmlOptions xopt=new XmlOptions();
xopt.setCompileDownloadUrls(); xopt.setValidateOnSet();
xopt.setLoadUseDefaultResolver();
xopt.setLoadUseDefaultResolver();
final XmlObject xo = XmlObject.Factory.parse(input,xopt);
System.err.println(xo.type);
return xo;
}
As system output I would have expected something like
/D=GWModel@gw.model.xml.de/gwml/
but unfortunatally I always get
/T=anyType@http://www.w3.org/2001/XMLSchema/
Maybe that's a stupid approch, as "xo.type" refers to the static member
"type"
of the build-in Class "XmlObject". Anyway I keep on hoping, that there
may be
some better approch fitting my needs.
Thanks in advance
Siggi
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org