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

Re: When the required output data can't be produced with atool

  • From: Dimitre Novatchev <dnovatchev@gmail.com>
  • To: "Costello, Roger L." <costello@mitre.org>, xml-dev@l...
  • Date: Fri, 24 Sep 2010 09:38:39 -0700

Re:  When the required output data can't be produced with atool
> Is the problem that my colleague is having indicative of a poorly designed XML document or indicative of a poor selection of tool?

The design isn't poor.

Here is an example of a simple XPath 2.0 expression that produces the
wanted result:

/*/*/book[author='Paul McCartney']/concat(../genre, '&#xA;')


I wouldn't say that the problem indicates "poor selection of tool",
because XPath 1.0 and XPath 2,0 are not just tools.

XPath 2.0 has a richer data model.

So, if I am trying to do fancy things and I'm not a masochist (or am
not especially paid not to use it), I will be using the richer
language.


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play




On Fri, Sep 24, 2010 at 6:38 AM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> A couple days ago a colleague brought the following problem to me.
>
> She has this XML document:
>
> <books>
>    <category>
>        <genre>Autobiography</genre>
>        <book>
>            <name>My Life and Times</name>
>            <author>Paul McCartney</author>
>        </book>
>        <book>
>            <name>The Beatles</name>
>            <author>Paul McCartney</author>
>        </book>
>    </category>
>    <category>
>        <genre>Music</genre>
>        <book>
>            <name>Eight Days a Week</name>
>            <author>Paul McCartney</author>
>        </book>
>    </category>
> </books>
>
> She is using XPath 1.0 to process the XML document (collect some data).
>
> She has written multiple XPath expressions to collect various data from the XML document. She was able to successfully construct XPath expressions to create collect all the desired data, except for one.
>
> Here's the data she was unable to collect using XPath 1.0: Select the value of <genre> for each <book> with <author> equal to 'Paul McCartney'. She needs an XPath 1.0 expression that will yield:
>
>    Autobiography
>    Autobiography
>    Music
>
> As it turns out, there is no XPath 1.0 expression that can be written to return the desired results. (I confirmed this with the XPath gurus on the xsl-list)
>
>
> What should she do?
>
>
> Let's summarize the situation: Here are the components comprising the situation:
>
> 1. DATA: The XML document
>
> 2. PROCESSING TOOL: A tool to process the XML document: XPath 1.0
>
> 3. RESULTS: Desired (required) results
>
>
> I see 3 possible courses of action that my colleague could take:
>
> a. Restructure the DATA so that the PROCESSING TOOL can generate the desired/required RESULTS. In other words, restructure the XML document so that an XPath 1.0 expression can be written that produces the desired/required results.
>
> b. Use a different PROCESSING tool. Instead of using XPath 1.0 switch to, say, XPath 2.0.
>
> c. Change the requirements on the RESULTS. Live with whatever XPath 1.0 can do.
>
>
> Let's suppose (c) is not acceptable because the requirements are fixed. That leaves us with (a) and (b) -- restructure the XML document or change from XPath 1.0 to something else.
>
> Here is an argument supporting (a):
>
>    I believe what this problem illustrates is that the XML document
>    is not well designed. That is, it does not support the kinds of
>    operations that are required. I believe that a redesign of the
>    XML document is in order.
>
> Here is an argument supporting (b):
>
>    I believe what this problem illustrates is that the tool you are
>    using (XPath 1.0) is not suitable for the tasks you need to perform.
>
>
> QUESTION
>
> Is the problem that my colleague is having indicative of a poorly designed XML document or indicative of a poor selection of tool?
>
>
> /Roger
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>


[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.