#include <xmlReference.hpp>

Public Member Functions | |
| XMLReference (T *_node, XMLDocument *_document) | |
| XMLReference (const XMLReference< T > &r) | |
| XMLReference< T > & | operator= (const XMLReference< T > &r) |
| T & | operator* (void) const |
| T * | operator-> (void) const |
| T * | get (void) const |
| operator bool (void) const | |
| bool | operator! () const |
| std::string | getNodeText (void) throw (Error,XMLException) |
| XMLReference< XalanNode > | selectNode (const std::string &xPath) throw (Error,XMLException) |
| Only implemented for XalanElement. | |
| XMLNodeReferenceList | selectNodes (const std::string &xPath) throw (Error,XMLException) |
| Only implemented for XalanElement. | |
| bool | existNode (const std::string &xPath) throw (XMLException) |
| Only implemented for XalanElement. | |
| XMLDocument * | getDocument (void) const |
| template<> | |
| XMLReference< XalanNode > | selectNode (const std::string &xPath) throw(Error, XMLException) |
| template<> | |
| XMLNodeReferenceList | selectNodes (const std::string &xPath) throw(Error, XMLException) |
| template<> | |
| bool | existNode (const std::string &xPath) throw(XMLException) |
Protected Attributes | |
| T * | node |
| XMLDocument * | document |
Wrapper for XML-nodes and -elements of the Apache-library.
Definition at line 41 of file xmlReference.hpp.
| XMLReference< T >::XMLReference | ( | T * | _node, | |
| XMLDocument * | _document | |||
| ) |
| XMLReference< T >::XMLReference | ( | const XMLReference< T > & | r | ) |
| bool XMLReference< XalanElement >::existNode | ( | const std::string & | xPath | ) | throw(XMLException) [inline] |
Definition at line 81 of file xmlReference.cpp.
00083 { 00084 return selectNodes( xPath ).getLength() >= 1; 00085 }
| bool XMLReference< T >::existNode | ( | const std::string & | xPath | ) | throw (XMLException) |
Only implemented for XalanElement.
| T* XMLReference< T >::get | ( | void | ) | const [inline] |
Definition at line 55 of file xmlReference.hpp.
References XMLReference< T >::node.
Referenced by dynamic_pointer_cast().
00055 { return node; }
| XMLDocument* XMLReference< T >::getDocument | ( | void | ) | const [inline] |
Definition at line 71 of file xmlReference.hpp.
References XMLReference< T >::document.
Referenced by dynamic_pointer_cast().
00071 { return document; }
| std::string XMLReference< T >::getNodeText | ( | void | ) | throw (Error,XMLException) |
| XMLReference< T >::operator bool | ( | void | ) | const [inline] |
Definition at line 57 of file xmlReference.hpp.
References XMLReference< T >::node.
00057 { return node != NULL; }
| bool XMLReference< T >::operator! | ( | ) | const [inline] |
Definition at line 59 of file xmlReference.hpp.
References XMLReference< T >::node.
00059 { return node == NULL; }
| T& XMLReference< T >::operator* | ( | void | ) | const [inline] |
Definition at line 51 of file xmlReference.hpp.
References XMLReference< T >::node.
| T* XMLReference< T >::operator-> | ( | void | ) | const [inline] |
Definition at line 53 of file xmlReference.hpp.
References XMLReference< T >::node.
| XMLReference< T >& XMLReference< T >::operator= | ( | const XMLReference< T > & | r | ) |
| XMLReference< XalanNode > XMLReference< XalanElement >::selectNode | ( | const std::string & | xPath | ) | throw(Error, XMLException) [inline] |
Definition at line 33 of file xmlReference.cpp.
References ERRORMACRO, XMLNodeReferenceList::getLength(), and XMLNodeReferenceList::item().
00034 { 00035 XMLNodeReferenceList nodeList( selectNodes( xPath ) ); 00036 ERRORMACRO( nodeList.getLength() >= 1, Error, , 00037 "Could not find XML node with x-path \"" << xPath << "\"." ); 00038 ERRORMACRO( nodeList.getLength() <= 1, Error, , 00039 "There are multiple nodes with x-path \"" << xPath << "\"." ); 00040 assert( nodeList.getLength() == 1 ); 00041 return nodeList.item( 0 ); 00042 }
| XMLReference< XalanNode > XMLReference< T >::selectNode | ( | const std::string & | xPath | ) | throw (Error,XMLException) |
Only implemented for XalanElement.
| XMLNodeReferenceList XMLReference< XalanElement >::selectNodes | ( | const std::string & | xPath | ) | throw(Error, XMLException) [inline] |
Definition at line 46 of file xmlReference.cpp.
References ERRORMACRO.
00047 { 00048 ERRORMACRO( document != NULL, Error, , 00049 "Can not select nodes from empty XML document." ); 00050 #ifdef SIMPLEXPATH 00051 XalanDocumentPrefixResolver thePrefixResolver( document ); 00052 XPathEvaluator theEvaluator; 00053 // Using XalanDOMString-constructor, which is present in Xalan-C version 00054 // 1.9 and in earlier versions as well! 00055 NodeRefList obj = 00056 theEvaluator.selectNodeList( *document->getDOMSupport(), node, 00057 XalanDOMString( xPath.c_str() ).c_str(), 00058 thePrefixResolver ); 00059 #else 00060 XPathProcessorImpl theXPathProcessor; 00061 XPath * const contextXPath = document->getXPathFactory()->create(); 00062 const ElementPrefixResolverProxy prefixResolver 00063 ( node, *document->getEnvSupport(), *document->getDOMSupport() ); 00064 theXPathProcessor.initXPath( *contextXPath, 00065 // With which version was this introduced exactly? 00066 #if _XALAN_VERSION >= 10500 00067 *document->getXPathConstructionContext(), 00068 #endif 00069 XalanDOMString( xPath.c_str() ), 00070 prefixResolver ); 00071 00072 shared_ptr< XObjectPtr > obj( new XObjectPtr ); 00073 *obj = 00074 contextXPath->execute( node, prefixResolver, 00075 *document->getExecutionContext() ); 00076 #endif 00077 return XMLNodeReferenceList( obj, document ); 00078 }
| XMLNodeReferenceList XMLReference< T >::selectNodes | ( | const std::string & | xPath | ) | throw (Error,XMLException) |
Only implemented for XalanElement.
XMLDocument* XMLReference< T >::document [protected] |
Definition at line 76 of file xmlReference.hpp.
Referenced by XMLReference< T >::getDocument().
T* XMLReference< T >::node [protected] |
Definition at line 74 of file xmlReference.hpp.
Referenced by XMLReference< T >::get(), XMLReference< T >::operator bool(), XMLReference< T >::operator!(), XMLReference< T >::operator*(), and XMLReference< T >::operator->().