[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

basic xml philosophy question(s)

  • From: "rsanford" <rsanford@n...>
  • To: <xml-dev@x...>
  • Date: Thu, 15 Jun 2000 16:16:17 -0500

philosophy question
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.