|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.googlecode.jinahya.el.ElementLocator<D>
D - document type parameterpublic abstract class ElementLocator<D>
Abstract element locator.
| Constructor Summary | |
|---|---|
protected |
ElementLocator(ELElement root)
Creates a new instance. |
| Method Summary | |
|---|---|
ElementLocator<D> |
addChild(String localName)
Adds a child element whose name is localName with
no namespace and locate it. |
ElementLocator<D> |
addChild(String namespaceURI,
String localName)
Adds a child element whose name is localName with given
namespaceURI and locate it. |
String |
getAttribute(String localName)
Returns attribute value. |
String |
getAttribute(String namespaceURI,
String localName)
Returns the value of attribute which has name in
space. |
int |
getChildCount(String localName)
Returns the number of child elements with given localName
with no namespace. |
int |
getChildCount(String namespaceURI,
String localName)
Returns the number of child elements of currently located element with the specified local name and name space URI. |
protected ELElement |
getCurrent()
Returns currently located element. |
String |
getText()
Returns text value of current element. |
String |
getText(boolean parent)
Returns text value of current element and locate parent if specified. |
ElementLocator<D> |
locateChild(String localName,
int index)
Locates child element which has given localName with no
namespace at index. |
ElementLocator<D> |
locateChild(String namespaceURI,
String localName,
int index)
Locate a child with localName at index in
namespaceURI. |
ElementLocator<D> |
locateParent()
Locate to the parent of the current element. |
ElementLocator<D> |
locateRoot()
Locate the root. |
void |
print(D document)
Prints contents to given document. |
protected abstract void |
print(ELElement root,
D document,
Map<String,String> namespaceMap)
Prints given root to specified document. |
void |
removeCurrent()
Removes current element and locate parent. |
ElementLocator<D> |
setAttribute(String localName,
String value)
Sets attribute value. |
ElementLocator<D> |
setAttribute(String namespaceURI,
String localName,
String value)
Sets the value of attribute which has localName in
namespaceURI. |
ElementLocator<D> |
setText(String text)
Remove all child elements and add given text value to the
current element. |
ElementLocator<D> |
setText(String text,
boolean parent)
Remove all child elements and add given text value to the
current element and locate parent if specified. |
String |
toJSON()
Returns JSOM representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ElementLocator(ELElement root)
root - root element| Method Detail |
|---|
public final int getChildCount(String localName)
localName
with no namespace.
localName - local name
public final int getChildCount(String namespaceURI,
String localName)
namespaceURI - The name space URI.localName - The local name.
#getCount(String)public final ElementLocator<D> locateRoot()
public final ElementLocator<D> locateParent()
public final ElementLocator<D> locateChild(String localName,
int index)
localName with no
namespace at index.
localName - local nameindex - index
public final ElementLocator<D> locateChild(String namespaceURI,
String localName,
int index)
localName at index in
namespaceURI.
namespaceURI - element's name space URIlocalName - element's local nameindex - target index to locate
locateChild(String, int)public final ElementLocator<D> addChild(String localName)
localName with
no namespace and locate it.
localName - local name
public final ElementLocator<D> addChild(String namespaceURI,
String localName)
localName with given
namespaceURI and locate it.
namespaceURI - localName -
public final String getText()
public final String getText(boolean parent)
parent - flag for locating parent.
public final ElementLocator<D> setText(String text)
text value to the
current element.
text - text value; may be null
public final ElementLocator<D> setText(String text,
boolean parent)
text value to the
current element and locate parent if specified.
text - text value; may be nullparent - flag for locating parent
public final String getAttribute(String localName)
localName - attribute's local name
public final String getAttribute(String namespaceURI,
String localName)
name in
space.
namespaceURI - attribute's name space URIlocalName - attribute's local name
public final ElementLocator<D> setAttribute(String localName,
String value)
localName - local namevalue - attribute value
public final ElementLocator<D> setAttribute(String namespaceURI,
String localName,
String value)
localName in
namespaceURI.
namespaceURI - attribute's name space URIlocalName - attribute's local namevalue - attribute's value
public final void print(D document)
document.
document - output document
protected abstract void print(ELElement root,
D document,
Map<String,String> namespaceMap)
root to specified document.
root - root elementdocument - target documentnamespaceMap - provided namespace URI/prefix mappublic final void removeCurrent()
IllegalStateException will be thrown if currently on the
root.
protected final ELElement getCurrent()
public final String toJSON()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||