|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.nxqd.NxqdConsumer net.sf.nxqd.NxqdModify
public class NxqdModify
The class NxqdModify
is the context within which a set of
one or more documents specified by an XQuery query can be modified
in place. The modification is performed using an NxqdModify object,
and a series of methods off that object that identify how the document
is to be modified. Using these methods, the modification steps are
identified. When the object is executed, these steps are performed in
the order that they were specified.
Method Summary | |
---|---|
void |
addAppendStep(NxqdQueryExpression selectionExpr,
int type,
String name,
String content)
Appends the provided data to the selected node's child notes. |
void |
addAppendStep(NxqdQueryExpression selectionExpr,
int type,
String name,
String content,
int location)
Appends the provided data to the selected node's child notes. |
void |
addInsertAfterStep(NxqdQueryExpression selectionExpr,
int type,
String name,
String content)
Inserts the provided data into the document after the selected node. |
void |
addInsertBeforeStep(NxqdQueryExpression selectionExpr,
int type,
String name,
String content)
Inserts the provided data into the document before the selected node, as a previous sibling. |
void |
addRemoveStep(NxqdQueryExpression selectionExpr)
Removes the node targeted by the selection expression. |
void |
addRenameStep(NxqdQueryExpression selectionExpr,
String newName)
Renames an element node, attribute node, or processing instruction. |
void |
addUpdateStep(NxqdQueryExpression selectionExpr,
String content)
Replaces the targeted node's content with text. |
Methods inherited from class net.sf.nxqd.NxqdConsumer |
---|
getNxqdManager, setNxqdManager |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void addAppendStep(NxqdQueryExpression selectionExpr, int type, String name, String content) throws NxqdException
selectionExpr
- a NxqdQueryExpression
The XQuery expression used to
target the location in the document where the modification is to be performed.
Use NxqdManager.prepare(...)
to create the NxqdQueryExpression
.
The query that you provide must target zero or more nodes,
or an exception is thrown. If zero nodes are selected, no modifications are performed
when execute(...) is called.type
- an int
The type of information to be inserted. The value
provided here determines whether the name or content parameter is required.
Valid values are: Element, Attribute, Text, ProcessingInstruction or Comment.name
- a String
The name of the node, attribute, or processing
instruction to insert. This parameter is ignored if type is NxqdModify.Textcontent
- a String
value
NxqdException
- if an error occurspublic void addAppendStep(NxqdQueryExpression selectionExpr, int type, String name, String content, int location) throws NxqdException
selectionExpr
- a NxqdQueryExpression
The XQuery expression used to
target the location in the document where the modification is to be performed.
Use NxqdManager.prepare(...)
to create the NxqdQueryExpression
.
The query that you provide must target zero or more nodes,
or an exception is thrown. If zero nodes are selected, no modifications are performed
when execute(...) is called.type
- an int
The type of information to be inserted. The value
provided here determines whether the name or content parameter is required.
Valid values are: Element, Attribute, Text, ProcessingInstruction or Comment.name
- a String
The name of the node, attribute, or processing
instruction to insert. This parameter is ignored if type is NxqdModify.Textcontent
- a String
valuelocation
- an int
Identifies the position in the child node list where
the provided content is to be inserted. For example, if location is 3, and the target
element has at least 3 child nodes, the new content will become the 3rd child of the target node. If this parameter is a negative number, or if this parameter contains a value that is larger
than the number of child nodes, then the new node will be the last child node.
NxqdException
- if an error occurspublic void addInsertAfterStep(NxqdQueryExpression selectionExpr, int type, String name, String content) throws NxqdException
selectionExpr
- a NxqdQueryExpression
value. The XQuery expression
used to target the location in the document where the modification is to be performed.type
- an int
value. The type of information to be inserted.
The value provided here determines whether the name or content parameter is required.
Valid values are: Element, Attribute, Text, ProcessingInstruction or Comment.name
- a String
value. The name of the node, attribute, or processing
instruction to insert. This parameter is ignored if type is NxqdModify.Text or NxqdModify.Comment.content
- a String
value
NxqdException
- if an error occurspublic void addInsertBeforeStep(NxqdQueryExpression selectionExpr, int type, String name, String content) throws NxqdException
selectionExpr
- a NxqdQueryExpression
value. The XQuery expression
used to target the location in the document where the modification is to be performed.type
- an int
value. The type of information to be inserted.
The value provided here determines whether the name or content parameter is required.
Valid values are: Element, Attribute, Text, ProcessingInstruction or Comment.name
- a String
value. The name of the node, attribute, or processing
instruction to insert. This parameter is ignored if type is NxqdModify.Text or NxqdModify.Comment.content
- a String
value
NxqdException
public void addRemoveStep(NxqdQueryExpression selectionExpr) throws NxqdException
selectionExpr
- a NxqdQueryExpression
value
NxqdException
- if an error occurspublic void addRenameStep(NxqdQueryExpression selectionExpr, String newName) throws NxqdException
selectionExpr
- a NxqdQueryExpression
valuenewName
- a String
value
NxqdException
- if an error occurspublic void addUpdateStep(NxqdQueryExpression selectionExpr, String content) throws NxqdException
selectionExpr
- a NxqdQueryExpression
valuecontent
- a String
value
NxqdException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |