XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] When the required output data can't be produced with atool, does it indicate the XML document is poorly designed or a new tool is needed?

> 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, '
')


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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS