com.programix.saxplus
Class SimpleTagHandler
java.lang.Object
com.programix.saxplus.BaseTagHandler
com.programix.saxplus.SimpleTagHandler
- All Implemented Interfaces:
- TagHandler
public class SimpleTagHandler
- extends BaseTagHandler
- implements TagHandler
Used to gather a single value from a tag--a very common case.
Used when a tag has either:
- one attribute and nothing else (empty element)
- just text content, zero attributes and zero sub tags
- Author:
- Paul Hyde
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleTagHandler
public SimpleTagHandler()
startTag
public void startTag(NameDetail tagName,
AttributeGroup attr)
- Specified by:
startTag in interface TagHandler- Overrides:
startTag in class BaseTagHandler
text
public void text(Value tagText)
- Description copied from interface:
TagHandler
- Delivers textual content within this tag. If this tag has no sub tags,
then this method is called at most once.
If this tag is empty or has no text
other than whitespace, this method is not called. If this tag has
sub tags and only whitespace between the sub tags, this method is not
called. If there is a mixture of (non-whitespace) text and sub tags,
this method is called multiple times.
For example:
<apple>
<excellent>Red Delicious</excellent>
<good>Granny Smith</good>
</apple>
<fresh value="yes" />
<mango>
</mango>
<story>They are <bold>very</bold> tasty.</story>
The text() method is called:
- exactly one time for excellent (no sub tags).
- never for apple (only sub tags and whitespace).
- never for fresh (empty element).
- never for mango (only whitespace).
- two times for story (once for "They are " and
a second time for " tasty." ["very" is passed to
the text() for the tag handler for bold, not for
story.]
- Specified by:
text in interface TagHandler- Overrides:
text in class BaseTagHandler
getResult
public Value getResult()
- Description copied from class:
BaseTagHandler
- This implementation returns
ValueFactory.NULL_INSTANCE. Overridden by subclasses as appropriate.
- Specified by:
getResult in interface TagHandler- Overrides:
getResult in class BaseTagHandler
- Returns:
- the value calculated, never null.
Copyright © 2001-2007
Programix Incorporated.
All rights reserved.
ProgramixGenericLib is free
and is
OSI Certified
Open Source Software under the BSD
license.