[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] basic xml philosophy question(s)
i'm not afraid of being a newbie and asking some basic questions. i really want to understand what is considered to be the best practices of just getting started. while i find the high-order discussions of data interchange and style sheet transformations to be interesting, they don't help me get my data off of the wire and into objects that i can manipulate. i want to know, i want to learn. feed my hunger. rjsjr --------------- preview questions --------------- do most of you out there use element-based or attribute-based xml? why? do most of you use event-based (sax, expat, etc) or dom parsers? why? do any of you use any additional parsing libraries to make your lives easier? which ones? why or why not? --------------- the meat --------------- is it better to use element-based xml documents where an element's "attributes" are expressed by sub-elements such as: <person> <lastName>bomb</lastName> <firstName>duh</firstName> </person> or attribute-based xml documents where an element's attributes are expressed as xml attributes such as: <person lastName="bomb" firstName="duh"/> the limited reading i have done seems to indicate that the element-based approach is "better" but that is primarily an impression and not based on anything more significant than all examples being element-based. however, writing automatic code generators that result in a class hierarchy that contains: person.getLastName(); is significantly easier in an attribute-based model. when attempting to generate code in an element-based model you would need to provide some sort of hint mechanism to let the code generator know that the last name should be easily accessible as an attribute from the person element instead of having to write person.getLastName().getElementValue(); this gets even trickier when trying to express a psuedo-inheritance in xml where a programmer "is a" person and a salesman also "is a" person (although many will debate whether a salesman really is a person or just a reptile in people skin we tend to represent them as people when doing data modeling). i don't want to have to worry about going through additional levels of indirection when getting the last name of a programmer via: prgrammer.getPerson().getLastName().getElementValue(); i just want to say programmer.getLastName(); what's the best way to do this? is this even a desireable goal? rjsjr *************************************************************************** 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
|