[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is DOM vs SAX a red herring?



There is no general rule that attributes be used "primarily as modifiers:"

http://xml.coverpages.org/elementsAndAttrs.html

[March 19, 2002] "Elements versus Attributes." By Gunther Stuhec (SAP). 18-March-2002. 17 pages. Published as one of four papers in "UBL NDR Position Papers." By Members of the UBL Naming and Design Rules Subcommittee (NDR SC). 16-March-2002. "A common cause of confusion, or at least uncertainty, in the design of a schemas is the choice between specifying parts of the document as elements or attributes... Elements are logical units of information in a schema. They represent information objects... Attributes are atomic, referentially transparent characteristics of an object that have no identity of their own.


Just so!

Use elements for Objects.  Things such as "interface" or "area."
Use attributes for atomic things, such as the attributes of an object:  "hello-interval", "name", ...


Larry



Scott Lawrence wrote:
Karl Auerbach <karl@cavebear.com> writes:

  
From my experience with doing SNMP set operations, the major job of the
agent is to gather all the pieces of the proposed configuration change
together and do a consistency analysis.  That kind of testing can easily
be the largest part of the agent in a managed device.

If one is doing that kind of evaluation of the proposed configuration data
- and I suggest that any device that doesn't do it is taking quite a risk
- then there will be a time when most of the proposed configuration data
is going to have to be simultaneously resident in memory.

It seems to me, therefore, that I am going to be paying the memory price
of a DOM-like data tree even if I use SAX.
    

But by that time, you've been able to convert the text of the XML into
an internal and much more compact form - you don't need to keep the
full text around.  In order to resolve the namespaces correctly, you
need the full text (at least up to the end of the start/empty
element.  

The general rule of using attributes primarily as modifiers has
proven to be a good one even in traditional document production
applications.  But as others have said, it's advice to the unwary, not
a hard and fast rule.

  

-- 
Larry Menten               Lucent Technologies/Bell Laboratories
Phone: 908 582-4467        600 Mountain Avenue, Murray Hill, NJ  07974 USA