|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XmlCursor
Represents a position between two logical tokens in an XML document.
The tokens themselves are not exposed as objects, but their type and properties
are discoverable through methods on the cursor. In particular, the general
category of token is represented by a TokenType
.
You use an XmlCursor instance to navigate through and manipulate an XML
instance document.
Once you obtain an XML document, you can create a cursor to represent
a specific place in the XML. Because you can use a cursor with or
without a schema corresponding to the XML, cursors are an ideal
way to handle XML without a schema. You can create a new cursor by
calling the newCursor
method
exposed by an object representing
the XML, whether it was parsed into a strong type compiled from
schema or an XmlObject
(as in the no-schema case).
With an XmlCursor, you can also:
TokenType
class. <sample x='y'> <value>foo</value> </sample>STARTDOC
currentTokenType()
method
will return the type of the token that is immediately after the cursor.
You can also use a number of convenience methods that test for a particular
token type. These include the methods isStart(),
isStartdoc(), isText(), isAttr(), and so on. Each returns a boolean
value indicating whether the token that follows the cursor is the type
in question.
<doc> ::= STARTDOC <attributes> <content> ENDDOC <element> ::= START <attributes> <content> END <attributes> ::= ( ATTR | NAMESPACE ) * <content> ::= ( COMMENT | PROCINST | TEXT | <element> ) *Note that a legitimate sequence is STARTDOC ENDDOC, the result of creating a brand new instance of an empty document. Also note that attributes may only follow container tokens (STARTDOC or START)
Nested Class Summary | |
---|---|
static interface |
XmlCursor.ChangeStamp
Represents the state of a dcoument at a particular point in time. |
static class |
XmlCursor.TokenType
An enumeration that identifies the type of an XML token. |
static class |
XmlCursor.XmlBookmark
Subclasses of XmlBookmark can be used to annotate an XML document. |
static interface |
XmlCursor.XmlMark
An abstract XmlCursor factory. |
Method Summary | |
---|---|
void |
addToSelection()
Appends the current location of the cursor to the selection. |
void |
beginElement(javax.xml.namespace.QName name)
Inserts a new element around this cursor, giving the element the specified qualified name. |
void |
beginElement(java.lang.String localName)
Inserts a new element around this cursor, giving the element the specified local name. |
void |
beginElement(java.lang.String localName,
java.lang.String uri)
Inserts a new element around this cursor, giving the element the specified local name and associating it with the specified namespace. |
void |
clearBookmark(java.lang.Object key)
Clears the bookmark whose key is specified, if the bookmark exists at this cursor's location. |
void |
clearSelections()
Clears this cursor's selection, but does not modify the document. |
int |
comparePosition(XmlCursor cursor)
Returns an integer indicating whether this cursor is before, after, or at the same position as the specified cursor. |
int |
copyChars(int maxCharacterCount,
XmlCursor toHere)
Copies characters to the position immediately after the specified cursor. |
boolean |
copyXml(XmlCursor toHere)
Copies the XML immediately after this cursor to the location specified by the toHere cursor. |
boolean |
copyXmlContents(XmlCursor toHere)
Copies the contents of the container (STARTDOC OR START) immediately to the right of the cursor to the location specified by the toHere cursor. |
XmlCursor.TokenType |
currentTokenType()
Returns the type of the current token. |
void |
dispose()
Deallocates resources needed to manage the cursor, rendering this cursor inoperable. |
XmlCursor |
execQuery(java.lang.String query)
Executes the specified XQuery expression against the XML this cursor is in. |
XmlCursor |
execQuery(java.lang.String query,
XmlOptions options)
Executes the specified XQuery expression against the XML this cursor is in, and using the specified options. |
void |
getAllBookmarkRefs(java.util.Collection listToFill)
Retrieves all the bookmarks at this location, adding them to the specified collection. |
void |
getAllNamespaces(java.util.Map addToThis)
Adds to the specified map, all the namespaces in scope at the container where this cursor is positioned. |
java.lang.String |
getAttributeText(javax.xml.namespace.QName attrName)
When at a START or STARTDOC, returns the attribute text for the given attribute. |
XmlCursor.XmlBookmark |
getBookmark(java.lang.Object key)
Retrieves the bookmark with the specified key at this cursor's location. |
java.lang.String |
getChars()
Returns characters to the right of the cursor up to the next token. |
int |
getChars(char[] returnedChars,
int offset,
int maxCharacterCount)
Copies characters up to the specified maximum number, counting right from this cursor's location to the character at maxCharacterCount. |
XmlCursor.ChangeStamp |
getDocChangeStamp()
Returns the current change stamp for the document the current cursor is in. |
javax.xml.namespace.QName |
getName()
Returns the name of the current token. |
XmlObject |
getObject()
Returns the strongly-typed XmlObject at the current START, STARTDOC, or ATTR. |
int |
getSelectionCount()
Returns the count of the current selection. |
java.lang.String |
getTextValue()
Gets the text value of the current document, element, attribute, comment, procinst or text token. |
int |
getTextValue(char[] returnedChars,
int offset,
int maxCharacterCount)
Copies the text value of the current document, element, attribute, comment, processing instruction or text token, counting right from this cursor's location up to maxCharacterCount, and copies the returned text into returnedChars. |
boolean |
hasNextSelection()
Returns whether or not there is a next selection. |
boolean |
hasNextToken()
True if there is a next token. |
boolean |
hasPrevToken()
True if there is a previous token. |
void |
insertAttribute(javax.xml.namespace.QName name)
Inserts a new attribute immediately before this cursor's location, giving it the specified name. |
void |
insertAttribute(java.lang.String localName)
Inserts a new attribute immediately before this cursor's location, giving it the specified local name. |
void |
insertAttribute(java.lang.String localName,
java.lang.String uri)
Inserts a new attribute immediately before this cursor's location, giving it the specified local name and associating it with the specified namespace. |
void |
insertAttributeWithValue(javax.xml.namespace.QName name,
java.lang.String value)
Inserts an attribute immediately before the cursor's location, giving it the specified name and value. |
void |
insertAttributeWithValue(java.lang.String Name,
java.lang.String value)
Inserts a new attribute immediately before this cursor's location, giving it the specified value and name. |
void |
insertAttributeWithValue(java.lang.String name,
java.lang.String uri,
java.lang.String value)
Inserts an attribute immediately before the cursor's location, giving it the specified name and value, and associating it with the specified namespace. |
void |
insertChars(java.lang.String text)
Inserts the specified text immediately before this cursor's location. |
void |
insertComment(java.lang.String text)
Inserts an XML comment immediately before the cursor's location, giving it the specified content. |
void |
insertElement(javax.xml.namespace.QName name)
Inserts an element immediately before this cursor's location, giving the element the specified qualified name. |
void |
insertElement(java.lang.String localName)
Inserts an element immediately before this cursor's location, giving the element the specified local name. |
void |
insertElement(java.lang.String localName,
java.lang.String uri)
Inserts a new element immediately before this cursor's location, giving the element the specified local name and associating it with specified namespace |
void |
insertElementWithText(javax.xml.namespace.QName name,
java.lang.String text)
Inserts a new element immediately before this cursor's location, giving the element the specified qualified name and content. |
void |
insertElementWithText(java.lang.String localName,
java.lang.String text)
Inserts a new element immediately before this cursor's location, giving the element the specified local name and content. |
void |
insertElementWithText(java.lang.String localName,
java.lang.String uri,
java.lang.String text)
Inserts a new element immediately before this cursor's location, giving the element the specified local name, associating it with the specified namespace, and giving it the specified content. |
void |
insertNamespace(java.lang.String prefix,
java.lang.String namespace)
Inserts a namespace declaration immediately before the cursor's location, giving it the specified prefix and URI. |
void |
insertProcInst(java.lang.String target,
java.lang.String text)
Inserts an XML processing instruction immediately before the cursor's location, giving it the specified target and text. |
boolean |
isAnyAttr()
True if this token is any attribute. |
boolean |
isAtSamePositionAs(XmlCursor cursor)
Determines if this cursor is at the same position as the specified cursor. |
boolean |
isAttr()
True if this token is an ATTR token type, meaning just before an attribute. |
boolean |
isComment()
True if this token is a COMMENT token type, meaning just before a comment. |
boolean |
isContainer()
True if this token is a container token. |
boolean |
isEnd()
True if this token is an END token type, meaning just before an element's end. |
boolean |
isEnddoc()
True if this token is an ENDDOC token type, meaning at the very end of the document. |
boolean |
isFinish()
True if this token is a finish token. |
boolean |
isInSameDocument(XmlCursor cursor)
Determines if the specified cursor is in the same document as this cursor. |
boolean |
isLeftOf(XmlCursor cursor)
Determines if this cursor is to the left of (or before) the specified cursor. |
boolean |
isNamespace()
True if this token is a NAMESPACE token type, meaning just before a namespace declaration. |
boolean |
isProcinst()
True if this token is a PROCINST token type, meaning just before a processing instruction. |
boolean |
isRightOf(XmlCursor cursor)
Determines if this cursor is to the right of (or after) the specified cursor. |
boolean |
isStart()
True if this token is a START token type, meaning just before an element's start. |
boolean |
isStartdoc()
True if the current token is a STARTDOC token type, meaning at the very root of the document. |
boolean |
isText()
True if the this token is a TEXT token type, meaning just before or inside text. |
int |
moveChars(int maxCharacterCount,
XmlCursor toHere)
Moves characters immediately after this cursor to the position immediately after the specified cursor. |
boolean |
moveXml(XmlCursor toHere)
Moves the XML immediately after this cursor to the location specified by the toHere cursor, shifting XML at that location to the right to make room. |
boolean |
moveXmlContents(XmlCursor toHere)
Moves the contents of the container (STARTDOC OR START) immediately after this cursor to the location specified by the toHere cursor. |
java.lang.String |
namespaceForPrefix(java.lang.String prefix)
Returns the namespace URI indicated by the given prefix. |
boolean |
pop()
Restores the cursor location most recently saved with the push() method. |
java.lang.String |
prefixForNamespace(java.lang.String namespaceURI)
Returns a prefix that can be used to indicate a namespace URI. |
XmlCursor.TokenType |
prevTokenType()
Returns the type of the previous token. |
void |
push()
Saves the current location of this cursor on an internal stack of saved positions (independent of selection). |
boolean |
removeAttribute(javax.xml.namespace.QName attrName)
When at a START or STARTDOC, removes the attribute with the given name. |
int |
removeChars(int maxCharacterCount)
Removes characters up to the specified maximum number, counting right from this cursor's location to the character at maxCharacterCount. |
boolean |
removeXml()
Removes the XML that is immediately after this cursor. |
boolean |
removeXmlContents()
Removes the contents of the container (STARTDOC OR START) immediately after this cursor. |
void |
selectPath(java.lang.String path)
Executes the specified XPath expression against the XML that this cursor is in. |
void |
selectPath(java.lang.String path,
XmlOptions options)
Executes the specified XPath expression against the XML that this cursor is in. |
boolean |
setAttributeText(javax.xml.namespace.QName attrName,
java.lang.String value)
When at a START or STARTDOC, sets the attribute text for the given attribute. |
void |
setBookmark(XmlCursor.XmlBookmark bookmark)
Sets a bookmark to the document at this cursor's location. |
void |
setName(javax.xml.namespace.QName name)
Sets the name of the current token. |
void |
setTextValue(char[] sourceChars,
int offset,
int length)
Sets the text value of the XML at this cursor's location (if that XML's token type is START, STARTDOC, ATTR, COMMENT or PROCINST) to the contents of the specified character array. |
void |
setTextValue(java.lang.String text)
Sets the text value of the XML at this cursor's location if that XML's token type is START, STARTDOC, ATTR, COMMENT or PROCINST. |
boolean |
toBookmark(XmlCursor.XmlBookmark bookmark)
Moves this cursor to the same position as the bookmark. |
boolean |
toChild(int index)
Moves the cursor to the child element specified by index. |
boolean |
toChild(javax.xml.namespace.QName name)
Moves the cursor to the first child element of the specified qualified name. |
boolean |
toChild(javax.xml.namespace.QName name,
int index)
Moves the cursor to the specified index child element of the specified name, where that element is the . |
boolean |
toChild(java.lang.String name)
Moves the cursor to the first child element of the specified name in no namespace. |
boolean |
toChild(java.lang.String namespace,
java.lang.String name)
Moves the cursor to the first child element of the specified name in the specified namespace. |
boolean |
toCursor(XmlCursor moveTo)
Moves this cursor to the same position as the moveTo cursor. |
void |
toEndDoc()
Moves the cursor to the ENDDOC token, which is the end of the document. |
XmlCursor.TokenType |
toEndToken()
Moves the cursor to the END or ENDDOC token corresponding to the current START or STARTDOC, and returns END or ENDDOC. |
boolean |
toFirstAttribute()
Moves the cursor to the first attribute of this element, or returns false and does not move the cursor if there are no attributes. |
boolean |
toFirstChild()
Moves the cursor to the first child element, or returns false and does not move the cursor if there are no element children. |
XmlCursor.TokenType |
toFirstContentToken()
Moves the cursor to the first token in the content of the current START or STARTDOC. |
boolean |
toLastAttribute()
Moves the cursor to the last attribute of this element, or returns false and does not move the cursor if there are no attributes. |
boolean |
toLastChild()
Moves the cursor to the last element child, or returns false and does not move the cursor if there are no element children. |
boolean |
toNextAttribute()
Moves the cursor to the next sibling attribute, or returns false and does not move the cursor if there is no next sibling attribute. |
XmlCursor.XmlBookmark |
toNextBookmark(java.lang.Object key)
Moves this cursor to the location after its current position where a bookmark with the given key exists. |
int |
toNextChar(int maxCharacterCount)
Moves the cursor forward by the specified number of characters, and stops at the next non-TEXT token. |
boolean |
toNextSelection()
Moves this cursor to the next location in the selection, if any. |
boolean |
toNextSibling()
Moves the cursor to the next sibling element, or returns false and does not move the cursor if there is no next sibling element. |
boolean |
toNextSibling(javax.xml.namespace.QName name)
Moves the cursor to the next sibling element of the specified qualified name. |
boolean |
toNextSibling(java.lang.String name)
Moves the cursor to the next sibling element of the specified name in no namespace. |
boolean |
toNextSibling(java.lang.String namespace,
java.lang.String name)
Moves the cursor to the next sibling element of the specified name in the specified namespace. |
XmlCursor.TokenType |
toNextToken()
Moves the cursor to the next token. |
boolean |
toParent()
Moves the cursor to the parent element or STARTDOC, or returns false and does not move the cursor if there is no parent. Works if you're in attributes or content. |
boolean |
toPrevAttribute()
Moves the cursor to the previous sibling attribute, or returns false and does not move the cursor if there is no previous sibling attribute. |
XmlCursor.XmlBookmark |
toPrevBookmark(java.lang.Object key)
Moves this cursor to the location before its current position where a bookmark with the given key exists. |
int |
toPrevChar(int maxCharacterCount)
Moves the cursor backwards by the number of characters given. |
boolean |
toPrevSibling()
Moves the cursor to the previous sibling element, or returns false and does not move the cursor if there is no previous sibling element. |
XmlCursor.TokenType |
toPrevToken()
Moves the cursor to the previous token. |
boolean |
toSelection(int i)
Moves this cursor to the specified location in the selection. |
void |
toStartDoc()
Moves the cursor to the STARTDOC token, which is the root of the document. |
Methods inherited from interface org.apache.xmlbeans.XmlTokenSource |
---|
documentProperties, dump, getDomNode, monitor, newCursor, newDomNode, newDomNode, newInputStream, newInputStream, newReader, newReader, newXMLInputStream, newXMLInputStream, newXMLStreamReader, newXMLStreamReader, save, save, save, save, save, save, save, save, xmlText, xmlText |
Method Detail |
---|
void dispose()
boolean toCursor(XmlCursor moveTo)
moveTo
- The cursor at the location to which this cursor
should be moved.
void push()
boolean pop()
void selectPath(java.lang.String path)
hasNextSelection()
and toNextSelection()
(similar to
Iterator
).cursor.selectPath("./purchase-order/line-item");Note that this method does not support top-level XPath functions.
path
- The path expression to execute.
XmlRuntimeException
- If the query expression is invalid.void selectPath(java.lang.String path, XmlOptions options)
cursor.selectPath("./purchase-order/line-item");Note that this method does not support top-level XPath functions.
path
- The path expression to execute.options
- Options for the query. For example, you can call
the XmlOptions.setXqueryCurrentNodeVar(String)
method to specify a particular name for the query expression
variable that indicates the context node.
XmlRuntimeException
- If the query expression is invalid.boolean hasNextSelection()
boolean toNextSelection()
selectPath(java.lang.String)
and addToSelection()
methods.
boolean toSelection(int i)
i
- The index of the desired location.
int getSelectionCount()
void addToSelection()
void clearSelections()
boolean toBookmark(XmlCursor.XmlBookmark bookmark)
bookmark
- The bookmark at the location to which this
cursor should be moved.
XmlCursor.XmlBookmark toNextBookmark(java.lang.Object key)
key
- The key held by the next bookmark at the location to
which this cursor should be moved.
XmlCursor.XmlBookmark toPrevBookmark(java.lang.Object key)
key
- The key held by the previous bookmark at the location to
which this cursor should be moved.
javax.xml.namespace.QName getName()
In the following example, xmlObject
represents
an XML instance whose root element is not preceded by any other XML.
This code prints the root element name (here, the local name, or
name without URI).
XmlCursor cursor = xmlObject.newCursor(); cursor.toFirstContentToken(); String elementName = cursor.getName().getLocalPart(); System.out.println(elementName);
void setName(javax.xml.namespace.QName name)
name
- The new name for the current token.java.lang.String namespaceForPrefix(java.lang.String prefix)
prefix
- The namespace prefix for the requested namespace.
java.lang.String prefixForNamespace(java.lang.String namespaceURI)
namespaceURI
- The namespace URI corresponding to the requested
prefix.
void getAllNamespaces(java.util.Map addToThis)
addToThis
- The Map to add the namespaces to.XmlObject getObject()
XmlCursor.TokenType currentTokenType()
boolean isStartdoc()
boolean isEnddoc()
boolean isStart()
boolean isEnd()
boolean isText()
boolean isAttr()
boolean isNamespace()
boolean isComment()
boolean isProcinst()
boolean isContainer()
boolean isFinish()
boolean isAnyAttr()
XmlCursor.TokenType prevTokenType()
boolean hasNextToken()
boolean hasPrevToken()
XmlCursor.TokenType toNextToken()
XmlCursor.TokenType toPrevToken()
XmlCursor.TokenType toFirstContentToken()
XmlCursor.TokenType toEndToken()
int toNextChar(int maxCharacterCount)
maxCharacterCount
- The maximum number of characters by which
the cursor should be moved.
int toPrevChar(int maxCharacterCount)
toNextChar
method.
maxCharacterCount
- The maximum number of characters by which
the cursor should be moved.
boolean toNextSibling()
boolean toPrevSibling()
boolean toParent()
boolean toFirstChild()
boolean toLastChild()
boolean toChild(java.lang.String name)
name
- The name of the element to move the cursor to.
boolean toChild(java.lang.String namespace, java.lang.String name)
namespace
- The namespace URI for the element to move the cursor
to.name
- The name of the element to move to.
java.lang.IllegalArgumentException
- If the name is not a valid local name.boolean toChild(javax.xml.namespace.QName name)
name
- The name of the element to move the cursor to.boolean toChild(int index)
index
- The position of the element in the sequence of child
elements.
boolean toChild(javax.xml.namespace.QName name, int index)
name
- The name of the child element to move the cursor to.index
- The position of the element in the sequence of child
elements.
boolean toNextSibling(java.lang.String name)
name
- The name of the element to move the cursor to.
boolean toNextSibling(java.lang.String namespace, java.lang.String name)
namespace
- The namespace URI for the element to move the cursor
to.name
- The name of the element to move the cursor to.
boolean toNextSibling(javax.xml.namespace.QName name)
name
- The name of the element to move the cursor to.
boolean toFirstAttribute()
XmlCursor cursor = ... //cursor on START or STARTDOC if (cursor.toFirstAttribute()) { do { // do something using attribute's name and value cursor.getName(); cursor.getTextValue(); } while (cursor.toNextAttribute()); }
boolean toLastAttribute()
boolean toNextAttribute()
toFirstAttribute()
boolean toPrevAttribute()
java.lang.String getAttributeText(javax.xml.namespace.QName attrName)
attrName
- The name of the attribute whose value is requested.
boolean setAttributeText(javax.xml.namespace.QName attrName, java.lang.String value)
attrName
- The name of the attribute whose value is being set.value
- The new value for the attribute.
boolean removeAttribute(javax.xml.namespace.QName attrName)
attrName
- The name of the attribute that should be removed.
java.lang.String getTextValue()
IllegalStateException
.
int getTextValue(char[] returnedChars, int offset, int maxCharacterCount)
IllegalStateException
.
returnedChars
- A character array to hold the returned characters.offset
- The position within returnedChars to which the first of the
returned characters should be copied.maxCharacterCount
- The maximum number of characters after this cursor's
location to copy. A negative value specifies that all characters should be copied.
void setTextValue(java.lang.String text)
text
- The text to use as a new value.
java.lang.IllegalStateException
- If the token type at this
cursor's location is not START, STARTDOC, ATTR, COMMENT or
PROCINST.void setTextValue(char[] sourceChars, int offset, int length)
sourceChars
- A character array containing the XML's new value.offset
- The position within sourceChars from which the first of
the source characters should be copied.length
- The maximum number of characters to set as the XML's new
value.
java.lang.IllegalArgumentException
- If the token type at this
cursor's location is not START, STARTDOC, ATTR, COMMENT or
PROCINST.java.lang.String getChars()
int getChars(char[] returnedChars, int offset, int maxCharacterCount)
returnedChars
- A character array to hold the returned characters.offset
- The position within returnedChars at which the first of the
returned characters should be added.maxCharacterCount
- The maximum number of characters after this cursor's
location to return.
void toStartDoc()
void toEndDoc()
boolean isInSameDocument(XmlCursor cursor)
cursor
- The cursor that may be in the same document
as this cursor.
int comparePosition(XmlCursor cursor)
a.comparePosition(b) < 0
means a is to the left of b.a.comparePosition(b) == 0
means a is at the same position as b.a.comparePosition(b) > 0
means a is to the right of b.
cursor
- The cursor whose position should be compared
with this cursor.
java.lang.IllegalArgumentException
- If the specified
cursor is not in the same document as this cursor.boolean isLeftOf(XmlCursor cursor)
a.comparePosition(b) < 0
cursor
- The cursor whose position should be compared
with this cursor.
boolean isAtSamePositionAs(XmlCursor cursor)
a.comparePosition(b) == 0
cursor
- The cursor whose position should be compared
with this cursor.
boolean isRightOf(XmlCursor cursor)
a.comparePosition(b) > 0
cursor
- The cursor whose position should be compared
with this cursor.
XmlCursor execQuery(java.lang.String query)
XmlCursor results = cursor.execQuery("purchase-order/line-item[price <= 20.00]");
query
- The XQuery expression to execute.
XmlRuntimeException
- If the query expression is invalid.XmlCursor execQuery(java.lang.String query, XmlOptions options)
query
- The XQuery expression to execute.options
- Options for the query. For example, you can call
the XmlOptions.setXqueryCurrentNodeVar(String)
method to specify a particular name for the query expression
variable that indicates the context node.
XmlRuntimeException
- If the query expression is invalid.XmlCursor.ChangeStamp getDocChangeStamp()
void setBookmark(XmlCursor.XmlBookmark bookmark)
bookmark
- The bookmark to set.XmlCursor.XmlBookmark getBookmark(java.lang.Object key)
getKey
method is not overridden on
the bookmark, then the bookmark's class is used as the key.
key
- The key for the bookmark to retrieve.
void clearBookmark(java.lang.Object key)
key
- The for the bookmark to clear.void getAllBookmarkRefs(java.util.Collection listToFill)
listToFill
- The collection that will contain bookmarks
returned by this method.boolean removeXml()
java.lang.IllegalArgumentException
- If the cursor is at a
STARTDOC token.boolean moveXml(XmlCursor toHere)
toHere
- The cursor at the location to which the XML should
be moved.
java.lang.IllegalArgumentException
- If the operation is not allowed
at the cursor's location. This includes attempting to move an end token or the
document as a whole. Also, moving to a location before the start document or moving
an attribute to a location other than after another attribute or start token
will throw.boolean copyXml(XmlCursor toHere)
toHere
- The cursor at the location to which the XML should
be copied.
java.lang.IllegalArgumentException
- If the operation is not allowed
at the cursor's location.boolean removeXmlContents()
boolean moveXmlContents(XmlCursor toHere)
toHere
- The cursor at the location to which the XML should be moved.
boolean copyXmlContents(XmlCursor toHere)
toHere
- The cursor at the location to which the XML should
be copied.
int removeChars(int maxCharacterCount)
maxCharacterCount
- The maximum number of characters after this cursor's
location to remove.
java.lang.IllegalArgumentException
- If the operation is not allowed
at the cursor's location.int moveChars(int maxCharacterCount, XmlCursor toHere)
maxCharacterCount
- The maximum number of characters after this cursor's
location to move.toHere
- The cursor to which the characters should be moved.
java.lang.IllegalArgumentException
- If the operation is not allowed
at the cursor's location.int copyChars(int maxCharacterCount, XmlCursor toHere)
maxCharacterCount
- The maximum number of characters after this cursor's
location to copy.toHere
- The cursor to which the characters should be copied.
java.lang.IllegalArgumentException
- If the operation is not allowed
at the cursor's location.void insertChars(java.lang.String text)
text
- The text to insert.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertElement(javax.xml.namespace.QName name)
name
- The qualified name for the element.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertElement(java.lang.String localName)
localName
- The local name for the new element.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertElement(java.lang.String localName, java.lang.String uri)
localName
- The local name for the new element.uri
- The URI for the new element's namespace.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void beginElement(javax.xml.namespace.QName name)
name
- The qualified name for the new element.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void beginElement(java.lang.String localName)
localName
- The local name for the new element.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void beginElement(java.lang.String localName, java.lang.String uri)
localName
- The local name for the new element.uri
- The URI for the new element's namespace.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertElementWithText(javax.xml.namespace.QName name, java.lang.String text)
name
- The qualified name for the new element.text
- The content for the new element.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertElementWithText(java.lang.String localName, java.lang.String text)
localName
- The local name for the new element.text
- The content for the new element.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertElementWithText(java.lang.String localName, java.lang.String uri, java.lang.String text)
localName
- The local name for the new element.uri
- The URI for the new element's namespace.text
- The content for the new element.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertAttribute(java.lang.String localName)
localName
- The local name for the new attribute.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertAttribute(java.lang.String localName, java.lang.String uri)
localName
- The local name for the new attribute.uri
- The URI for the new attribute's namespace.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertAttribute(javax.xml.namespace.QName name)
name
- The local name for the new attribute.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertAttributeWithValue(java.lang.String Name, java.lang.String value)
Name
- The local name for the new attribute.value
- The value for the new attribute.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertAttributeWithValue(java.lang.String name, java.lang.String uri, java.lang.String value)
name
- The name for the new attribute.uri
- The URI for the new attribute's namespace.value
- The value for the new attribute.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertAttributeWithValue(javax.xml.namespace.QName name, java.lang.String value)
name
- The name for the new attribute.value
- The value for the new attribute.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertNamespace(java.lang.String prefix, java.lang.String namespace)
prefix
- The prefix for the namespace.namespace
- The URI for the namespace.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertComment(java.lang.String text)
text
- The new comment's content.
java.lang.IllegalArgumentException
- If the insertion is not allowed
at the cursor's location.void insertProcInst(java.lang.String target, java.lang.String text)
target
- The target for the processing instruction.text
- The new processing instruction's text.
java.lang.IllegalStateException
- If the insertion is not allowed
at the cursor's location.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |