|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xins.common.xml.ElementBuilder
Builder for Element
instances.
This class is not thread-safe; it should not be used from different threads at the same time.
Constructor Summary | |
ElementBuilder()
Creates a new ElementBuilder . |
|
ElementBuilder(String localName)
Creates a new ElementBuilder . |
|
ElementBuilder(String namespaceURI,
String localName)
Creates a new ElementBuilder . |
Method Summary | |
void |
addChild(Element child)
Adds a new child element. |
void |
addXMLChild(String xmlChild)
Adds a new child element. |
Element |
createElement()
Creates the Element . |
void |
setAttribute(String localName,
String value)
Sets the specified attribute. |
void |
setAttribute(String namespaceURI,
String localName,
String value)
Sets the specified attribute. |
void |
setText(String text)
Sets the character content. |
void |
startElement(String localName)
Starts to create a new Element with the given local name. |
void |
startElement(String namespaceURI,
String localName)
Starts to create a new Element . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ElementBuilder()
ElementBuilder
.
public ElementBuilder(String localName) throws IllegalArgumentException
ElementBuilder
.
localName
- the local name of the element, cannot be null
.
IllegalArgumentException
- if localName == null
.public ElementBuilder(String namespaceURI, String localName) throws IllegalArgumentException
ElementBuilder
.
namespaceURI
- the namespace URI for the element, can be null
; an empty
string is equivalent to null
.localName
- the local name of the element, cannot be null
.
IllegalArgumentException
- if localName == null
.Method Detail |
public void setAttribute(String localName, String value) throws IllegalArgumentException
localName
- the local name for the attribute, cannot be null
.value
- the value for the attribute, can be null
.
IllegalArgumentException
- if localName == null
.public void setAttribute(String namespaceURI, String localName, String value) throws IllegalArgumentException
namespaceURI
- the namespace URI for the attribute, can be null
; an
empty string is equivalent to null
.localName
- the local name for the attribute, cannot be null
.value
- the value for the attribute, can be null
.
IllegalArgumentException
- if localName == null
.public void addChild(Element child) throws IllegalArgumentException
child
- the new child to add to this element, cannot be null
.
IllegalArgumentException
- if child == null || child == this
.public void addXMLChild(String xmlChild) throws ParseException, IllegalArgumentException
xmlChild
- the character string that contains the XML that defines the new
child to add to this element, cannot be null
.
ParseException
- if the String
passed as argument cannot be parsed.
IllegalArgumentException
- if child == null
.public void setText(String text)
text
- the character content for this element, or null
.public void startElement(String localName) throws IllegalArgumentException
Element
with the given local name.
localName
- the local name of the element, cannot be null
.
IllegalArgumentException
- if localName == null
.public void startElement(String namespaceURI, String localName) throws IllegalArgumentException
Element
.
namespaceURI
- the namespace URI for the element, can be null
; an empty
string is equivalent to null
.localName
- the local name of the element, cannot be null
.
IllegalArgumentException
- if localName == null
.public Element createElement()
Element
.
If you want to reuse this ElementBuilder
you will need
to call the startElement(String)
or
startElement(String,String)
method.
Element
, never null
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |