[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

parse form data to XML

Jesse Wu jesse.wu68 at gmail.com
Wed Sep 9 10:32:05 PDT 2009


  parse form data to XML
Hi Sedov,

I tried XForms but found when the XML model is loaded from a very
large file with many attributes (vary for each element) for each of
the element, the screen editing is not practical. May be there is a
better way to do this using XForms but I could not find a good
example.

Thanks -Jes

On Wed, Sep 9, 2009 at 12:30 AM, Vyacheslav Sedov
<http://x-query.com/mailman/listinfo/talk> wrote:
> what about XRX? XForms-REST-XQuery
>
> On Wed, Sep 9, 2009 at 3:06 AM, Martin Probst<http://x-query.com/mailman/listinfo/talk> wrote:
>>>    {for $parsed-query-term in $parsed-data
>>>               let $parse-query-value := substring-after($parsed-query-term,"=")
>>>               return <row attr="{???}">{xmldb:decode($parse-query-value)}</row>
>>>               }
>>
>> What about
>>
>> for $parsed-query-term in $parsed-data
>> let $parse-query-value := substring-after($parsed-query-term,"=")
>> let $parameter-name := substring-before($parsed-query-term,
>> concat("=", $parse-query-value))
>> return <row attr="{$parameter-name}">{xmldb:decode($parse-query-value)}</row>
>>
>> Alternatively you can simply split again:
>>
>> for $parsed-query-term in $parsed-data
>> let $kv := tokenize($parsed-query-term, '=')
>> let $key := $kv[1]
>> let $value := string-join($kv[position()>1],'=')
>> return <row attr="{$key}">{xmldb:decode($value)}</row>
>>
>> As the value might contain '=' (I think, or does that need to be
>> percent encoded?), $kv might contain multiple value parts, so the
>> string-join is necessary to glue them together again.
>>
>> Martin
>>
>> _______________________________________________
>> http://x-query.com/mailman/listinfo/talk
>> http://x-query.com/mailman/listinfo/talk
>>
>



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