oheger 2004/12/23 10:43:00
Modified:configuration/xdocs howto_xml.xml
Log:
Updated howtos for XML configurations
Revision ChangesPath
1.7 +166 -43 jakarta-commons/configuration/xdocs/howto_xml.xml
Index: howto_xml.xml
===
RCS file: /home/cvs/jakarta-commons/configuration/xdocs/howto_xml.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- howto_xml.xml 22 Oct 2004 01:40:48 - 1.6
+++ howto_xml.xml 23 Dec 2004 18:43:00 - 1.7
@@ -10,15 +10,15 @@
body
section name=Using XML based Configurations
p
- This section explains how to use Hierarchical
- and Structured XML datasets.
+ This section explains how to use hierarchical
+ and structured XML datasets.
/p
/section
section name=Hierarchical properties
p
- The XML document we used in the section about composite
configuration was quite simple. Because of its
+ The XML document we used in the section about
ConfigurationFactory was quite simple. Because of its
tree-like nature XML documents can represent data that
is
structured in many ways. This section explains how to
deal with
such structured documents.
@@ -156,38 +156,13 @@
which table?
/p
p
- The answer is, with our actual approach we have
no chance to
- obtain this knowledge! If XML documents are
loaded this way,
- their exact structure is lost. Though all field
names are found
- and stored the information which field belongs
to which table
- is not saved. Fortunately Configuration
provides a way of
- dealing with structured XML documents. To
enable this feature
- the configuration definition file has to be
slightly altered.
- It becomes:
- /p
- source![CDATA[
-?xml version=1.0 encoding=ISO-8859-1 ?
-
-configuration
- properties fileName=usergui.properties/
- xml fileName=gui.xml/
- hierarchicalXml fileName=tables.xml/
-/configuration
-]]/source
- p
- Note that one codexml/code element was
replaced by a
- codehierarchicalXml/code element. This
element tells the configuration
- factory that not the default class for
processing XML documents
- should be used, but the class
codeHierarchicalXMLConfiguration/code.
- As the name implies this class is capable of
saving the
- hierarchy of XML documents thus keeping their
structure.
- /p
- p
- When working with such hierarchical properties
configuration keys
- used to query properties support an extended
syntax. All components
+ When working with such hierarchical structures
the configuration keys
+ used to query properties can have an extended
syntax. All components
of a key can be appended by a numerical value
in parentheses that
- determines the index of the affected property.
This is explained best
- by some examples:
+ determines the index of the affected property.
So if we have two
+ codetable/code elements we can exactly
specify, which one we
+ want to address by appending the corresponding
index. This is
+ explained best by some examples:
/p
p
We will now provide some configuration keys and
show the results
@@ -243,13 +218,161 @@
Because each configuration key can contain an
arbitrary number
of indices it is possible to navigate through
complex structures of
XML documents; each XML element can be uniquely
identified.
- So at the end of this section we can draw the
following facit:
- For simple XML documents that define only some
simple properties
- and do