1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XMLNode.hpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="examples.html">Examples</a> </center>
<hr><h1>XMLNode.hpp</h1><a href="XMLNode_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font>
00002 <font class="comment"> * (C) Copyright 2002, Schlund+Partner AG</font>
00003 <font class="comment"> *</font>
00004 <font class="comment"> * This library is free software; you can redistribute it and/or</font>
00005 <font class="comment"> * modify it under the terms of the GNU Lesser General Public</font>
00006 <font class="comment"> * License as published by the Free Software Foundation; either</font>
00007 <font class="comment"> * version 2.1 of the License, or (at your option) any later version.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This library is distributed in the hope that it will be useful,</font>
00010 <font class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00011 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00012 <font class="comment"> * Lesser General Public License for more details.</font>
00013 <font class="comment"> *</font>
00014 <font class="comment"> * You should have received a copy of the GNU Lesser General Public</font>
00015 <font class="comment"> * License along with this library; if not, write to the Free Software</font>
00016 <font class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</font>
00017 <font class="comment">*/</font>
00018
00031 <font class="preprocessor">#ifndef SP_GXML_XMLNODE_HPP</font>
00032 <font class="preprocessor"></font><font class="preprocessor">#define SP_GXML_XMLNODE_HPP</font>
00033 <font class="preprocessor"></font>
00034 <font class="comment">// STDC++</font>
00035 <font class="preprocessor">#include <string></font>
00036
00037 <font class="comment">// C libraries</font>
00038 <font class="preprocessor">#include <libxslt/xsltInternals.h></font>
00039 <font class="preprocessor">#include <libxml/xpath.h></font>
00040 <font class="preprocessor">#include <libxml/tree.h></font>
00041
00042 <font class="keyword">namespace </font>SP {
00043 <font class="keyword">namespace </font>GXML {
00044
00045 <font class="keyword">class </font>XMLNode
00046 {
00047 <font class="keyword">public</font>:
00048 XMLNode();
00049 XMLNode( <font class="keyword">const</font> xmlNodePtr node );
00050 ~XMLNode();
00051
00052 <font class="keyword">enum</font> Exceptions
00053 {
00054 NO_NODE=1, <font class="comment">// NodePtr is NULL</font>
00055 LAST_NODE, <font class="comment">// node has no following sibling</font>
00056 FIRST_NODE, <font class="comment">// node has no preceding sibling</font>
00057 DOC_NODE, <font class="comment">// node is document node (has no parent)</font>
00058 NO_CHILD, <font class="comment">// node has no children</font>
00059 NO_CONTENT, <font class="comment">// node has no content (no child text-node)</font>
00060 NO_ATTRIBUTES, <font class="comment">// node has no attributes</font>
00061 NO_VALUE <font class="comment">// attribute has no value (should never happen)</font>
00062 };
00063 <font class="comment">// XMLTree getDoc(); makes no sense till there is a doc-object</font>
00065 <font class="comment"> // hint:</font>
00066 <font class="comment">// EVERY group of spcaes or characters is contained within a invisible</font>
00067 <font class="comment">// text-node.</font>
00068 <font class="comment">// i.e. <node/> <node/> expands to <node/><text> </text><node/></font>
00069 <font class="comment">// return next node in order (every space between tags is a text node!)</font>
00070 <font class="comment">// throws LAST_NODE if no following sibling exists</font>
00071 XMLNode getNext();
00072 <font class="comment">// return previous node in order</font>
00073 <font class="comment">// throws FIRST_NODE if no preceding sibling exists</font>
00074 XMLNode getPrev();
00075 <font class="comment">// return parent of current node</font>
00076 <font class="comment">// throws DOC_NODE if no parent exists</font>
00077 XMLNode getParent();
00078 <font class="comment">// return first child of node (text-node if node has content)</font>
00079 <font class="comment">// throws</font>
00080 XMLNode getChild();
00081 <font class="comment">// return last child of node</font>
00082 XMLNode getLast();
00083
00084 <font class="comment">// return node type (i.e. XML_ELEMENT_NODE, XML_ATTRIBUTE_NODE,</font>
00085 <font class="comment">// XML_TEXT_NODE, ... )</font>
00086 <font class="keywordtype">int</font> getType();
00087 <font class="comment">// return name of node-tag</font>
00088 std::string getName();
00089 <font class="comment">// return content of node (which is the content of the first child text-node)</font>
00090 std::string getContent();
00091 <font class="comment">// return attribute value by name</font>
00092 std::string getAttribute( <font class="keyword">const</font> std::string& name );
00093 <font class="comment">// XMLAttributeSet getAttributeSet( XMLNode* node );</font>
00094
00095 <font class="comment">// returns XML subtree of node</font>
00096 std::string getNodeDump();
00097
00098 xmlNodePtr getNodePtr();
00099
00100 <font class="keyword">private</font>:
00101 xmlNodePtr node_;
00102 };
00103
00104 }}
00105 <font class="preprocessor">#endif</font>
</pre></div><hr><address align="right"><small>Generated on Thu Jun 3 19:20:12 2004 for sp-gxmlcpp by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>
|