public class SimpleTranslator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SimpleTranslator.AttributeEntry
An attribute key-value pair.
|
static class |
SimpleTranslator.Tag
A simple xml tag with a local name and attribute key-value pairs.
|
Constructor and Description |
---|
SimpleTranslator() |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(SimpleTranslator.Tag tag)
Add a description of a tag to be filtered on a subsequent call to
translate(InputStream, OutputStream) . |
void |
addNewTag(String parentName,
SimpleTranslator.Tag tag)
Add a description for a new tag to be added on a subsequent call to
translate(InputStream, OutputStream) . |
void |
translate(InputStream in,
OutputStream out)
Copy an xml file, removing any xml tags matching those provided with
addFilter(Tag) and adding any tags to provided
with addNewTag(String, Tag) . |
public void translate(InputStream in, OutputStream out) throws XMLStreamException
addFilter(Tag)
and adding any tags to provided
with addNewTag(String, Tag)
.in
- A stream to an xml file.out
- A stream to an empty file.XMLStreamException
public void addFilter(SimpleTranslator.Tag tag)
translate(InputStream, OutputStream)
. tagA
filters out tagB
if both tags have the same name (ignoring
namespaces) and the set of attribute key-value pairs in tagB
is a
superset of those in tagA
.tag
- The tag description to be filtered.public void addNewTag(String parentName, SimpleTranslator.Tag tag)
translate(InputStream, OutputStream)
. This tag
will be added a child of any tag with given parent name (ignoring
namespaces).parentName
- The name (ignoring namespaces) of a parent element, under which to
insert a new tag.tag
- The new tag to be inserted.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.