Let me explain the idea a little bit more:

I created an XSLT that generates an XForms from any XML document instance, just 
allowing the user to paste the XML code in the page an clicking a button to run 
the transform. An "almost finished" version can be found in 
http://www.xmlstairways.com/xforms.xq

The page is actually built with plain javascript, but I believe it's a shame to 
create an XForms Generator but no using XForms itself.

I want to create an XForms version that stores the source XML instance and the 
resulting XForms as xf:instances, like this: 
http://www.xmlstairways.com/xfgen.xq

TinyMCE could help, but the problem of converting from its content to an XML 
instance still remains.

The processing should be totally client side, although I tried to do it server 
side with eXist-db but unsuccessfully.

I don't see another scenario where parsing XML from a control could be useful, 
so I understand this could be hard to achieve.

Thanks again


-          Bill
De: Dan McCreary [mailto:[email protected]]
Enviado el: lunes, 21 de octubre de 2013 15:29
Para: William Velasquez
CC: [email protected]
Asunto: Re: [Xsltforms-support] Parsing XML from textarea

Hello William,

>From what I understand of how XSLTForms works, you can only store "escaped" 
>XML within any textarea control.  Most of the rich text editors then make the 
>text look like HTML or XML, but within the browser DOM the text is stored in a 
>single string.

When you do a "save" you can then use the parse() function on the server side 
to convert the escaped string into XML and transform it.

I think that Alain has a nice example of the powerful TinyMCE editor here:

http://www.agencexml.com/xsltforms/tinymce.xml

You might be able to configure TinyMCE to work like much an XML editor.

See http://www.tinymce.com/

Claudius Teodorescu has quite a bit of experience doing in-browser XML editing 
using DocBook and TEI using the TEI-Ann product.

http://teian.sourceforge.net/

- Dan

On Mon, Oct 21, 2013 at 12:24 PM, William Velasquez 
<[email protected]<mailto:[email protected]>> 
wrote:
Hi everybody,

I'm building an XForms where the user could be able to paste XML code in a 
textarea and then apply an XSL transformation to the pasted code.

In order to be able to do it, I tried two alternatives with no success:


1.       Parse the XML code and store it in an instance (there is no function 
to parse xml text to instances)

2.       Directly apply the transformation to the XML code and store the result 
in an instance (the transform() function only accepts nodes as input, not plain 
text.

The missing piece is how to parse the content of the textarea. XPath 3.0 
defines serialize()to convert an instance to text and  parse-xml() to do the 
reverse process.

XSLTForms implements the serialize() function, but the parse-xml() is not 
available.

Some body knows a shortcut to do this?

Thanks in advance,


William David Velásquez
Director de Investigación y Desarrollo
Visión Tecnológica S.A.S.
www.visiontecnologica.com<http://www.visiontecnologica.com>
Follow me @williamda

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Xsltforms-support mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/xsltforms-support



--
Dan McCreary
http://danmccreary.com
Co-author: Making Sense of NoSQL<http://manning.com/mccreary>
office: (952) 931-9198
cell: (612) 986-1552
skype: dmccreary47
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to