|
Hi Paul,
I seems for the email conversations so far that this is the
expected behavior indeed. It was not what I read for the feature documentation
and the FAQ, and I would think that this could be more explicit, so that it
spells out that defaults values are generated.
BTW
Looking at the fetaures list I am trying to understand the
meaning and effect of
should that expose the element default values
??
Mike
> -----Original Message----- >
From: Mike Skells [mailto:mike.skells@xxxxxxxxxxxxxxxxxxxx]
> Sent: Friday, May 20, 2005 2:34 AM
> To: j-users@xxxxxxxxxxxxxxxxx > Subject: schema validation and default attributes > > When using the schema validation
feature > http://apache.org/xml/features/validation/schema then I have
> attributes set with the default values. Is this
the expected > behavior or a bug.
I'm a little unclear exactly what you are asking. When
you turn schema validation on, xerces does what the schema spec tells it to
do...which is to add default/fixed values to attributes (among other things)
in the PSVI. What else should the xerces documentation say on this
issue?
If you do a "simple" serialization of the PSVI, yes, those
defaulted/fixed values will appear in the serialization. To serialize
without the defaulted/fixed values, you'll have to write your own code that
looks at org.apache.xerces.xs.ItemPSVI.getIsSchemaSpecified() [1].
As Joe has pointed this is no different from a DTD
defaulting/fixing attribute values (expect that in schema it might also happen
to element content as well as attribute values) and the need to examine
org.w3c.dom.Attr.getSpecified() [2].
pvb
[1] http://xml.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/ItemPSVI.html#getIsSchemaSpecified()
[2] http://xml.apache.org/xerces2-j/javadocs/api/org/w3c/dom/Attr.html#getSpecified()
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|