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

RE: Lesson Learned: Use namespaces for both markupanddata

  • From: Amelia A Lewis <amyzing@talsever.com>
  • To: "Glidden, Douglass A" <Douglass.A.Glidden@boeing.com>
  • Date: Tue, 11 Aug 2009 18:35:21 -0400

RE:  Lesson Learned: Use namespaces for both markupanddata
Douglass,

I'm afraid that we may be talking somewhat at cross-purposes.

On Tue, 11 Aug 2009 17:44:19 -0400, Glidden, Douglass A wrote:
> In processing a large XML document, the cost of keeping track of the
> prefix-to-namespace mappings is fairly trivial (mid-stream redefinitions

True for structure.  Not true for content (because even if you know 
that the content may hold a QName, you don't know which mappings are 
significant, unless your parser actually looks at the content--at which 
point it's an application).

> The only time I can think of when the prefix mappings become non-trivial
> (and the one you seem to be alluding to when you talk about "copying"
> and "pasting") is when doing manual editing of raw XML data, which
> _should_ be a fringe case.

Any concatenation of fragments from arbitrary source locations (cf. 
XSLT document() function) has this issue.  Also true of XML APIs.  It 
isn't done very often--in part because QNames in content make it 
unsafe/unreliable.

> <example xmlns:aqr="http://www.aquarium.org"
> xmlns:atl="http://www.artillery.gov">
>   <aqr:tank>
>     <aqr:capacity>55</aqr:capacity>
>   </aqr:tank>
>   <atl:tank>
>     <atl:capacity>300</atl:capacity>
>   </atl:tank>
> </example>

This is where we're at cross-purposes.  This has no QNames in content.  
It has QNames in structure.  This is an example of good design.  The 
following:

> <example ...>
>   <tank xsi:type="Aquarium">
>     <capacity>55</capacity>
>   </tank>
>   <tank xsi:type="Artillery">
>     <capacity>300</capacity>
>   </tank>
> </example>

Also has no QNames in content.  I think it's horrid design, but then, I 
have Bad Things To Say™ about XML Schema, too.

This:

<example xmlns:doom="http://www.nuke.them.from.orbit" 
xmlns:a="http://www.aquarium.org">
  <object>
    <name>a:tank</name>
    <capacity>a:55</capacity>
  </object>
  <object>
    <name>doom:tank</name>
    <capacity>doom:300</capacity>
  </object>
</example>

Is perhaps closer to Roger's recommendation, and may also illustrate 
some of the problems.  I mean, if you're going to use QNames in 
content, why not encode the units as well?  Well, sort of encode the 
units; after all, <range>doom:40</range> has the obvious meaning of ... 
uh ...

Oh, yeah.  Bind "doom" to "http://www.aquarium.org", and 
<range>doom:40</range> means 40th parallel of latitude.  *Obviously*.

> I definitely don't agree with Roger's idea of using QNames in data,
> either, though-IMHO that dangerously mixes metadata with data.

This was really what the discussion was on about.  Your initial example 
is not "QNames in content", it's "good XML design with namespaces".

:-)

Amy!
-- 
Amelia A. Lewis                    amyzing {at} talsever.com
  "You go on.  You just go on.  There's nothing more to it, and there's
no trick to make it easier.  You just go on."
  "What do you find on the other side?  When you go on?"
  She shrugged.  "Your life again.  What else?"
		-- Harra Csurik and Miles Vorkosigan


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.