|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: writing good xml
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








