XmlModify::addInsertAfterStep

API Ref

#include <DbXml.hpp>

void XmlModify::addInsertAfterStep(const XmlQueryExpression &selectionExpr, XmlObject type, const std::string &name, const std::string &content)

void XmlModify::addInsertAfterStep(const XmlQueryExpression &selectionExpr, XmlObject type, const std::string &name, XmlResults &content)


Description: XmlModify::addInsertAfterStep

Inserts the provided data into the document after the selected node. 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 parent node. For any other type of content, the content is inserted into the document immediately after the targeted node's end tag, as its next sibling.

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.

APIRef

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