You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Ni...@sercel.fr on 2003/04/28 18:29:04 UTC
Réf. : Re: Réf. : Re: Réf. : RE: XSModel
>You mean put it in a grammar pool, and give the pool to the parser?
I mean loading a schema and making the parser to use it for validation.
But I didn't upgrade my code since weeks, and I continue to use this kind of code :
ASModel asModel = parser.parseASInputSource(in); // 'in' is an DOMInputSource which points to a schema
parser.setAbstractSchema(asModel); // 'parser' is an instance of DOMASBuilder
>If you want to check the properties of various schema components, then
>XSModel is the answer.
>If you want to check the original XML representation of the schema, then
>no, not in the Xerces world. The Xerces schema doesn't retain such
>information.
Ex. :
Model :
<xsd:complexType name="insSERIAL_LINK_T">
<xsd:simpleContent>
<xsd:restriction base="EnumDef_T">
<xsd:enumeration value="port A"/>
<xsd:enumeration value="port B"/>
<xsd:attribute ref="label" fixed="Serial link"/>
<xsd:attribute ref="editable" fixed="1"/>
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
<xsd:element name="insSERIAL_LINK" type="insSERIAL_LINK_T" default="port A"/>
Instance to validate against model :
<insSERIAL_LINK>port X</insSERIAL_LINK>
When a validation error occurs, I want to use the 'label' attribute to build a user error message
which would look like :
ERROR : Serial link is not correct ; should be either 'port A' or 'port B'
So I need to get the label attribute content to build the message (and, in this example, the different values).
What I really need is to retrieve the complete DOM node (because I use a DOM parser) in error, populated
with complementary information (such as the label attribute) by the parser. This could allow me to get
all the properties of my data to alert the user of how to use it.
Till now, I parse my schema as a simple xml instance thanks to another parser to retrieve these properties.
So my question was : can I use the XSModel to introspect schemas and retrieve data properties because the native validation
error message does not return all the information of the element.
Thank you very much
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com
Nicolas.GOLOUBENK
O@sercel.fr To: xerces-j-user@xml.apache.org
cc:
04/28/2003 11:24 Subject: Réf. : Re: Réf. : RE: XSModel
AM
Please respond to
xerces-j-user
Absolutely, you're right !
I'm sorry, I made a confusion between ASModel and XSModel.
I profit from this discussion to ask my question a second time : after
setting a schema model to a dom parser to validate XML
instances against this schema, does any API exist to introspect the schema
itself without parsing it a second time with another
parser ?
Thank you
"Sandy Gao"
<sandygao@ca. Pour :
xerces-j-user@xml.apache.org
ibm.com> cc :
Objet : Re: Réf. : RE:
XSModel
04/28/2003
05:11 PM
Veuillez
répondre à
xerces-j-user
> Someone answers me that XSModel was dead and should not be used now.
Huh?! XSModel *is* alive, and will be alive for some time (hopefully a long
time). But as Robert said, it might be moved to a different package.
Is it possible that you are confusing it with ASModel?
Thanks,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com
Nicolas.GOLOUBENK
O@sercel.fr To:
xerces-j-user@xml.apache.org
cc:
04/28/2003 11:06 Subject: Réf. : RE: XSModel
AM
Please respond to
xerces-j-user
I asked a question like that a few weeks ago. Someone answers me that
XSModel was dead and should not be used now.
Because I had to introspect schemas, I decided to use a simple XML parser
to do that instead of using a specific XSD API.
Nicolas
"Robert
Houben" Pour :
<xe...@xml.apache.org>
<rhouben@telu cc :
s.net> Objet : RE: XSModel
04/28/2003
04:51 PM
Veuillez
répondre à
xerces-j-user
They are deprecated because they "might move" to another package. You
are not the first person to be confused by this. (I wasn't the first,
either!) Go ahead and use them.
Robert Houben
mailto:rhouben@telus.net
http://www.RobertHouben.com/
-----Original Message-----
From: Blake Meike [mailto:blakem@world.std.com]
Sent: Monday, April 28, 2003 7:44 AM
To: xerces-j-user@xml.apache.org
Subject: XSModel
Hey, this is confusing.
All the documentation I can find about manipulating an XS Grammar says
to get the grammar from the grammar pool, after the XSD is parsed, cast
it to an XSGrammar, and then use the "toXSModel()" method to obtain an
object for inspection. When I try to actually do this, it turns out
that XSModel and everything about it are deprecated.
So what is replacing them?
Blake Meike
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org