OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   [A bit more] Re: [xml-dev] writing good xml

[ Lists Home | Date Index | Thread Index ]

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>




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS