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

[A bit more] Re: writing good xml


xml simpletype list example
I also meant to recommend an additional approach:

You might want to consider using XML schema list types - for example:

<xsd:simpleType name="listOfSetFlags">
  <xsd:list itemType="xsd:integer"/>
</xsd:simpleType>

Where the list of flags that are set would be represented in an XML
document as follows:

<listOfSetFlags>1 4 8 12</listOfSetFlags>

Kind Regards,
Joe Chiusano
Booz | Allen | Hamilton
Strategy and Technology Consultants to the World

Chiusano Joseph wrote:
> 
> My comments will be on the proposed approaches, and I'm sure that others
> will comment on SAX (takes me back to my days of breakpointing an OS and
> verifying the set/cleared bits in the registers):
> 
> First, a question: Do you really need to work at the binary level?
> 
> Having said that:
> 
> Cases 1 and 2: Although these represent a possible approach, the issue I
> see is that they do "more work" than is necessary - that is, they not
> only list the flags, but a Boolean value of "true". If you really need
> to list the Boolean value for the set flags, you might as well list all
> flags, with a value of "false" for those that are cleared. Otherwise,
> the best approach is (in general, separate from synxtax) to list only
> the flags.
> 
> Case 3: Would not recommend, as you are using empty elements to
> represent data, which is not generally considered to be a sound approach
> (elements should represent metadata about the data).
> 
> Case 4: If you list the base 10 equivalent of the binary value, there
> should be no reason to list the individual flags - as with Cases 1 and
> 2, this is more work than necessary. If the receiving system can convert
> (or can be made to convert) a base 10 number into its equivalent binary
> representation, than simply providing the base 10 representation should
> be enough.
> 
> Case 5: Did not see any value in mixing fonts with the numeric values
> here.
> 
> Kind Regards,
> Joe Chiusano
> Booz | Allen | Hamilton
> Strategy and Technology Consultants to the World
> 
> Ronald Kent Gibson wrote:
> >
> > Dear All
> >
> > A general question and a specific one.
> >
> > Someone once told me that you should only used attributes when you know that
> > you will never need another attribute. (Case 1)
> >
> > And then I read somewhere to forget about attributes except for the
> > exception of an id attribute. (Case 2)
> >
> > Does anyone care to comment and clarify this.
> >
> > And to add a specific question.
> >
> > I want to define a set of 64 bit flags, and I want to only define ones that
> > are true.
> >
> > What do you reckon is the best ways to do this:
> >
> > Case 1
> >
> > <x flag0="true" flag4="true"/>
> >
> > or
> >
> > Case 2
> >
> > <x>
> > <flag0>true</flag0>
> > <flag4>true</flag4>
> > </x>
> >
> > or something like:
> >
> > Case 3
> >
> > <Flags><2></2><7></7><18></18></Flags>
> >
> > or
> >
> > Case 4
> >
> > <Flags Value="20"> <!- Binary 10100 -->
> >  <flag3/>
> >  <flag5/>
> > </Flags>
> >
> > or
> >
> > Case 5
> >
> > <FlagDef>
> >  <Serif>2</Serif>
> >  <Italic>7</Italic>
> >  <SmallCap>18</SmallCap>
> > </FlagDef>
> >
> > <Flags Value="9">
> >  <Serif>true</Serif>
> >  <Italic>true</Italic>
> > </Flags>
> >
> > or something better? Can anyone see any problems with any of the
> > propositions?
> >
> > I would like the resulting XML to be easy to parse and to transform ( ie not
> > tricky xpath or recursion required).
> >
> > I haven't decided whether to use events such as those found in sax.
> >
> > any comments or suggestions would be gladly appreciated.
> >
> > regards
> >
> > kent gibson
> >
> > -----------------------------------------------------------------
> > 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://www.oasis-open.org/mlmanage/index.php>
> 
> -----------------------------------------------------------------
> 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://www.oasis-open.org/mlmanage/index.php>

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.