XmlModify::addAppendStep
|
 |
#include <DbXml.hpp>
void XmlModify::addAppendStep(const XmlQueryExpression &selectionExpr,
XmlObject type, const std::string &name,
const std::string &content, int location = -1)
void XmlModify::addAppendStep(const XmlQueryExpression &selectionExpr,
XmlObject type, const std::string &name,
XmlResults &content, int location = -1)
Description: XmlModify::addAppendStep
Appends the provided data to the selected node's child nodes. If the
operation's target is an attribute node or the document root node, an
exception is thrown at modification execution time.
If the content to be added is an attribute, the content is added to the
targeted node's attribute list. If the content to add is an element
node, text, comment, or processing instruction, it is added
immediately after the targeted node's last child node, unless the
location parameter is specified.
Documents resulting from this modification must be well-formed XML or
an exception is thrown at modification execution time, if the documents
affected are written back to their respective containers.
Parameters
- selectionExpr
- Provides the XQuery expression used to target the location in the
document where the modification is to be performed. Use
XmlManager::prepare to create the XmlQueryExpression.
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 XmlModify::execute is called.
- type
- Identifies the type of information to be inserted. The value provided
here determines whether the name or content parameter
is required. Valid values are:
- XmlModify::Element
- The information to be inserted is an element node. The name
parameter is optional. If set, it represents the element's name, and
is used as a parent element to the content. If name is empty,
the content must be set, and is used as the new content. In
this case, the content must be well-formed XML.
- XmlModify::Attribute
- The information to be inserted is an attribute node. The name
parameter is required, and it represents the attribute's name. If the
content parameter is specified, then it contains the
attribute's value.
- XmlModify::Text
- The information to be inserted is a text node. The content
parameter is required. The name parameter is ignored.
- XmlModify::ProcessingInstruction
- The information to be inserted is a PI node. The name and
content parameters are required. The name is the
processing instruction's name, and the content contains the
processing instruction's arguments.
- XmlModify::Comment
- The information to be inserted is a comment node. The content
parameter is required, and it contains the comment to be inserted. The
name parameter is ignored.
- name
- The name of the node, attribute, or processing instruction to insert.
This parameter is ignored if type is XmlModify::Text or
XmlModify::Comment.
- content
- The content to insert. See the type parameter description for an
explanation of what this parameter is meant to contain for each of the content
types.
- location
- 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.
|

|
Copyright (c) 1996,2007 Oracle. All rights reserved.