[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Default attribute values at a higher level element?

  • To: xml-dev@l...
  • Subject: Default attribute values at a higher level element?
  • From: "Andrzej Jan Taramina" <andrzej@c...>
  • Date: Tue, 5 Feb 2002 16:04:30 -0500
  • Organization: Chaeron Consulting Corporation
  • Priority: normal
  • Reply-to: andrzej@c...

example waypoints xml
Sure could use some advice on how to handle this situation!  Thx!

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.