1
#########################################################################
2
# Copyright 2004 The Apache Software Foundation.
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
#########################################################################
19
The files in this directory are intended as an example of how to use
20
the Apache Digester to parse "document-markup" style xml. It also serves as an
21
example of how to subclass the main Digester class in order to extend
24
By "document-markup" xml, we mean input like XHTML, where the data is valid
25
xml and where some elements contain interleaved text and child elements.
27
For example, "<p>Hi, <i>this</i> is some <b>document-style</b> xml.</p>"
30
* how to subclass digester
31
* how to process markup-style xml.
33
== compiling and running
35
First rename the build.properties.sample file in the parent directory
36
to build.properties and edit it to suit your environment. Then in this
45
Alternatively, you can set up your CLASSPATH appropriately, and
46
run the example directly. See the build.properties and build.xml
51
The primary use of the Digester is to process xml configuration files.
52
Such files do not typically interleave text and child elements in the
53
style encountered with document markup. The standard Digester behaviour is
54
therefore to accumulate all text within an xml element's body (of which there is
55
expected to be only one "segment") and present it to a Rule or user method
58
While this significantly simplifies the implementation of Rule classes for
59
the primary Digester goal of parsing configuration files, this process of
60
simplifying all text within an element into a single string "loses" critical
61
information necessary to correctly parse "document-markup" xml.
63
This example shows one method of extending the Digester class to resolve
66
At some time the ability to process "document-markup" style xml may be built
67
into the standard Digester class.