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

RE: Create XML

  • To: "Mayne, Peter" <PeterMayne@a...>,<xml-dev@l...>
  • Subject: RE: Create XML
  • From: "Robert DiFalco" <rdifalco@t...>
  • Date: Thu, 12 Jun 2003 17:20:10 -0700
  • Thread-index: AcMxPLwW3XDKdz5YT8uY927sjCWGuwABJH4g
  • Thread-topic: Create XML

how to create xml
How do most people feel about imposing a sibling element order
significance? Consider the following:

<Person>
   <FirstName>William</FirstName>
   <LastName>Burroughs</LastName>
   <Occupation>Author</Occupation>
</Person>

In truth, the order of the elements under Person does not impact the
semantic of a Person. A Person is complete if all items exist and we do
not need to know the Name before the Occupation and so on. The child
elements make up a set that does not require order but may require
completeness. 

However, it seems harder to write parsers that process elements in a
random ordering. So often, an arbitrary order is imposed (presumably) to
make parsing easier. 

Being relatively new to XML, I am curious as to what the current thought
is on this? Do most people impose an ordering or do they write their
parser code to handle any order the elements may appear in.

Of course, this isn't a big deal if my program is producing and
consuming the XML. However, if I am consuming a document that a user
produced, why should I force them to put FirstName, LastName, and
Occupation into a particular order? A Person is still a Person if they
appear as LastName, Occupation, and FirstName.

Thoughts for an XML newbie to chew on? Is there a best practice for
this?

R.

-----Original Message-----
From: Mayne, Peter [mailto:PeterMayne@a...] 
Sent: Thursday, June 12, 2003 4:44 PM
To: xml-dev@l...
Subject: RE:  Create XML


> -----Original Message----- 
> From: Emmanuil Batsis (Manos) [mailto:mbatsis@n...] 
> Sent: Friday, 13 June 2003 1:42 AM 
> To: Mehmet AVSAR; xml-dev@l... 
> Subject: Re:  Create XML 
> 
> 
> You should use an XML API to create/manipulate XML documents 
> instead of raw string manipulation. 
Why? No, seriously. 
For small/simple XML documents such as the OP's, I tend to use a for
loop and a few print statements (mod your favourite language) rather
than dragging in XML libraries and adding more complicated code.
An obvious argument for using an XML API is the guarantee (?) of correct
XML at the end. But for simple XML, it's not hard to do it with a string
and a loop (or a string template and a replace) and get the same result.
I'm certainly not advocating that using XML APIs to create documents is
stupid, but surely there's a crossover point where the simplicity of the
result doesn't justify the added complexity of an XML API compared to
just building a string?
Or have I just committed heresy? :-) 
PJDM 
-- 
Peter Mayne 
Technology Consultant 
Spherion Technology Solutions 
Level 1, 243 Northbourne Avenue, Lyneham, ACT, 2602 
T: 61 2 62689727  F: 61 2 62689777 
The information contained in this email and any attachments to it:

(a) may be confidential and if you are not the intended recipient, any
interference with, 
use, disclosure or copying of this material is unauthorised and
prohibited; and

(b) may contain personal information of the recipient and/or the sender
as defined 
under the Privacy Act 1988 (Cth). Consent is hereby given by the
recipient(s) to 
collect, hold and use such information and any personal information
contained in a 
response to this email, for any reasonable purpose in the ordinary
course of 
Spherion's 
business, including forwarding this email internally or disclosing it to
a third party. All 
personal information collected by Spherion will be handled in accordance
with 
Spherion's Privacy Policy. If you have received this email in error,
please notify the 
sender and delete it.

(c) you agree not to employ or arrange employment for any candidate(s)
supplied in 
this email and any attachments without first entering into a contractual
agreement with 
Spherion. You further agree not to divulge any information contained in
this document 
to any person(s) or entities without the express permission of Spherion.

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.