51 lines
3.8 KiB
HTML
51 lines
3.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>XQilla DOM3 API Documentation</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<a style="float:right;" href="http://sourceforge.net/projects/xqilla"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=152021&type=2" border="0" alt="SourceForge.net Logo" /></a>
|
|
<!-- Generated by Doxygen 1.3.9.1 -->
|
|
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="examples.html">Examples</a></div>
|
|
<h1>dom-basic.cpp</h1>This example executes a simple XQuery expression ("1 to 100"), which returns the numbers from 1 to 100 inclusive.<p>
|
|
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include <iostream></span>
|
|
<span class="preprocessor">#include <<a class="code" href="DOM_8hpp.html">xercesc/dom/DOM.hpp</a>></span>
|
|
<span class="preprocessor">#include <<a class="code" href="xqilla-dom3_8hpp.html">xqilla/xqilla-dom3.hpp</a>></span>
|
|
|
|
XERCES_CPP_NAMESPACE_USE;
|
|
|
|
<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> *argv[]) {
|
|
<span class="comment">// Initialise Xerces-C and XQilla using XQillaPlatformUtils</span>
|
|
<a name="a0"></a><a class="code" href="classXQillaPlatformUtils.html#e0">XQillaPlatformUtils::initialize</a>();
|
|
|
|
<span class="comment">// Get the XQilla DOMImplementation object</span>
|
|
DOMImplementation *xqillaImplementation =
|
|
DOMImplementationRegistry::getDOMImplementation(X(<span class="stringliteral">"XPath2 3.0"</span>));
|
|
|
|
<span class="comment">// Make sure the DOM objects are released before we call XQillaPlatformUtils::terminate()</span>
|
|
{
|
|
<span class="comment">// Create a DOMDocument</span>
|
|
<a name="_a1"></a><a class="code" href="classAutoRelease.html">AutoRelease<DOMDocument></a> document(xqillaImplementation->createDocument());
|
|
|
|
<span class="comment">// Parse an XPath 2 expression</span>
|
|
<a class="code" href="classAutoRelease.html">AutoRelease<DOMXPathExpression></a> expression(document->createExpression(X(<span class="stringliteral">"1 to 100"</span>), 0));
|
|
|
|
<span class="comment">// Execute the query</span>
|
|
<a class="code" href="classAutoRelease.html">AutoRelease<DOMXPathResult></a> result(expression->evaluate(0, DOMXPathResult::ITERATOR_RESULT_TYPE, 0));
|
|
|
|
<span class="comment">// Iterate over the results, printing them</span>
|
|
<span class="keywordflow">while</span>(result->iterateNext()) {
|
|
std::cout << result->getIntegerValue() << std::endl;
|
|
}
|
|
}
|
|
|
|
<span class="comment">// Terminate Xerces-C and XQilla using XQillaPlatformUtils</span>
|
|
<a name="a2"></a><a class="code" href="classXQillaPlatformUtils.html#e1">XQillaPlatformUtils::terminate</a>();
|
|
|
|
<span class="keywordflow">return</span> 0;
|
|
}
|
|
</pre></div> <hr size="1"><address style="align: right;"><small>Generated on Fri Sep 25 06:55:48 2009 for XQilla DOM Level 3 API by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
|
|
</body>
|
|
</html>
|