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 23:01:13 UTC
[Lenya Wiki] Update of "WyonaWorkingWithXML" 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/WyonaWorkingWithXML
The comment on the change is:
obsolete
------------------------------------------------------------------------------
- '''NOTE:''' ''This docu should be migrated to the [:Lenya] doc'' -- ChristianEgli
+ deleted
- == Working with XML Documents ==
-
- The XML utility classes are:
-
- {{{
- import org.apache.lenya.xml.DocumentHelper;
- import org.apache.lenya.xml.NamespaceHelper;
- }}}
-
- === Creating a Document ===
-
- Use the following code to create a document with a given
- document element. A xmlns:svg="http://www.w3.org/2000/svg" attribute
- is added to the document element.
-
- {{{
- Document document = DocumentHelper.createDocument(
- "http://www.w3.org/2000/svg",
- "svg:svg",
- null); // no document type
- }}}
-
- === Reading a document from a file ===
-
- {{{
- File file = ...;
- Document document = DocumentHelper.readDocument(file);
- }}}
-
- === Writing a document from a file ===
-
- Use the following code to write a document to a
- file. The INDENT output property of the transformer is
- set to "yes".
-
- {{{
- Document document = ...;
- File file = ...;
- DocumentHelper.writeDocument(document, file);
- }}}
-
- == Working with Namespaces ==
-
- === Creating a !NamespaceHelper ===
-
- Create a namespace helper with a new document:
-
- {{{
- NamespaceHelper helper = new NamespaceHelper(
- "http://www.w3.org/2000/svg", // namespace URI
- "svg", // prefix
- "svg"); // local name of document element
- }}}
-
- Create a namespace helper for an existing document:
-
- {{{
- Document document = ...;
- NamespaceHelper helper = new NamespaceHelper(
- "http://www.w3.org/2000/svg", // namespace URI
- "svg", // prefix
- document); // document
- }}}
-
- === Creating Elements ===
-
- Create an empty element:
-
- {{{
- // create <svg:ellipse> element
- Element element = helper.createElement("ellipse");
- }}}
-
- Create an element containing a text node:
-
- {{{
- // create <svg:text>Hello World!</svg:text> element
- Element element = helper.createElement("text", "Hello World!");
- }}}
-
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org