logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

RE: schema validation and default attributes: msg#00014

Subject: RE: schema validation and default attributes
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.
 
Thanks for the pointer below. The penny has dropped. I was struggling with the inability to determine if the attribute came from the infoset or the schema. I had missed the getIsSchemaSpecified() http://xml.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/ItemPSVI.html#getIsSchemaSpecified()
method. Duh!
 
BTW
Looking at the fetaures list I am trying to understand the meaning and effect of 
should that expose the element default values ??
 
 
Mike


From: Biron,Paul V [mailto:Paul.V.Biron@xxxxxx]
Sent: 20 May 2005 19:09
To: 'j-users@xxxxxxxxxxxxxxxxx'
Subject: RE: schema validation and default attributes

> -----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 ...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo