org.jhotdraw.xml
Class NanoXMLDOMInput
- java.lang.Object
-
- org.jhotdraw.xml.NanoXMLDOMInput
-
- All Implemented Interfaces:
- Disposable, DOMInput
public class NanoXMLDOMInput extends java.lang.Object implements DOMInput, Disposable
NanoXMLDOMInput.Design pattern:
Name: Adapter.
Role: Adapter.
Partners:XMLElementas Adaptee.
-
-
Constructor Summary
Constructors Constructor and Description NanoXMLDOMInput(DOMFactory factory, java.io.InputStream in)NanoXMLDOMInput(DOMFactory factory, java.io.Reader in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcloseElement()Closes the current element of the DOM Document.voiddispose()Disposes of all resources held by this object so that they can be garbage collected.booleangetAttribute(java.lang.String name, boolean defaultValue)Gets an attribute of the current element of the DOM Document.doublegetAttribute(java.lang.String name, double defaultValue)Gets an attribute of the current element of the DOM Document.intgetAttribute(java.lang.String name, int defaultValue)Gets an attribute of the current element of the DOM Document.java.lang.StringgetAttribute(java.lang.String name, java.lang.String defaultValue)Gets an attribute of the current element of the DOM Document.intgetElementCount()Returns the number of child elements of the current element.intgetElementCount(java.lang.String tagName)Returns the number of child elements with the specified tag name of the current element.java.util.List<java.lang.String>getInheritedAttribute(java.lang.String name)Gets an attribute of the current element of the DOM Document and of all parent DOM elements.java.lang.StringgetTagName()Returns the tag name of the current element.java.lang.StringgetText()Gets the text of the current element of the DOM Document.java.lang.StringgetText(java.lang.String defaultValue)Gets the text of the current element of the DOM Document.voidopenElement(int index)Opens the element with the specified index and makes it the current node.voidopenElement(java.lang.String tagName)Opens the last element with the specified name and makes it the current node.voidopenElement(java.lang.String tagName, int index)Opens the element with the specified name and index and makes it the current node.java.lang.ObjectreadObject()Reads an object from the current element.java.lang.ObjectreadObject(int index)Reads an object from the current element.
-
-
-
Constructor Detail
-
NanoXMLDOMInput
public NanoXMLDOMInput(DOMFactory factory, java.io.InputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
NanoXMLDOMInput
public NanoXMLDOMInput(DOMFactory factory, java.io.Reader in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getTagName
public java.lang.String getTagName()
Returns the tag name of the current element.- Specified by:
getTagNamein interfaceDOMInput
-
getAttribute
public java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)Gets an attribute of the current element of the DOM Document.- Specified by:
getAttributein interfaceDOMInput
-
getInheritedAttribute
public java.util.List<java.lang.String> getInheritedAttribute(java.lang.String name)
Gets an attribute of the current element of the DOM Document and of all parent DOM elements.- Specified by:
getInheritedAttributein interfaceDOMInput
-
getText
public java.lang.String getText()
Gets the text of the current element of the DOM Document.
-
getText
public java.lang.String getText(java.lang.String defaultValue)
Gets the text of the current element of the DOM Document.
-
getAttribute
public int getAttribute(java.lang.String name, int defaultValue)Gets an attribute of the current element of the DOM Document.- Specified by:
getAttributein interfaceDOMInput
-
getAttribute
public double getAttribute(java.lang.String name, double defaultValue)Gets an attribute of the current element of the DOM Document.- Specified by:
getAttributein interfaceDOMInput
-
getAttribute
public boolean getAttribute(java.lang.String name, boolean defaultValue)Gets an attribute of the current element of the DOM Document.- Specified by:
getAttributein interfaceDOMInput
-
getElementCount
public int getElementCount()
Returns the number of child elements of the current element.- Specified by:
getElementCountin interfaceDOMInput
-
getElementCount
public int getElementCount(java.lang.String tagName)
Returns the number of child elements with the specified tag name of the current element.- Specified by:
getElementCountin interfaceDOMInput
-
openElement
public void openElement(int index)
Opens the element with the specified index and makes it the current node.- Specified by:
openElementin interfaceDOMInput
-
openElement
public void openElement(java.lang.String tagName) throws java.io.IOExceptionOpens the last element with the specified name and makes it the current node.- Specified by:
openElementin interfaceDOMInput- Throws:
java.io.IOException
-
openElement
public void openElement(java.lang.String tagName, int index) throws java.io.IOExceptionOpens the element with the specified name and index and makes it the current node.- Specified by:
openElementin interfaceDOMInput- Throws:
java.io.IOException
-
closeElement
public void closeElement()
Closes the current element of the DOM Document. The parent of the current element becomes the current element.- Specified by:
closeElementin interfaceDOMInput- Throws:
java.lang.IllegalArgumentException- if the provided tagName does not match the tag name of the element.
-
readObject
public java.lang.Object readObject() throws java.io.IOExceptionReads an object from the current element.- Specified by:
readObjectin interfaceDOMInput- Throws:
java.io.IOException
-
readObject
public java.lang.Object readObject(int index) throws java.io.IOExceptionReads an object from the current element.- Specified by:
readObjectin interfaceDOMInput- Throws:
java.io.IOException
-
dispose
public void dispose()
Description copied from interface:DisposableDisposes of all resources held by this object so that they can be garbage collected.- Specified by:
disposein interfaceDisposable
-
-
DataMelt 3.0 © DataMelt by jWork.ORG