Get XQilla at SourceForge.net. Fast, secure and Free Open Source software downloads

XQilla : DOM3APIContextItem

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2012-01-30 10:03:27 by JohnSnelson [Reverted to version from 2010-04-13 10:45:12]

Deletions:
play friv games
play bloons tower defense 4




Edited on 2011-12-21 07:45:26 by DanaGheorghe [minor]

Additions:
play friv games
play bloons tower defense 4


Deletions:
[http://www.frivtown.com play friv games]
[http://www.frivtown.com/strategy-games/play-bloons-tower-defense-4 play bloons tower defense 4]




Edited on 2011-12-21 07:44:11 by DanaGheorghe [minor]

Additions:
[http://www.frivtown.com play friv games]
[http://www.frivtown.com/strategy-games/play-bloons-tower-defense-4 play bloons tower defense 4]




Edited on 2010-04-13 10:45:12 by JohnSnelson [Reverted to version from 2008-02-05 03:23:36]

Additions:
This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item. An equivalent example exists for the simple API.

Deletions:
This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item. An equivalent example custom research papers exists for the simple custom writing company API.



Edited on 2010-04-01 15:43:37 by AbigailJohnson [minor]

Additions:
This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item. An equivalent example custom research papers exists for the simple custom writing company API.

Deletions:
This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item. An equivalent example exists for the simple API.



Edited on 2008-02-05 03:23:36 by JohnSnelson [Fixed a memory leak in the example]

Additions:
StdOutFormatTarget target;
writer->writeNode(&target, *(result->asNode()));

Deletions:
StdOutFormatTarget *target = new StdOutFormatTarget();
writer->writeNode(target, *(result->asNode()));




Edited on 2008-01-24 15:23:23 by JohnSnelson [Reworded]

Additions:
This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item. An equivalent example exists for the simple API.

Deletions:
This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item. The equivalent example done using the simple API can be found here.



Edited on 2007-11-22 10:35:45 by JohnSnelson [Reverted to version from 2007-01-19 11:32:47]

Deletions:
oloelall
darzelelcnav




Edited on 2007-11-15 13:04:03 by ZelcrOlore

Additions:
oloelall



Edited on 2007-11-12 12:07:24 by TroctReltr

Additions:
darzelelcnav



Edited on 2007-01-19 11:32:47 by JohnSnelson

Additions:
if(document
0) {
std::cerr
"Document not found."
std::endl;
return 1;
try {
Parse an XPath 2 expression
const DOMXPathExpression *expression = document->createExpression(X("foo/bar/@baz"), 0);
Execute the query
XPath2Result *result = (XPath2Result*)expression->evaluate(document, XPath2Result::ITERATOR_RESULT, 0);
Create a DOMWriter to output the nodes
DOMWriter *writer = xqillaImplementation->createDOMWriter();
StdOutFormatTarget *target = new StdOutFormatTarget();
Iterate over the results, printing them
while(result->iterateNext()) {
writer->writeNode(target, *(result->asNode()));
std::cout
std::endl;
}
Clean up all the objects we have created
writer->release();
result->release();
((XQillaExpression*)expression)->release();
catch(XQillaException &e) {
std::cerr
"XQillaException: "
UTF8(e.getString())
std::endl;
return 1;


Deletions:
Parse an XPath 2 expression
const DOMXPathExpression *expression = document->createExpression(X("foo/bar/@baz"), 0);
Execute the query
XPath2Result *result = (XPath2Result*)expression->evaluate(document, XPath2Result::ITERATOR_RESULT, 0);
Create a DOMWriter to output the nodes
DOMWriter *writer = xqillaImplementation->createDOMWriter();
StdOutFormatTarget *target = new StdOutFormatTarget();
Iterate over the results, printing them
while(result->iterateNext()) {
writer->writeNode(target, *(result->asNode()));
std::cout
std::endl;
Clean up all the objects we have created
writer->release();
result->release();
((XQillaExpression*)expression)->release();




Edited on 2007-01-19 11:24:32 by JohnSnelson

Additions:
writer->release();
result->release();
((XQillaExpression*)expression)->release();
builder->release();


Deletions:
result->release();
((XQillaExpression*)expression)->release();
delete document;




Oldest known version of this page was edited on 2005-12-20 15:16:46 by JohnSnelson []
Page view:

DOM 3 API: Context Item


This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item. The equivalent example done using the simple API can be found here.

#include <iostream>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/framework/StdOutFormatTarget.hpp>
#include <xqilla/xqilla-dom3.hpp>

XERCES_CPP_NAMESPACE_USE;

int main(int argc, char *argv[]) {
        // Initialise Xerces-C and XQilla using XQillaPlatformUtils
        XQillaPlatformUtils::initialize();

        // Get the XQilla DOMImplementation object
        DOMImplementation *xqillaImplementation =
                DOMImplementationRegistry::getDOMImplementation(X("XPath2 3.0"));

        // Create a DOMBuilder object
        DOMBuilder *builder = xqillaImplementation->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
        builder->setFeature(X("namespaces"), true);
        builder->setFeature(X("http://apache.org/xml/features/validation/schema"), true);
        builder->setFeature(X("validation"), true);

        // Parse a DOMDocument
        DOMDocument *document = builder->parseURI("foo.xml");

        // Parse an XPath 2 expression
        const DOMXPathExpression *expression = document->createExpression(X("foo/bar/@baz"), 0);

        // Execute the query
        XPath2Result *result = (XPath2Result*)expression->evaluate(document, XPath2Result::ITERATOR_RESULT, 0);

        // Create a DOMWriter to output the nodes
        DOMWriter *writer = xqillaImplementation->createDOMWriter();
        StdOutFormatTarget *target = new StdOutFormatTarget();

        // Iterate over the results, printing them
        while(result->iterateNext()) {
                writer->writeNode(target, *(result->asNode()));
                std::cout << std::endl;
        }

        // Clean up all the objects we have created
        result->release();
        ((XQillaExpression*)expression)->release();
        delete document;

        // Terminate Xerces-C and XQilla using XQillaPlatformUtils
        XQillaPlatformUtils::terminate();

        return 0;
}



CategoryDOM3API
Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.4260 seconds