| 
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.apache.lenya.xml.NamespaceHelper
public class NamespaceHelper
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) constructor.
| 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 | 
| Constructor Detail | 
|---|
public NamespaceHelper(java.lang.String namespaceUri,
                       java.lang.String prefix,
                       org.w3c.dom.Document document)
document - The document.namespaceUri - The namespace URI.prefix - The namespace prefix.
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>
 
localName - The local name of the document element.namespaceUri - The namespace URI.prefix - The namespace prefix.
javax.xml.parsers.ParserConfigurationException - if an error occured| Method Detail | 
|---|
protected void setDocument(org.w3c.dom.Document document)
document - the documentpublic org.w3c.dom.Document getDocument()
public java.lang.String getNamespaceURI()
public java.lang.String getPrefix()
public java.lang.String getQualifiedName(java.lang.String localName)
localName - The local name.
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/>.
 
localName - The local name of the element.
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>.
 
localName - The local name of the element.text - The text for the text node inside the element.
public org.w3c.dom.Element[] getChildren(org.w3c.dom.Element element)
element - The parent element.
public org.w3c.dom.Element[] getChildren(org.w3c.dom.Element element,
                                         java.lang.String localName)
element - The parent element.localName - The local name of the children to return.
public org.w3c.dom.Element getFirstChild(org.w3c.dom.Element element,
                                         java.lang.String localName)
null if none exists.
element - The parent element.localName - The local name of the children to return.
public org.w3c.dom.Element[] getNextSiblings(org.w3c.dom.Element element,
                                             java.lang.String localName)
null if none exists.
element - The parent element.localName - The local name of the children to return.
  | 
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||