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

RE: Challenge


xml dom flatten
Didier PH Martin <martind@n...> writes:

> d) The trick now is to relate some of the HTML elements to 
> some of the XML element. Not easy, but I'll persevere.

I do this as follows:

1) Flatten the input XML using a 2nd transform so that there is no
hierarchy (the XML request fields are a flat collection).  This is
placed in an XML DOM but not presented.  (You can run any transform
against any URI/XML DOM without necessarily presenting the results.)

2) Walk this new DOM, getting the appropriate request attributes and
matching them against various validation templates as appropriate for
the original object type.  Eg; if I have <birthdate type="date" ...> I
build an <input name="birthdate"...> etc. and I subsequently validate as
appropriate.

I have code at home (this wasn't done for a work project), but there's a
small chance I might remember to send a copy here to work so I can post
an example for you...

The one thing that doesn't match up with your requirements is that I
return the flattened XML instead of once more matching the results up
against the original hierarchy. I wouldn't be too hard to run a third
transform to take the matched element/value pairs and put them in their
proper place...


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.