OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Challenge

[ Lists Home | Date Index | Thread Index ]

Didier PH Martin <martind@netfolder.com> 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...





 

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

Copyright 2001 XML.org. This site is hosted by OASIS