|
|||||||||
| Home >> All >> org >> apache >> lenya >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.lenya.xml
Class NamespaceHelper

java.lang.Objectorg.apache.lenya.xml.NamespaceHelper
- public class NamespaceHelper
- extends java.lang.Object
A NamespaceHelper object simplifies the creation of elements in a certain
namespace. All elements are owned by a document that is passed to the
#NamespaceHelper(Document, String, String) constructor or created
using the NamespaceHelper(String, String, String) 55 constructor.
| Field Summary | |
private org.w3c.dom.Document |
document
|
private java.lang.String |
namespaceUri
|
private java.lang.String |
prefix
|
| Constructor Summary | |
NamespaceHelper(java.lang.String namespaceUri,
java.lang.String prefix,
org.w3c.dom.Document document)
Creates a new instance of NamespaceHelper using an existing document. |
|
NamespaceHelper(java.lang.String namespaceUri,
java.lang.String prefix,
java.lang.String localName)
Creates a new instance of NamespaceHelper. |
|
| Method Summary | |
org.w3c.dom.Element |
createElement(java.lang.String localName)
Creates an element within the namespace of this NamespaceHelper object with a given local name containing a text node. |
org.w3c.dom.Element |
createElement(java.lang.String localName,
java.lang.String text)
Creates an element within the namespace of this NamespaceHelper object with a given local name containing a text node. |
org.w3c.dom.Element[] |
getChildren(org.w3c.dom.Element element)
Returns all children of an element in the namespace of this NamespaceHelper. |
org.w3c.dom.Element[] |
getChildren(org.w3c.dom.Element element,
java.lang.String localName)
Returns all children of an element with a local name in the namespace of this NamespaceHelper. |
org.w3c.dom.Document |
getDocument()
Returns the document that is used to create elements. |
org.w3c.dom.Element |
getFirstChild(org.w3c.dom.Element element,
java.lang.String localName)
Returns the first childr of an element with a local name in the namespace of this NamespaceHelper or null if none exists. |
java.lang.String |
getNamespaceURI()
Returns the namespace URI of this NamespaceHelper. |
org.w3c.dom.Element[] |
getNextSiblings(org.w3c.dom.Element element,
java.lang.String localName)
Returns the next siblings of an element with a local name in the namespace of this NamespaceHelper or null if none exists. |
java.lang.String |
getPrefix()
Returns the namespace prefix that is used to create elements. |
java.lang.String |
getQualifiedName(java.lang.String localName)
Returns the qualified name for a local name using the prefix of this NamespaceHelper. |
protected void |
setDocument(org.w3c.dom.Document document)
Sets the document of this NamespaceHelper. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
namespaceUri
private java.lang.String namespaceUri
prefix
private java.lang.String prefix
document
private org.w3c.dom.Document document
| Constructor Detail |
NamespaceHelper
public NamespaceHelper(java.lang.String namespaceUri, java.lang.String prefix, org.w3c.dom.Document document)
- Creates a new instance of NamespaceHelper using an existing document. The
document is not affected. If you omit the prefix, the default namespace is used.
NamespaceHelper
public NamespaceHelper(java.lang.String namespaceUri, java.lang.String prefix, java.lang.String localName) throws javax.xml.parsers.ParserConfigurationException
Creates a new instance of NamespaceHelper. A new document is created using a document element in the given namespace with the given prefix. If you omit the prefix, the default namespace is used.
NamespaceHelper("http://www.w3.org/2000/svg", "svg", "svg"):
<?xml version="1.0">
<svg:svg xmlns:svg="http://www.w3.org/2000/svg">
</svg:svg>
| Method Detail |
setDocument
protected void setDocument(org.w3c.dom.Document document)
- Sets the document of this NamespaceHelper.
getDocument
public org.w3c.dom.Document getDocument()
- Returns the document that is used to create elements.
getNamespaceURI
public java.lang.String getNamespaceURI()
- Returns the namespace URI of this NamespaceHelper.
getPrefix
public java.lang.String getPrefix()
- Returns the namespace prefix that is used to create elements.
getQualifiedName
public java.lang.String getQualifiedName(java.lang.String localName)
- Returns the qualified name for a local name using the prefix of this
NamespaceHelper.
createElement
public org.w3c.dom.Element createElement(java.lang.String localName)
Creates an element within the namespace of this NamespaceHelper object with a given local name containing a text node.
createElement("text"):<prefix:text/>.
createElement
public org.w3c.dom.Element createElement(java.lang.String localName, java.lang.String text)
Creates an element within the namespace of this NamespaceHelper object with a given local name containing a text node.
createElement("text", "Hello World!"):<prefix:text>Hello World!</prefix:text>.
getChildren
public org.w3c.dom.Element[] getChildren(org.w3c.dom.Element element)
- Returns all children of an element in the namespace
of this NamespaceHelper.
getChildren
public org.w3c.dom.Element[] getChildren(org.w3c.dom.Element element, java.lang.String localName)
- Returns all children of an element with a local name in the namespace
of this NamespaceHelper.
getFirstChild
public org.w3c.dom.Element getFirstChild(org.w3c.dom.Element element, java.lang.String localName)
- Returns the first childr of an element with a local name in the namespace
of this NamespaceHelper or
nullif none exists.
getNextSiblings
public org.w3c.dom.Element[] getNextSiblings(org.w3c.dom.Element element, java.lang.String localName)
- Returns the next siblings of an element with a local name in the namespace
of this NamespaceHelper or
nullif none exists.
|
|||||||||
| Home >> All >> org >> apache >> lenya >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.lenya.xml.NamespaceHelper