# OMElement.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2005-2009 WSO2, Inc. http://wso2.com
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  * http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 #ifndef OMELEMENT_H
    00018 #define OMELEMENT_H
    00019
    00020 #include <WSFDefines.h>
    00021 #include <OMNode.h>
    00022 #include <OMNamespace.h>
    00023 #include <OMAttribute.h>
    00024 #include <axiom_element.h>
    00025 #include <string>
    00026 #include <vector>
    00027
    00036 namespace wso2wsf
    00037 {
    00050     class OMElement : public OMNode
    00051     {
    00052     private:
    00056         std::vector<OMNamespace *> _added_namespaces;
    00057
    00061         OMNamespace * _default_namespace;
    00062
    00066         OMNamespace * _namespace;
    00067
    00071         std::vector<OMAttribute *> _added_attributes;
    00072
    00076         std::vector<OMNode *> _child_nodes;
    00077
    00081         axiom_element_t * _wsf_axiom_element;
    00082
    00089         void WSF_CALL init(OMNode * parent, std::string localname, OMNamespace * ns);
    00090
    00091     public:
    00092
    00101                 OMNamespace * WSF_CALL findNamespace(std::string uri, std::string prefix);
    00102
    00107         WSF_EXTERN WSF_CALL OMElement(std::string localname);
    00108
    00114         WSF_EXTERN WSF_CALL OMElement(std::string localname, OMNamespace * ns);
    00115
    00121         WSF_EXTERN WSF_CALL OMElement(OMNode * parent, std::string localname);
    00122
    00129         WSF_EXTERN WSF_CALL OMElement(OMNode * parent, std::string localname, OMNamespace * ns);
    00130
    00136         WSF_EXTERN WSF_CALL OMElement(OMNode * parent, axiom_node_t * node);
    00137
    00142         virtual WSF_CALL ~OMElement();
    00143
    00144
    00152         virtual bool WSF_CALL removeChildLocal(OMNode * child);
    00153
    00160         virtual void WSF_CALL addChildLocal(OMNode * child);
    00161
    00166         WSF_EXTERN virtual std::vector<OMNode *> WSF_CALL getChildren();
    00167
    00173         WSF_EXTERN virtual void WSF_CALL setChildren(std::vector<OMNode *> children);
    00174
    00178         WSF_EXTERN void WSF_CALL freeTree();
    00179
    00185         WSF_EXTERN bool WSF_CALL insertSiblingAfter(OMNode * to_insert);
    00186
    00192         WSF_EXTERN bool WSF_CALL insertSiblingBefore(OMNode * to_insert);
    00193
    00204         WSF_EXTERN bool WSF_CALL setNamespace(OMNamespace * ns, bool no_find);
    00205
    00216         WSF_EXTERN OMNamespace* WSF_CALL getNamespace(bool is_default = false);
    00217
    00218
    00226         WSF_EXTERN OMNamespace * WSF_CALL getNamespaceLocal(bool is_default = false);
    00227
    00233         WSF_EXTERN bool WSF_CALL declareDefaultNamespace(std::string uri);
    00234
    00240         WSF_EXTERN bool WSF_CALL addAttribute(OMAttribute * attribute);
    00241
    00249         WSF_EXTERN OMAttribute * WSF_CALL getAttribute(std::string name, OMNamespace * ns);
    00250
    00257         WSF_EXTERN OMAttribute * WSF_CALL getAttribute(std::string name);
    00258
    00265         WSF_EXTERN std::string WSF_CALL getAttributeValue(std::string name, OMNamespace * ns);
    00266
    00272         WSF_EXTERN std::string WSF_CALL getAttributeValue(std::string name);
    00273
    00281         WSF_EXTERN bool WSF_CALL removeAttribute(OMAttribute * attribute);
    00282
    00287         WSF_EXTERN std::string WSF_CALL getLocalname();
    00288
    00296         WSF_EXTERN bool WSF_CALL setText(std::string text);
    00297
    00303         WSF_EXTERN std::string WSF_CALL getText();
    00304
    00311         WSF_EXTERN bool WSF_CALL addChild(OMNode * child);
    00312
    00317         WSF_EXTERN OMElement * WSF_CALL getFirstElement();
    00318
    00326         WSF_EXTERN OMElement * WSF_CALL getChildElement(std::string localname, OMNamespace * ns);
    00327
    00334         WSF_EXTERN bool WSF_CALL build();
    00335
    00341         WSF_EXTERN OMNode * WSF_CALL getFirstChild();
    00342
    00347         WSF_EXTERN OMNode * WSF_CALL getLastChild();
    00348
    00355         WSF_EXTERN axiom_types_t WSF_CALL nodeType();
    00356
    00357     };
    00359 }
    00360 #endif // OMELEMENT_H