[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Tag for every column in every row
THOMAS PASSIN wrote: > > Yihpyng Kuan ask about redundancy in xml documents: > > > I am new to XML, I have a question here, I wonder if > > anyone can shed some light on it, many thanks. Elements are horrible for transporting around data, sometimes. Perhaps a clearer way to mark up your document would be something like this: <Table id="T1"> <element name="row"> <attribute name="F1" type="CHAR" length="10" /> <attribute name="F1" type="CHAR" length="10" /> </element> <Data> <row F1="data 1" F2="data 2" /> <row F1="data 3" F2="data 4" /> <row F1="data 5" F2="data 6" /> </Data> </Table> The bottom line with attributes is that you cannot use them where you need to have nested data within them. Lots of people have good but different opinions on what you should use attributes for: XML itself is neutral. (In general, if people have a logical divide in their data, they will often use attributes for one and data-in-elements for the other: for example, if your data can be divided into "formal" data and "textual" data you might use attributes for the "formal" data; or if your data is organized into "text" and "metadata" you might use attributes for the "metadata". ) The tradeoffs change for lots of different factors. For example, if you are sending short documents the document you suggested might be fine. If you are sending longer documents and you are using streaming tools (e.g. one that processes one row at a time), you may find the above better. Rick Jelliffe B.t.w., you might also find it convenient to use more expressive names than "Table" and "row". For example, "Staff" and "Person" or whatever. *************************************************************************** This is xml-dev, the mailing list for XML developers. To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev List archives are available at http://xml.org/archives/xml-dev/ ***************************************************************************
|
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
|