You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Apache Wiki <wi...@apache.org> on 2005/05/14 22:51:55 UTC
[Lenya Wiki] Update of "WyonaHTMLFormEditor" by GregorRothfuss
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Lenya Wiki" for change notification.
The following page has been changed by GregorRothfuss:
http://wiki.apache.org/lenya/WyonaHTMLFormEditor
The comment on the change is:
obsolete
------------------------------------------------------------------------------
- Lenya's HTML Form Editor</title>
+ deleted
- <p>The Lenya HTML Form Editor allows to edit the content of XML files
- within the Web browser. It's only assumption is, that the browser
- understands HTML forms and <input> and <textarea>
- tags. Therefore it should be usable under any browser.</p>
-
- <p>The type of editor field to be used, as well as any options concerning
- the width and heigth, are declared in a descriptor file, accompanying the
- XML file to be edited. This descriptior file allows to declare the minimum
- and maximum number of XML-tags of the same name within the hierarchy.
- </p>
-
-
-
- <section><title>Example</title>
- <p>For example we have a "member" document "elvis.xml" of the form</p>
- <source><![CDATA[<?xmlversion="1.0"encoding="iso-8859-1"?><member><person><name>Presley</name><prename>Elvis</prename><birthday><year></year><month></month><day></day></birthday></person><curriculum>Breakinghearts,isoftenlonelyandlooksforlove.</curriculum><contact><address><street>!HeartbreakHotel</street><town>Graceland</town></address><emails><email>elvis@lenya.com</email><email>king@graceland.com</email><email>god@rnr.com</email></emails></contact></member>]]></source>
-
- <p>The corresponding <strong>edit descriptor</strong> has the form</p>
-
- <source><![CDATA[<?xmlversion="1.0"encoding="iso-8859-1"?><member><person><nameeditType="form"size="30"name="Name"/><prenameeditType="form"size="30"maxOccurs="5"name="Prename"/><birthday><yeareditType="form"/><montheditType="form"/><dayeditType="form"/></birthday></person><curriculumeditType="text"width="50"height="7"><contact><address><streeteditType="form"/><towneditType="form"/></address><emails><emaileditType="form"minOccurs="0"maxOccurs="unbounded"/></emails></contact></member>]]></source>
- <p>Comparing both files, we see that the edit descriptor is simply the
- "member" XML file with empty tags. The attributes declare how to XML-tags
- are to be edited, namely:</p>
-
- <table>
- <tr>
- <th>attribute</th>
- <th>possible values</th>
- <th>notes</th>
- </tr>
- <tr>
- <td>editType</td>
- <td>"text", "form", "show"</td>
- <td>default: nothing is shown</td>
- </tr>
- <tr>
- <td>minOccurs</td>
- <td>"0","1","2","3",...</td>
- <td>default if not given: 1</td>
- </tr>
- <tr>
- <td>maxOccurs</td>
- <td>"1","2","3",..., "unbounded"</td>
- <td>default if not given: 1</td>
- </tr>
- <tr>
- <td>name</td>
- <td>"any name you like"</td>
- <td>will be displayed instead of tag name</td>
- </tr>
- </table>
-
- <p>All other attributes are provided unchanged to the input field. One
- could say, that the edit-descriptor is some sort of XML-Schema or DTD. It
- should be straightforward to use a XML-Schema for the same purpose, if
- the appropriate editing keywords are added. </p>
-
- </section>
-
-
-
- <section><title>Inserting XHTML content</title>
- <p>Some input fields, namely those of type="text", allow the user to embed XHTML tags in their
- content, allowing them to influence the representation of the text somewhat, and to provide
- links to the page, in a relatively free style.</p>
- <p>This feature creates also the possibility of the user writing incorrect (non-XML) content, and
- thus endangering the stability of the application. To guard against this danger, the content of all
- input fields is checked for well-formedness, and an error message is displayed if there is
- incorrect markup embedded, while the content is not allowed to be saved.</p>
- <p>The check for well-formedness is executed from whithin !EditorMainAction.java, before the file gets
- saved, and checks the whole xml content of the file to be saved. This is probably overkill, and in
- a future iteration of the development, could be reduced to check only the fields that allow
- XHTML content. This could be done by ways of providing a method for checking the xml in a utility class,
- and calling it only when it is needed.</p>
- <p>Also, the check for well-formedness is implemented by means of the Cocoon API, and uses the parser
- that is defined as the parser for Cocoon, which makes it easy to change it (in the cocoon.xconf). However,
- the Cocoon API does not provide means to get very specific messages as to what the error is, and where it
- is located in the source document, as it throws a org.xml.sax.SAXException, instead of a
- org.xml.sax.SAX!ParseException, which would provide more information. This might change in the future,
- but until then, only a generic error message can be displayed to the user, which is, at the moment, hardcoded
- in the stylesheet body.xsl, and is displayed on top of the edit page. This problem could be somewhat
- defused by parsing element-wise, as decribed in the previous paragraph, and providing the error message
- located together with the element causing the problem.</p>
- </section>
-
-
-
- <section><title>How it works</title>
- <p> The editor relies on a series of pipes and actions defined in the
- <code>html-form-editor.xmap</code> sitemap.</p>
- </section>
- <section><title>Required Files</title>
- <ol>
- <li>Open Document
- <ol>
- <li>stylesheets/lenya/edit/htmlform/numberTags.xsl (Sitemap)</li>
- <li>stylesheets/lenya/edit/htmlform/makeEditML.xsl (Sitemap)</li>
- <li>stylesheets/lenya/edit/htmlform/performRequest.xsl (!EditorAction and Sitemap)</li>
- <li>stylesheets/lenya/edit/htmlform/translateRequest.xsl (!EditorAction and Sitemap)</li>
- <li>stylesheets/lenya/edit/editdescriptor/"!RootElementName"-descriptor.xml (!EditorAction and XSLT)</li>
- <li>stylesheets/lenya/Edit/root.xsl (xsl:include)</li>
- <li>stylesheets/lenya/Edit/body.xsl (xsl:include)</li>
- <li>xslt/"!DoctypeName"/Edit/main.xsl (Sitemap)</li>
- </ol>
- </li>
- <li>Edit Document
- <ol>
- <li/>
- </ol>
- </li>
- <li>Save Document
- <ol>
- <li/>
- </ol>
- </li>
- </ol>
- </section>
-
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org