ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xml-dev
xml-dev
[xml-dev] Encoding default attribute values at a higher level element?
by Andrzej Jan Taramina other posts by this author
Jan 28 2002 9:00PM messages near this date
[xml-dev] Re: Nesting schemas? | RE: [xml-dev] DOM Level 3 Abstract Schema and Load & Save
Is there any preferred way to allow encoding of a changed default attribute 
value at a higher level element?

For example:

Say I have a instance fragment that looks like this:

<GPSData> 	
   <Waypoint> ...</Waypoint>        
   <Waypoint> ...</Waypoint>   
   <Waypoint> ...</Waypoint>  
   <Waypoint UOM="other">  ...</Waypoint>  
<GPSData> 

Where Waypoint has an attribute called UOM which defaults to the value 
"degrees". eg <Waypoint UOM="degrees">  is the default.

Is there an good way to do specify the following in an XMLSchema:

<GPSData defaultUOM="radians"> 	
   <Waypoint> ...</Waypoint>        
   <Waypoint> ...</Waypoint>   
   <Waypoint> ...</Waypoint> 
   <Waypoint UOM="other">  ...</Waypoint>  
<GPSData> 

And have the default UOM for each Waypoint EXCEPT the last now be 
radians?

My gut feel is that you could only do this in the processing application, but the 
question is how? I'm showing my ignorance of DOM/SAX validating parsers 
here so please bear with me

The problem I see is that a validating parser will build the tree using the default 
value of UOM (degrees) for all the Waypoints that do not explicitly specify a 
value.  But is there any way to check in an application program to know that 
this value was specified by default rather than explicitly and thus should really 
be "radians" as defined at the parent GPSData element level if it was allowed 
to default?  

Thanks for any insight you can offer.
Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com


-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org> , an
initiative of OASIS <http://www.oasis-open.org> 

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl> 

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved