xml.parser.javacc
Class XmlScrubber
java.lang.Object
xml.parser.javacc.XmlVisitor
xml.parser.javacc.XmlScrubber
public class XmlScrubber
- extends XmlVisitor
XmlScrubber is a Visitor which walks an XmlDocument and cleans it up.
It can change tags and tag attributes to uppercase or lowercase, strip
out unnecessary quotes from attribute values, and strip trailing spaces
before a newline.
- Author:
- Brian Goetz, Quiotix
Additional contributions by: Thorsten Weber
|
Constructor Summary |
XmlScrubber()
Create an XmlScrubber with the default options (downcase tags and
tag attributes, strip out unnecessary quotes.) |
XmlScrubber(int flags)
Create an XmlScrubber with the desired set of options. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TAGS_UPCASE
public static final int TAGS_UPCASE
- See Also:
- Constant Field Values
TAGS_DOWNCASE
public static final int TAGS_DOWNCASE
- See Also:
- Constant Field Values
ATTR_UPCASE
public static final int ATTR_UPCASE
- See Also:
- Constant Field Values
ATTR_DOWNCASE
public static final int ATTR_DOWNCASE
- See Also:
- Constant Field Values
STRIP_QUOTES
public static final int STRIP_QUOTES
- See Also:
- Constant Field Values
TRIM_SPACES
public static final int TRIM_SPACES
- See Also:
- Constant Field Values
DEFAULT_OPTIONS
public static final int DEFAULT_OPTIONS
- See Also:
- Constant Field Values
flags
protected int flags
previousElement
protected XmlDocument.XmlElement previousElement
inPreBlock
protected boolean inPreBlock
XmlScrubber
public XmlScrubber()
- Create an XmlScrubber with the default options (downcase tags and
tag attributes, strip out unnecessary quotes.)
XmlScrubber
public XmlScrubber(int flags)
- Create an XmlScrubber with the desired set of options.
- Parameters:
flags - A bitmask representing the desired scrubbing options
start
public void start()
- Overrides:
start in class XmlVisitor
visit
public void visit(XmlDocument.Tag t)
- Overrides:
visit in class XmlVisitor
visit
public void visit(XmlDocument.EndTag t)
- Overrides:
visit in class XmlVisitor
visit
public void visit(XmlDocument.Text t)
- Overrides:
visit in class XmlVisitor
visit
public void visit(XmlDocument.Comment c)
- Overrides:
visit in class XmlVisitor
visit
public void visit(XmlDocument.Newline n)
- Overrides:
visit in class XmlVisitor
visit
public void visit(XmlDocument.Annotation a)
- Overrides:
visit in class XmlVisitor
visit
public void visit(XmlDocument.TagBlock bl)
- Overrides:
visit in class XmlVisitor