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

Fwd: Re: Re: Native XML Interfaces

  • From: Michael Sokolov <msokolov@safaribooksonline.com>
  • To: XML Developers List <xml-dev@lists.xml.org>
  • Date: Mon, 03 Jun 2013 14:21:25 -0400

Fwd: Re:  Re: Native XML Interfaces
... re-sending ... went off list by accident ...

On 6/3/13 7:12 AM, Andrew Welch wrote:

>  For example the dev is faced with the challenge of extracting the
>  <title>  and product/@id values from some xml.
>
>  They could:
>
>  - use xquery/xpath
>  - use xom/jdom
>  - use sax/stax
>
>  instead they use a tool to generate an xsd from the xml, then use a
>  binding tool to generate some classes, then use those generated
>  classes.
>
In many programming environments life is greatly simplified when there
is a native object that represents a document: whose properties are
drawn from the document and exposed directly via accessors like getID(),
getTitle(), etc.  While XPath provides a great tool for extracting
property values from an XML dom like jdom,xom,tinytree,etc, I think
there is still some utility in a generic framework for mapping XML to
objects when working in such an environment. I haven't used JAXB and its
ilk directly: in our practice, we ended up creating our own mapper that
relies on annotations and introspection and XPath to do its work.  I
will say this has been a major undertaking, but it is a core part of our
infrastructure, and people seem happy enough to let it do its job. From
a user's perspective it ends up looking like:

class Doc {
...
@XPath("/doc/@id")
public String getId() { return id; }

@XPath("/doc/metadata/title")
public String getTitle() { return title; }

}

for example, and then objects are created using something like:
Mapper.asObject(JDOM, Class)

I don't know if this sort of approach fits into your definition of
things to avoid, but if it does, I wonder how you deal with the problem
of creating "native" objects from XML documents?  Do you just not do
that and try to do all programming in XSLT/XQuery etc?

-Mike



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