Moved DOM:: into Arabica::DOM::

This commit is contained in:
jez 2007-09-05 11:47:13 +00:00
parent 34606c065a
commit 7d46f6f4e2
86 changed files with 674 additions and 521 deletions

View file

@ -20,7 +20,7 @@ int main(int argc, char* argv[])
} // if(argc < 2) } // if(argc < 2)
{ // narrow { // narrow
SAX2DOM::Parser<std::string> domParser; Arabica::SAX2DOM::Parser<std::string> domParser;
Arabica::SAX::CatchErrorHandler<std::string> eh; Arabica::SAX::CatchErrorHandler<std::string> eh;
domParser.setErrorHandler(eh); domParser.setErrorHandler(eh);
@ -42,7 +42,7 @@ int main(int argc, char* argv[])
if(!eh.errorsReported()) if(!eh.errorsReported())
{ {
DOM::Document<std::string> doc = domParser.getDocument(); Arabica::DOM::Document<std::string> doc = domParser.getDocument();
doc.normalize(); doc.normalize();
std::cout << doc; std::cout << doc;
} }
@ -57,7 +57,7 @@ int main(int argc, char* argv[])
/* /*
{ // wide { // wide
SAX2DOM::Parser<std::wstring> domParser; SAX2Arabica::DOM::Parser<std::wstring> domParser;
Arabica::SAX::wInputSource is; Arabica::SAX::wInputSource is;
is.setSystemId(L"stdin"); is.setSystemId(L"stdin");
@ -65,7 +65,7 @@ int main(int argc, char* argv[])
domParser.parse(is); domParser.parse(is);
DOM::Document<std::wstring> doc = domParser.getDocument(); Arabica::DOM::Document<std::wstring> doc = domParser.getDocument();
std::wcout << doc; std::wcout << doc;
} }

View file

@ -32,7 +32,7 @@ int main(int argc, char* argv[])
} }
SAX2DOM::Parser<std::string> domParser; Arabica::SAX2DOM::Parser<std::string> domParser;
Arabica::SAX::CatchErrorHandler<std::string> eh; Arabica::SAX::CatchErrorHandler<std::string> eh;
domParser.setErrorHandler(eh); domParser.setErrorHandler(eh);
@ -54,7 +54,7 @@ int main(int argc, char* argv[])
if(!eh.errorsReported()) if(!eh.errorsReported())
{ {
DOM::Document<std::string> doc = domParser.getDocument(); Arabica::DOM::Document<std::string> doc = domParser.getDocument();
// doc.normalize(); // doc.normalize();
Arabica::XPath::XPathValuePtr<std::string> result; Arabica::XPath::XPathValuePtr<std::string> result;
result = xpath->evaluate(doc); result = xpath->evaluate(doc);
@ -66,7 +66,7 @@ int main(int argc, char* argv[])
const Arabica::XPath::NodeSet<std::string>& ns = result->asNodeSet(); const Arabica::XPath::NodeSet<std::string>& ns = result->asNodeSet();
for(unsigned int i = 0; i < ns.size(); ++i) for(unsigned int i = 0; i < ns.size(); ++i)
{ {
DOM::Node<std::string> n = ns[i]; Arabica::DOM::Node<std::string> n = ns[i];
std::cout << n << std::endl; std::cout << n << std::endl;
} }
} // if .. } // if ..

View file

@ -10,7 +10,7 @@
#include <XSLT/XSLT.hpp> #include <XSLT/XSLT.hpp>
void test_suite(int argc, const char* argv[]); void test_suite(int argc, const char* argv[]);
DOM::Document<std::string> buildDOM(const std::string& xml); Arabica::DOM::Document<std::string> buildDOM(const std::string& xml);
int main(int argc, const char* argv[]) int main(int argc, const char* argv[])
{ {
@ -43,7 +43,7 @@ int main(int argc, const char* argv[])
stylesheet->set_error_output(errors); stylesheet->set_error_output(errors);
DOM::Document<std::string> document = buildDOM(argv[1]); Arabica::DOM::Document<std::string> document = buildDOM(argv[1]);
if(document == 0) if(document == 0)
{ {
std::cerr << "Could not parse XML source" << std::endl; std::cerr << "Could not parse XML source" << std::endl;
@ -62,10 +62,10 @@ int main(int argc, const char* argv[])
return 0; return 0;
} // main } // main
DOM::Document<std::string> buildDOM(const std::string& filename) Arabica::DOM::Document<std::string> buildDOM(const std::string& filename)
{ {
Arabica::SAX::InputSource is(filename); Arabica::SAX::InputSource is(filename);
SAX2DOM::Parser<std::string> parser; Arabica::SAX2DOM::Parser<std::string> parser;
parser.parse(is); parser.parse(is);
return parser.getDocument(); return parser.getDocument();

View file

@ -9,6 +9,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -68,5 +70,6 @@ class Attr_impl : virtual public Node_impl<stringT>
}; // class Attr_impl }; // class Attr_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/Text.hpp> #include <DOM/Text.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
template<class stringT> class CDATASection_impl; template<class stringT> class CDATASection_impl;
@ -43,7 +45,7 @@ class CDATASection_impl : public virtual Text_impl<stringT>
virtual ~CDATASection_impl() { } virtual ~CDATASection_impl() { }
}; // CDATASection_impl }; // CDATASection_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
template<class stringT> class CharacterData_impl; template<class stringT> class CharacterData_impl;
@ -86,7 +88,7 @@ class CharacterData_impl : virtual public Node_impl<stringT>
virtual void replaceData(int offset, int count, const stringT& arg) = 0; virtual void replaceData(int offset, int count, const stringT& arg) = 0;
}; // CharacterData_impl }; // CharacterData_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/CharacterData.hpp> #include <DOM/CharacterData.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
template<class stringT> class Comment_impl; template<class stringT> class Comment_impl;
@ -35,7 +37,7 @@ class Comment_impl : virtual public CharacterData_impl<stringT>
virtual ~Comment_impl() { } virtual ~Comment_impl() { }
}; // Comment_impl }; // Comment_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <stdexcept> #include <stdexcept>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -82,6 +84,7 @@ private:
}; // class DOMException }; // class DOMException
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/Proxy.hpp> #include <DOM/Proxy.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -92,6 +94,7 @@ class DOMImplementation_impl
}; // class DOMImplementation_impl }; // class DOMImplementation_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif // JEZUK_DOM_NODE_H #endif // JEZUK_DOM_NODE_H
// end of file // end of file

View file

@ -24,6 +24,8 @@
#include <DOM/Traversal/DocumentTraversal.hpp> #include <DOM/Traversal/DocumentTraversal.hpp>
#include <DOM/Traversal/DocumentTraversalImpl.hpp> #include <DOM/Traversal/DocumentTraversalImpl.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -171,6 +173,7 @@ class Document_impl : virtual public Node_impl<stringT>
}; // class Document_impl }; // class Document_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -10,6 +10,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
#include <typeinfo> #include <typeinfo>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -38,6 +40,7 @@ class DocumentFragment_impl : virtual public Node_impl<stringT>
}; // class DocumentFragment_impl }; // class DocumentFragment_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -11,6 +11,8 @@
#include <DOM/NamedNodeMap.hpp> #include <DOM/NamedNodeMap.hpp>
#include <DOM/DOMImplementation.hpp> #include <DOM/DOMImplementation.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -73,6 +75,7 @@ class DocumentType_impl : virtual public Node_impl<stringT>
}; // class DocumentType_impl }; // class DocumentType_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -4,16 +4,18 @@
#include <DOM/SAX2DOM/SAX2DOM.h> #include <DOM/SAX2DOM/SAX2DOM.h>
#include <boost/function.hpp> #include <boost/function.hpp>
namespace Arabica
{
namespace DualMode namespace DualMode
{ {
template<class stringT, template<class stringT,
class string_adaptorT = Arabica::default_string_adaptor<stringT>, class string_adaptorT = Arabica::default_string_adaptor<stringT>,
class SAX_parser = Arabica::SAX::XMLReader<stringT, string_adaptorT> > class SAX_parser = Arabica::SAX::XMLReader<stringT, string_adaptorT> >
class Parser : public SAX2DOM::Parser<stringT, string_adaptorT, SAX_parser> class Parser : public Arabica::SAX2DOM::Parser<stringT, string_adaptorT, SAX_parser>
{ {
typedef SAX2DOM::Parser<stringT, string_adaptorT, SAX_parser> BaseT; typedef Arabica::SAX2DOM::Parser<stringT, string_adaptorT, SAX_parser> BaseT;
public: public:
typedef boost::function2<void, DOM::Node<stringT> &, DOM::Node<stringT> &> ElementHandlerT; typedef boost::function2<void, Arabica::DOM::Node<stringT> &, Arabica::DOM::Node<stringT> &> ElementHandlerT;
void setElementEndHandler(ElementHandlerT func) void setElementEndHandler(ElementHandlerT func)
{ {
@ -27,7 +29,7 @@ class Parser : public SAX2DOM::Parser<stringT, string_adaptorT, SAX_parser>
if(BaseT::currentNode() == 0) if(BaseT::currentNode() == 0)
return; return;
DOM::Node<stringT> child(BaseT::currentNode()); Arabica::DOM::Node<stringT> child(BaseT::currentNode());
BaseT::endElement(namespaceURI, localName, qName); BaseT::endElement(namespaceURI, localName, qName);
@ -40,5 +42,6 @@ class Parser : public SAX2DOM::Parser<stringT, string_adaptorT, SAX_parser>
}; // class Parser }; // class Parser
} // namespace DualMode } // namespace DualMode
} // namespace Arabica
#endif #endif

View file

@ -11,6 +11,8 @@
#include <DOM/Attr.hpp> #include <DOM/Attr.hpp>
#include <DOM/NamedNodeMap.hpp> #include <DOM/NamedNodeMap.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -97,6 +99,6 @@ class Element_impl : virtual public Node_impl<stringT>
}; // class Element_impl }; // class Element_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -9,6 +9,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -57,6 +59,6 @@ class Entity_impl : virtual public Node_impl<stringT>
}; // class Entity_impl }; // class Entity_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
template<class stringT> class EntityReference_impl; template<class stringT> class EntityReference_impl;
@ -35,8 +37,8 @@ class EntityReference_impl : virtual public Node_impl<stringT>
virtual ~EntityReference_impl () { } virtual ~EntityReference_impl () { }
}; // EntityReference_impl }; // EntityReference_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/ImplProxy.hpp> #include <DOM/ImplProxy.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -68,6 +70,7 @@ class DocumentEvent_impl : virtual public DOM::Impl
} // namespace Events } // namespace Events
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -1,6 +1,8 @@
#ifndef JEZUK_EVENTS_EVENT_H #ifndef JEZUK_EVENTS_EVENT_H
#define JEZUK_EVENTS_EVENT_H #define JEZUK_EVENTS_EVENT_H
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -96,6 +98,7 @@ class Event_impl : virtual public Impl
} // namespace Events } // namespace Events
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -9,6 +9,8 @@
#include <exception> #include <exception>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -29,5 +31,6 @@ public:
} // namespace Events } // namespace Events
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -6,6 +6,8 @@
// $Id$ // $Id$
//////////////////////////// ////////////////////////////
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -27,5 +29,6 @@ protected:
} // namespace Events } // namespace Events
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/ImplProxy.hpp> #include <DOM/ImplProxy.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -89,5 +91,6 @@ class EventTarget_impl : virtual public Impl
} // namespace Events } // namespace Events
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -3,6 +3,8 @@
#include <DOM/Events/Event.hpp> #include <DOM/Events/Event.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -102,6 +104,7 @@ class MutationEvent_impl : virtual public Event_impl<stringT>
} // namespace Events } // namespace Events
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -9,6 +9,8 @@
#include <DOM/Proxy.hpp> #include <DOM/Proxy.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -92,6 +94,7 @@ class NamedNodeMap_impl
}; // class NamedNodeMap_impl }; // class NamedNodeMap_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -11,6 +11,8 @@
#include <typeinfo> #include <typeinfo>
#include <algorithm> #include <algorithm>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -216,6 +218,7 @@ class Node_impl
}; // class Node_impl }; // class Node_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif // JEZUK_DOM_NODE_H #endif // JEZUK_DOM_NODE_H
// end of file // end of file

View file

@ -9,6 +9,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -63,6 +65,7 @@ class NodeList_impl
}; // class NodeList_impl }; // class NodeList_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -10,6 +10,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
#include <typeinfo> #include <typeinfo>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -54,6 +56,7 @@ class Notation_impl : virtual public Node_impl<stringT>
}; // class Notation_impl }; // class Notation_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -54,6 +56,6 @@ class ProcessingInstruction_impl : virtual public Node_impl<stringT>
}; // class ProcessingInstruction_impl }; // class ProcessingInstruction_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -1,6 +1,8 @@
#ifndef JEZUK_DOM_PROXY_H #ifndef JEZUK_DOM_PROXY_H
#define JEZUK_DOM_PROXY_H #define JEZUK_DOM_PROXY_H
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -67,6 +69,7 @@ class Proxy
}; // class Proxy }; // class Proxy
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -3,13 +3,15 @@
#include <DOM/Simple/DocumentTypeImpl.hpp> #include <DOM/Simple/DocumentTypeImpl.hpp>
namespace Arabica
{
namespace SAX2DOM namespace SAX2DOM
{ {
template<class stringT, class string_adaptorT> template<class stringT, class string_adaptorT>
class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT> class DocumentType : public Arabica::SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT>
{ {
typedef SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT> BaseDT; typedef Arabica::SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT> BaseDT;
public: public:
DocumentType(const stringT& qualifiedName, DocumentType(const stringT& qualifiedName,
const stringT& publicId, const stringT& publicId,
@ -22,30 +24,30 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// DOM::DOMImplementation extensions // DOM::DOMImplementation extensions
void addEntity(SimpleDOM::EntityImpl<stringT, string_adaptorT>* entity) void addEntity(Arabica::SimpleDOM::EntityImpl<stringT, string_adaptorT>* entity)
{ {
BaseDT::addEntity(entity); BaseDT::addEntity(entity);
} // addEntity } // addEntity
void addNotation(SimpleDOM::NotationImpl<stringT, string_adaptorT>* notation) void addNotation(Arabica::SimpleDOM::NotationImpl<stringT, string_adaptorT>* notation)
{ {
BaseDT::addNotation(notation); BaseDT::addNotation(notation);
} // addNotation } // addNotation
void addElement(const stringT& name) void addElement(const stringT& name)
{ {
BaseDT::addElement(new SimpleDOM::ElementImpl<stringT, string_adaptorT>(BaseDT::ownerDoc_, name)); BaseDT::addElement(new Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT>(BaseDT::ownerDoc_, name));
} // addElement } // addElement
void addDefaultAttr(const stringT& elementName, const stringT& attributeName, const stringT& attributeValue) void addDefaultAttr(const stringT& elementName, const stringT& attributeName, const stringT& attributeValue)
{ {
SimpleDOM::ElementImpl<stringT, string_adaptorT>* elem = dynamic_cast<SimpleDOM::ElementImpl<stringT, string_adaptorT>*>(BaseDT::getElements()->getNamedItem(elementName)); Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT>* elem = dynamic_cast<Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT>*>(BaseDT::getElements()->getNamedItem(elementName));
if(elem == 0) if(elem == 0)
{ {
addElement(elementName); addElement(elementName);
elem = dynamic_cast<SimpleDOM::ElementImpl<stringT, string_adaptorT>*>(BaseDT::getElements()->getNamedItem(elementName)); elem = dynamic_cast<Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT>*>(BaseDT::getElements()->getNamedItem(elementName));
} }
SimpleDOM::AttrImpl<stringT, string_adaptorT>* attr = new SimpleDOM::AttrImpl<stringT, string_adaptorT>(BaseDT::ownerDoc_, attributeName); Arabica::SimpleDOM::AttrImpl<stringT, string_adaptorT>* attr = new Arabica::SimpleDOM::AttrImpl<stringT, string_adaptorT>(BaseDT::ownerDoc_, attributeName);
attr->setValue(attributeValue); attr->setValue(attributeValue);
attr->setSpecified(false); attr->setSpecified(false);
elem->setAttributeNode(attr); elem->setAttributeNode(attr);
@ -58,6 +60,7 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT
}; // class DOMImplementation }; // class DOMImplementation
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -15,6 +15,8 @@
#include <SAX/helpers/PropertyNames.hpp> #include <SAX/helpers/PropertyNames.hpp>
#include <SAX/SAXParseException.hpp> #include <SAX/SAXParseException.hpp>
namespace Arabica
{
namespace SAX2DOM namespace SAX2DOM
{ {
@ -28,9 +30,9 @@ class Parser : protected Arabica::SAX::basic_DefaultHandler<stringT>
typedef Arabica::SAX::basic_LexicalHandler<stringT> LexicalHandlerT; typedef Arabica::SAX::basic_LexicalHandler<stringT> LexicalHandlerT;
typedef Arabica::SAX::basic_DeclHandler<stringT> DeclHandlerT; typedef Arabica::SAX::basic_DeclHandler<stringT> DeclHandlerT;
typedef Arabica::SAX::basic_InputSource<stringT> InputSourceT; typedef Arabica::SAX::basic_InputSource<stringT> InputSourceT;
typedef SimpleDOM::EntityImpl<stringT, string_adaptorT> EntityT; typedef Arabica::SimpleDOM::EntityImpl<stringT, string_adaptorT> EntityT;
typedef SimpleDOM::NotationImpl<stringT, string_adaptorT> NotationT; typedef Arabica::SimpleDOM::NotationImpl<stringT, string_adaptorT> NotationT;
typedef SimpleDOM::ElementImpl<stringT, string_adaptorT> ElementT; typedef Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT> ElementT;
typedef typename Arabica::SAX::basic_ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT; typedef typename Arabica::SAX::basic_ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
public: public:
@ -78,7 +80,7 @@ class Parser : protected Arabica::SAX::basic_DefaultHandler<stringT>
{ {
Arabica::SAX::PropertyNames<stringT, string_adaptorT> pNames; Arabica::SAX::PropertyNames<stringT, string_adaptorT> pNames;
DOM::DOMImplementation<stringT> di = SimpleDOM::DOMImplementation<stringT, string_adaptorT>::getDOMImplementation(); DOM::DOMImplementation<stringT> di = Arabica::SimpleDOM::DOMImplementation<stringT, string_adaptorT>::getDOMImplementation();
document_ = di.createDocument(string_adaptorT::construct_from_utf8(""), string_adaptorT::construct_from_utf8(""), 0); document_ = di.createDocument(string_adaptorT::construct_from_utf8(""), string_adaptorT::construct_from_utf8(""), 0);
currentNode_ = document_; currentNode_ = document_;
inCDATA_ = false; inCDATA_ = false;
@ -391,7 +393,8 @@ class Parser : protected Arabica::SAX::basic_DefaultHandler<stringT>
} // unparsedEntityDecl } // unparsedEntityDecl
}; // class Parser }; // class Parser
} // namespace } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -6,6 +6,8 @@
#include <DOM/Simple/TextImpl.hpp> #include <DOM/Simple/TextImpl.hpp>
#include <DOM/Simple/DocumentTypeImpl.hpp> #include <DOM/Simple/DocumentTypeImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -152,5 +154,6 @@ class AttrImpl : public DOM::Attr_impl<stringT>,
}; // class CDATAImpl }; // class CDATAImpl
} // namespace SimpleDOM } // namespace SimpleDOM
} // namespace Arabica
#endif #endif

View file

@ -5,6 +5,8 @@
#include <DOM/Simple/AttrImpl.hpp> #include <DOM/Simple/AttrImpl.hpp>
#include <DOM/Simple/AttrNSImpl.hpp> #include <DOM/Simple/AttrNSImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -176,6 +178,7 @@ class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/Simple/AttrImpl.hpp> #include <DOM/Simple/AttrImpl.hpp>
#include <DOM/Simple/Helpers.hpp> #include <DOM/Simple/Helpers.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -122,8 +124,8 @@ class AttrNSImpl : public AttrImpl<stringT, string_adaptorT>
bool hasNamespaceURI_; bool hasNamespaceURI_;
}; // class AttrNSImpl }; // class AttrNSImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -3,6 +3,8 @@
#include <DOM/CDATASection.hpp> #include <DOM/CDATASection.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -54,6 +56,7 @@ class CDATASectionImpl : public DOM::CDATASection_impl<stringT>,
}; // class CDATAImpl }; // class CDATAImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/CharacterData.hpp> #include <DOM/CharacterData.hpp>
#include <DOM/Simple/NodeImpl.hpp> #include <DOM/Simple/NodeImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -97,5 +99,7 @@ class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT>,
}; // class CharacterDataImpl }; // class CharacterDataImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/Comment.hpp> #include <DOM/Comment.hpp>
#include <DOM/Simple/CharacterDataImpl.hpp> #include <DOM/Simple/CharacterDataImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -40,6 +42,7 @@ class CommentImpl : public DOM::Comment_impl<stringT>,
}; // class CommentImpl }; // class CommentImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -7,6 +7,8 @@
#include <DOM/Simple/DocumentTypeImpl.hpp> #include <DOM/Simple/DocumentTypeImpl.hpp>
#include <Utils/StringAdaptor.hpp> #include <Utils/StringAdaptor.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -87,6 +89,7 @@ class DOMImplementationImpl : public DOM::DOMImplementation_impl<stringT>
}; // class DOMImplementationImpl }; // class DOMImplementationImpl
} // namespace Simple } // namespace Simple
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -3,6 +3,8 @@
#include <DOM/DocumentFragment.hpp> #include <DOM/DocumentFragment.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -61,8 +63,8 @@ class DocumentFragmentImpl : public DOM::DocumentFragment_impl<stringT>,
} // checkChildType } // checkChildType
}; // class DocumentFragmentImpl }; // class DocumentFragmentImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -20,6 +20,8 @@
#include <list> #include <list>
#include <algorithm> #include <algorithm>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -489,7 +491,8 @@ class DocumentImpl : public DOM::Document_impl<stringT>,
const stringT empty_; const stringT empty_;
}; // class DocumentImpl }; // class DocumentImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -5,6 +5,8 @@
#include <DOM/Simple/NodeImpl.hpp> #include <DOM/Simple/NodeImpl.hpp>
#include <vector> #include <vector>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
template<class stringT, class string_adaptorT> class ElementImpl; template<class stringT, class string_adaptorT> class ElementImpl;
@ -124,7 +126,7 @@ class DocumentTypeImpl : public DOM::DocumentType_impl<stringT>,
} // getIDs } // getIDs
protected: protected:
void addEntity(SimpleDOM::EntityImpl<stringT, string_adaptorT>* entity) void addEntity(Arabica::SimpleDOM::EntityImpl<stringT, string_adaptorT>* entity)
{ {
entities_.setReadOnly(false); entities_.setReadOnly(false);
entity->setOwnerDoc(NodeT::ownerDoc_); entity->setOwnerDoc(NodeT::ownerDoc_);
@ -132,7 +134,7 @@ class DocumentTypeImpl : public DOM::DocumentType_impl<stringT>,
entities_.setReadOnly(true); entities_.setReadOnly(true);
} // setEntity } // setEntity
void addNotation(SimpleDOM::NotationImpl<stringT, string_adaptorT>* notation) void addNotation(Arabica::SimpleDOM::NotationImpl<stringT, string_adaptorT>* notation)
{ {
notations_.setReadOnly(false); notations_.setReadOnly(false);
notation->setOwnerDoc(NodeT::ownerDoc_); notation->setOwnerDoc(NodeT::ownerDoc_);
@ -140,7 +142,7 @@ class DocumentTypeImpl : public DOM::DocumentType_impl<stringT>,
notations_.setReadOnly(true); notations_.setReadOnly(true);
} // setNotation } // setNotation
void addElement(SimpleDOM::ElementImpl<stringT, string_adaptorT>* element) void addElement(Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT>* element)
{ {
if(elements_.getNamedItem(element->getNodeName()) != 0) if(elements_.getNamedItem(element->getNodeName()) != 0)
{ {
@ -171,6 +173,7 @@ class DocumentTypeImpl : public DOM::DocumentType_impl<stringT>,
}; // class DOMImplementation }; // class DOMImplementation
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -4,6 +4,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
#include <DOM/Simple/NodeImpl.hpp> #include <DOM/Simple/NodeImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -134,6 +136,6 @@ class ElementByTagList : public DOM::NodeList_impl<stringT>
}; // class ElementByTagList }; // class ElementByTagList
} // namespace SimpleDOM } // namespace SimpleDOM
} // namespace Arabica
#endif #endif

View file

@ -6,6 +6,8 @@
#include <DOM/Simple/ElementByTagImpl.hpp> #include <DOM/Simple/ElementByTagImpl.hpp>
#include <DOM/Simple/AttrMap.hpp> #include <DOM/Simple/AttrMap.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -193,8 +195,8 @@ class ElementImpl : public DOM::Element_impl<stringT>,
stringT const* tagName_; stringT const* tagName_;
}; // class ElementImpl }; // class ElementImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/Simple/ElementImpl.hpp> #include <DOM/Simple/ElementImpl.hpp>
#include <DOM/Simple/Helpers.hpp> #include <DOM/Simple/Helpers.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -115,8 +117,8 @@ class ElementNSImpl : public ElementImpl<stringT, string_adaptorT>
bool hasNamespaceURI_; bool hasNamespaceURI_;
}; // class ElementNSImpl }; // class ElementNSImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/Entity.hpp> #include <DOM/Entity.hpp>
#include <DOM/Simple/NodeImpl.hpp> #include <DOM/Simple/NodeImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -82,8 +84,8 @@ class EntityImpl : public DOM::Entity_impl<stringT>,
stringT notationName_; stringT notationName_;
}; // class EntityImpl }; // class EntityImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -3,6 +3,8 @@
#include <DOM/EntityReference.hpp> #include <DOM/EntityReference.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -64,8 +66,8 @@ class EntityReferenceImpl : public DOM::EntityReference_impl<stringT>,
stringT name_; stringT name_;
}; // class EntityReferenceImpl }; // class EntityReferenceImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
#include <utility> #include <utility>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -48,6 +50,7 @@ std::pair<bool, stringT> checkPrefixAndNamespace(bool hasPrefix,
} // checkPrefixAndNamespace } // checkPrefixAndNamespace
} // namespace SimpleDOM } // namespace SimpleDOM
} // namespace Arabica
#endif #endif

View file

@ -7,15 +7,17 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
template<class stringT, class string_adaptorT> template<class stringT, class string_adaptorT>
class nameIs : public std::unary_function<SimpleDOM::NodeImpl<stringT, string_adaptorT>*, bool> class nameIs : public std::unary_function<Arabica::SimpleDOM::NodeImpl<stringT, string_adaptorT>*, bool>
{ {
public: public:
nameIs(const stringT& name) : name_(name) { } nameIs(const stringT& name) : name_(name) { }
bool operator()(const SimpleDOM::NodeImpl<stringT, string_adaptorT>* node) const bool operator()(const Arabica::SimpleDOM::NodeImpl<stringT, string_adaptorT>* node) const
{ {
return (node->getNodeName() == name_); return (node->getNodeName() == name_);
} // operator() } // operator()
@ -211,6 +213,7 @@ class NamedNodeMapImpl : public DOM::NamedNodeMap_impl<stringT>
}; // class NamedNodeMapImpl }; // class NamedNodeMapImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -14,6 +14,8 @@
//#include <iostream> //#include <iostream>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -502,6 +504,7 @@ class NodeImplWithChildren : public NodeImpl<stringT, string_adaptorT>,
}; // class NodeImplWithChildren }; // class NodeImplWithChildren
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif // JEZUK_DOM_NODE_H #endif // JEZUK_DOM_NODE_H
// end of file // end of file

View file

@ -4,6 +4,8 @@
#include <DOM/Notation.hpp> #include <DOM/Notation.hpp>
#include <DOM/Simple/NodeImpl.hpp> #include <DOM/Simple/NodeImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -68,6 +70,7 @@ class NotationImpl : public DOM::Notation_impl<stringT>,
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/ProcessingInstruction.hpp> #include <DOM/ProcessingInstruction.hpp>
#include <DOM/Simple/NodeImpl.hpp> #include <DOM/Simple/NodeImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -68,6 +70,7 @@ class ProcessingInstructionImpl : public DOM::ProcessingInstruction_impl<stringT
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -4,6 +4,8 @@
#include <DOM/Text.hpp> #include <DOM/Text.hpp>
#include <DOM/Simple/CharacterDataImpl.hpp> #include <DOM/Simple/CharacterDataImpl.hpp>
namespace Arabica
{
namespace SimpleDOM namespace SimpleDOM
{ {
@ -55,6 +57,7 @@ class TextImpl : public DOM::Text_impl<stringT>,
}; // class TextImpl }; // class TextImpl
} // namespace SAX2DOM } // namespace SAX2DOM
} // namespace Arabica
#endif #endif

View file

@ -9,6 +9,8 @@
#include <DOM/CharacterData.hpp> #include <DOM/CharacterData.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
template<class stringT> class Text_impl; template<class stringT> class Text_impl;
@ -54,6 +56,7 @@ class Text_impl : virtual public CharacterData_impl<stringT>
}; // Text_impl }; // Text_impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -13,6 +13,8 @@
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
#include <DOM/Traversal/TraversalImpl.hpp> #include <DOM/Traversal/TraversalImpl.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -124,6 +126,7 @@ class DocumentTraversal_impl : virtual public TraversalImpl
} // namespace Traversal } // namespace Traversal
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -9,6 +9,8 @@
#include <DOM/Traversal/TreeWalkerImpl.hpp> #include <DOM/Traversal/TreeWalkerImpl.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
namespace Traversal namespace Traversal
@ -48,10 +50,9 @@ DocumentTraversal<stringT> make_document_traversal_t()
return docTraversal; return docTraversal;
} }
} // namespace Traversal } // namespace Traversal
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif //JEZUK_DOM_TRAVERSAL_DOCUMENT_TRAVERSAL_IMPL_H #endif //JEZUK_DOM_TRAVERSAL_DOCUMENT_TRAVERSAL_IMPL_H
// end of file // end of file

View file

@ -7,6 +7,8 @@
// $Id$ // $Id$
///////////////////////////////////////// /////////////////////////////////////////
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -36,6 +38,7 @@ class NodeFilter
} // namespace Traversal } // namespace Traversal
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -10,6 +10,8 @@
#include <DOM/Traversal/NodeFilter.hpp> #include <DOM/Traversal/NodeFilter.hpp>
#include <DOM/Node.hpp> #include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -80,6 +82,7 @@ class NodeIterator_impl
} // namespace Traversal } // namespace Traversal
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -1,6 +1,8 @@
#ifndef JEZUK_DOM_TRAVERSAL_IMPL_H #ifndef JEZUK_DOM_TRAVERSAL_IMPL_H
#define JEZUK_DOM_TRAVERSAL_IMPL_H #define JEZUK_DOM_TRAVERSAL_IMPL_H
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -29,11 +31,9 @@ public:
private: private:
int refCount_; int refCount_;
}; //class TraversalImpl
}; //class Impl
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif //JEZUK_DOM_TRAVERSAL_IMPL_H #endif //JEZUK_DOM_TRAVERSAL_IMPL_H

View file

@ -11,6 +11,8 @@
#include <DOM/Traversal/NodeFilter.hpp> #include <DOM/Traversal/NodeFilter.hpp>
#include <DOM/Traversal/TraversalImpl.hpp> #include <DOM/Traversal/TraversalImpl.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -104,6 +106,7 @@ class TreeWalker_impl : public TraversalImpl
} // namespace Traversal } // namespace Traversal
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif
// end of file // end of file

View file

@ -9,7 +9,8 @@
#include <DOM/Traversal/DocumentTraversal.hpp> #include <DOM/Traversal/DocumentTraversal.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
namespace Traversal namespace Traversal
@ -297,5 +298,6 @@ private:
} // namespace Traversal } // namespace Traversal
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif //JEZUK_DOM_TRAVERSAL_TREEWALKER_IMPL_H #endif //JEZUK_DOM_TRAVERSAL_TREEWALKER_IMPL_H

View file

@ -12,7 +12,7 @@
// exists for the DOM::Node's string_type. // exists for the DOM::Node's string_type.
// //
// e.g. // e.g.
// SAX2DOM::Parser<std::wstring> domParser; // Arabica::SAX2DOM::Parser<std::wstring> domParser;
// SAX::wInputSource is; // SAX::wInputSource is;
// ... load instance from somewhere ... // ... load instance from somewhere ...
// domParser.parse(is); // domParser.parse(is);
@ -29,6 +29,8 @@
#include <XML/UnicodeCharacters.hpp> #include <XML/UnicodeCharacters.hpp>
#include <XML/escaper.hpp> #include <XML/escaper.hpp>
namespace Arabica
{
namespace DOM namespace DOM
{ {
@ -302,4 +304,6 @@ operator<<(std::basic_ostream<charT, traitsT>& stream,
} // operator<< } // operator<<
} // namespace DOM } // namespace DOM
} // namespace Arabica
#endif #endif

View file

@ -20,13 +20,13 @@ namespace impl
{ {
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> > template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
class NamespaceNodeImpl : public SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT> class NamespaceNodeImpl : public Arabica::SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT>
{ {
typedef SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT> NodeT; typedef Arabica::SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT> NodeT;
public: public:
NamespaceNodeImpl(stringT localname, NamespaceNodeImpl(stringT localname,
stringT value) : stringT value) :
SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT>(0), Arabica::SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT>(0),
localname_(localname), localname_(localname),
value_(value), value_(value),
ref_(0) ref_(0)

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class AttrTest : public TestCase class AttrTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class AttrTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void test1() void test1()
{ {
DOM::Attr<string_type> d; Arabica::DOM::Attr<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,8 +35,8 @@ class AttrTest : public TestCase
void test2() void test2()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttribute(SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = d.createAttribute(SA::construct_from_utf8("attr"));
assert(attr.getName() == SA::construct_from_utf8("attr")); assert(attr.getName() == SA::construct_from_utf8("attr"));
assert(attr.getNodeName() == SA::construct_from_utf8("attr")); assert(attr.getNodeName() == SA::construct_from_utf8("attr"));
assert(attr.getLocalName() == SA::construct_from_utf8("")); assert(attr.getLocalName() == SA::construct_from_utf8(""));
@ -48,8 +48,8 @@ class AttrTest : public TestCase
void test3() void test3()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("attr:value")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("attr:value"));
assert(attr.getName() == SA::construct_from_utf8("attr:value")); assert(attr.getName() == SA::construct_from_utf8("attr:value"));
assert(attr.getValue() == SA::construct_from_utf8("")); assert(attr.getValue() == SA::construct_from_utf8(""));
assert(attr.getNodeName() == SA::construct_from_utf8("attr:value")); assert(attr.getNodeName() == SA::construct_from_utf8("attr:value"));
@ -63,8 +63,8 @@ class AttrTest : public TestCase
void test4() void test4()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("attr"));
assert(attr.getName() == SA::construct_from_utf8("attr")); assert(attr.getName() == SA::construct_from_utf8("attr"));
assert(attr.getValue() == SA::construct_from_utf8("")); assert(attr.getValue() == SA::construct_from_utf8(""));
assert(attr.getNodeName() == SA::construct_from_utf8("attr")); assert(attr.getNodeName() == SA::construct_from_utf8("attr"));
@ -78,8 +78,8 @@ class AttrTest : public TestCase
void test5() void test5()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("attr:value")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("attr:value"));
attr.setPrefix(SA::construct_from_utf8("monkey")); attr.setPrefix(SA::construct_from_utf8("monkey"));
assert(attr.getName() == SA::construct_from_utf8("monkey:value")); assert(attr.getName() == SA::construct_from_utf8("monkey:value"));
@ -95,8 +95,8 @@ class AttrTest : public TestCase
void test6() void test6()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("value")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://attr"), SA::construct_from_utf8("value"));
attr.setPrefix(SA::construct_from_utf8("monkey")); attr.setPrefix(SA::construct_from_utf8("monkey"));
assert(attr.getName() == SA::construct_from_utf8("monkey:value")); assert(attr.getName() == SA::construct_from_utf8("monkey:value"));
@ -112,8 +112,8 @@ class AttrTest : public TestCase
void test7() void test7()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://www.w3.org/2000/xmlns/"), SA::construct_from_utf8("xmlns")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://www.w3.org/2000/xmlns/"), SA::construct_from_utf8("xmlns"));
assert(attr.getName() == SA::construct_from_utf8("xmlns")); assert(attr.getName() == SA::construct_from_utf8("xmlns"));
assert(attr.getValue() == SA::construct_from_utf8("")); assert(attr.getValue() == SA::construct_from_utf8(""));
@ -128,86 +128,86 @@ class AttrTest : public TestCase
void test8() void test8()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr; Arabica::DOM::Attr<string_type> attr;
try { try {
attr = d.createAttributeNS(SA::construct_from_utf8("ppopopop"), SA::construct_from_utf8("xmlns")); attr = d.createAttributeNS(SA::construct_from_utf8("ppopopop"), SA::construct_from_utf8("xmlns"));
} }
catch(const DOM::DOMException&) { } catch(const Arabica::DOM::DOMException&) { }
assert(attr == 0); assert(attr == 0);
} // test8 } // test8
void test9() void test9()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr; Arabica::DOM::Attr<string_type> attr;
try { try {
attr = d.createAttributeNS(SA::construct_from_utf8("ahuafh"), SA::construct_from_utf8("xmlns:billy")); attr = d.createAttributeNS(SA::construct_from_utf8("ahuafh"), SA::construct_from_utf8("xmlns:billy"));
} }
catch(const DOM::DOMException&) { } catch(const Arabica::DOM::DOMException&) { }
assert(attr == 0); assert(attr == 0);
} // test9 } // test9
void test10() void test10()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://www.w3.org/2000/xmlns/"), SA::construct_from_utf8("nothing:much")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://www.w3.org/2000/xmlns/"), SA::construct_from_utf8("nothing:much"));
try { try {
attr.setPrefix(SA::construct_from_utf8("xmlns")); attr.setPrefix(SA::construct_from_utf8("xmlns"));
} }
catch(const DOM::DOMException&) { } catch(const Arabica::DOM::DOMException&) { }
assert(attr.getPrefix() == SA::construct_from_utf8("xmlns")); assert(attr.getPrefix() == SA::construct_from_utf8("xmlns"));
} // test10 } // test10
void test11() void test11()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("charles"), SA::construct_from_utf8("nothing:much")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("charles"), SA::construct_from_utf8("nothing:much"));
try { try {
attr.setPrefix(SA::construct_from_utf8("xmlns")); attr.setPrefix(SA::construct_from_utf8("xmlns"));
} }
catch(const DOM::DOMException&) { } catch(const Arabica::DOM::DOMException&) { }
assert(attr.getPrefix() == SA::construct_from_utf8("nothing")); assert(attr.getPrefix() == SA::construct_from_utf8("nothing"));
} // test11 } // test11
void test12() void test12()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8(""), SA::construct_from_utf8("much")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8(""), SA::construct_from_utf8("much"));
try { try {
attr.setPrefix(SA::construct_from_utf8("charles")); attr.setPrefix(SA::construct_from_utf8("charles"));
} }
catch(const DOM::DOMException&) { } catch(const Arabica::DOM::DOMException&) { }
assert(attr.hasPrefix() == false); assert(attr.hasPrefix() == false);
} // test12 } // test12
void test13() void test13()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr; Arabica::DOM::Attr<string_type> attr;
try { try {
attr = d.createAttributeNS(SA::construct_from_utf8(""), SA::construct_from_utf8("trouser:pants")); attr = d.createAttributeNS(SA::construct_from_utf8(""), SA::construct_from_utf8("trouser:pants"));
} }
catch(const DOM::DOMException&) { } catch(const Arabica::DOM::DOMException&) { }
assert(attr == 0); assert(attr == 0);
} // test13 } // test13
void test14() void test14()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://www.w3.org/2000/xmlns/"), SA::construct_from_utf8("xmlns")); Arabica::DOM::Attr<string_type> attr = d.createAttributeNS(SA::construct_from_utf8("http://www.w3.org/2000/xmlns/"), SA::construct_from_utf8("xmlns"));
assert(attr.getName() == SA::construct_from_utf8("xmlns")); assert(attr.getName() == SA::construct_from_utf8("xmlns"));
assert(attr.getValue() == SA::construct_from_utf8("")); assert(attr.getValue() == SA::construct_from_utf8(""));

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class CDATATest : public TestCase class CDATATest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class CDATATest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void testNull() void testNull()
{ {
DOM::CDATASection<string_type> d; Arabica::DOM::CDATASection<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,8 +35,8 @@ class CDATATest : public TestCase
void testCreate() void testCreate()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::CDATASection<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data")); Arabica::DOM::CDATASection<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data"));
assert(t.getData() == SA::construct_from_utf8("some data")); assert(t.getData() == SA::construct_from_utf8("some data"));
assert(t.getNodeName() == SA::construct_from_utf8("#cdata-section")); assert(t.getNodeName() == SA::construct_from_utf8("#cdata-section"));
@ -48,32 +48,32 @@ class CDATATest : public TestCase
void testConversion() void testConversion()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::CDATASection<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data")); Arabica::DOM::CDATASection<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data"));
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(n != t); assert(n != t);
n = t; n = t;
assert(n == t); assert(n == t);
DOM::CDATASection<string_type> t2; Arabica::DOM::CDATASection<string_type> t2;
assert(n != t2); assert(n != t2);
t2 = DOM::CDATASection<string_type>(n); t2 = Arabica::DOM::CDATASection<string_type>(n);
assert(t == t2); assert(t == t2);
assert(n == t2); assert(n == t2);
DOM::CDATASection<string_type> t3; Arabica::DOM::CDATASection<string_type> t3;
t3 = t2; t3 = t2;
assert(t3 == t2); assert(t3 == t2);
assert(t3 == t); assert(t3 == t);
DOM::Comment<string_type> c = d.createComment(SA::construct_from_utf8("woo")); Arabica::DOM::Comment<string_type> c = d.createComment(SA::construct_from_utf8("woo"));
try { try {
t = DOM::CDATASection<string_type>(c); t = Arabica::DOM::CDATASection<string_type>(c);
assertImplementation(false, "converted comment to text"); assertImplementation(false, "converted comment to text");
} }
catch(const std::bad_cast&) { catch(const std::bad_cast&) {
@ -82,18 +82,18 @@ class CDATATest : public TestCase
void testConversionToText() void testConversionToText()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::CDATASection<string_type> cd = d.createCDATASection(SA::construct_from_utf8("some data")); Arabica::DOM::CDATASection<string_type> cd = d.createCDATASection(SA::construct_from_utf8("some data"));
DOM::Text<string_type> t; Arabica::DOM::Text<string_type> t;
assert(t == 0); assert(t == 0);
assert(cd != t); assert(cd != t);
t = cd; t = cd;
assert(cd == t); assert(cd == t);
DOM::CDATASection<string_type> cd2; Arabica::DOM::CDATASection<string_type> cd2;
assert(cd2 == 0); assert(cd2 == 0);
cd2 = DOM::CDATASection<string_type>(t); cd2 = Arabica::DOM::CDATASection<string_type>(t);
assert(cd2 == t); assert(cd2 == t);
assert(t == cd2); assert(t == cd2);
assert(cd == cd2); assert(cd == cd2);
@ -101,7 +101,7 @@ class CDATATest : public TestCase
t = d.createTextNode(SA::construct_from_utf8("boom")); t = d.createTextNode(SA::construct_from_utf8("boom"));
try { try {
cd = DOM::CDATASection<string_type>(t); cd = Arabica::DOM::CDATASection<string_type>(t);
assertImplementation(false, "converted text to CDATA"); assertImplementation(false, "converted text to CDATA");
} }
catch(const std::bad_cast&) { catch(const std::bad_cast&) {
@ -110,10 +110,10 @@ class CDATATest : public TestCase
void testEverythingElse() void testEverythingElse()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::CDATASection<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data")); Arabica::DOM::CDATASection<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data"));
assert(t.getNodeType() == DOM::Node<string_type>::CDATA_SECTION_NODE); assert(t.getNodeType() == Arabica::DOM::Node<string_type>::CDATA_SECTION_NODE);
assert(t.hasAttributes() == false); assert(t.hasAttributes() == false);
assert(t.getAttributes() == 0); assert(t.getAttributes() == 0);
assert(t.getChildNodes() == 0); assert(t.getChildNodes() == 0);
@ -121,9 +121,9 @@ class CDATATest : public TestCase
try try
{ {
t.appendChild(DOM::Node<string_type>()); t.appendChild(Arabica::DOM::Node<string_type>());
} }
catch(const DOM::DOMException&) catch(const Arabica::DOM::DOMException&)
{ {
} }

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class CharacterDataTest : public TestCase class CharacterDataTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class CharacterDataTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void testNull() void testNull()
{ {
DOM::CharacterData<string_type> d; Arabica::DOM::CharacterData<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,8 +35,8 @@ class CharacterDataTest : public TestCase
void testCreateText() void testCreateText()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::CharacterData<string_type> t = d.createTextNode(SA::construct_from_utf8("some data")); Arabica::DOM::CharacterData<string_type> t = d.createTextNode(SA::construct_from_utf8("some data"));
assert(t.getData() == SA::construct_from_utf8("some data")); assert(t.getData() == SA::construct_from_utf8("some data"));
assert(t.getNodeName() == SA::construct_from_utf8("#text")); assert(t.getNodeName() == SA::construct_from_utf8("#text"));
@ -45,7 +45,7 @@ class CharacterDataTest : public TestCase
t.setData(SA::construct_from_utf8("newData")); t.setData(SA::construct_from_utf8("newData"));
assert(t.getData() == SA::construct_from_utf8("newData")); assert(t.getData() == SA::construct_from_utf8("newData"));
assert(t.getNodeType() == DOM::Node<string_type>::TEXT_NODE); assert(t.getNodeType() == Arabica::DOM::Node<string_type>::TEXT_NODE);
assert(t.hasAttributes() == false); assert(t.hasAttributes() == false);
assert(t.getAttributes() == 0); assert(t.getAttributes() == 0);
assert(t.getChildNodes() == 0); assert(t.getChildNodes() == 0);
@ -53,9 +53,9 @@ class CharacterDataTest : public TestCase
try try
{ {
t.appendChild(DOM::Node<string_type>()); t.appendChild(Arabica::DOM::Node<string_type>());
} }
catch(const DOM::DOMException&) catch(const Arabica::DOM::DOMException&)
{ {
} }
@ -67,8 +67,8 @@ class CharacterDataTest : public TestCase
void testCreateCDATA() void testCreateCDATA()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::CharacterData<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data")); Arabica::DOM::CharacterData<string_type> t = d.createCDATASection(SA::construct_from_utf8("some data"));
assert(t.getData() == SA::construct_from_utf8("some data")); assert(t.getData() == SA::construct_from_utf8("some data"));
assert(t.getNodeName() == SA::construct_from_utf8("#cdata-section")); assert(t.getNodeName() == SA::construct_from_utf8("#cdata-section"));
@ -77,7 +77,7 @@ class CharacterDataTest : public TestCase
t.setData(SA::construct_from_utf8("newData")); t.setData(SA::construct_from_utf8("newData"));
assert(t.getData() == SA::construct_from_utf8("newData")); assert(t.getData() == SA::construct_from_utf8("newData"));
assert(t.getNodeType() == DOM::Node<string_type>::CDATA_SECTION_NODE); assert(t.getNodeType() == Arabica::DOM::Node<string_type>::CDATA_SECTION_NODE);
assert(t.hasAttributes() == false); assert(t.hasAttributes() == false);
assert(t.getAttributes() == 0); assert(t.getAttributes() == 0);
assert(t.getChildNodes() == 0); assert(t.getChildNodes() == 0);
@ -85,9 +85,9 @@ class CharacterDataTest : public TestCase
try try
{ {
t.appendChild(DOM::Node<string_type>()); t.appendChild(Arabica::DOM::Node<string_type>());
} }
catch(const DOM::DOMException&) catch(const Arabica::DOM::DOMException&)
{ {
} }
@ -99,13 +99,13 @@ class CharacterDataTest : public TestCase
void testDownCasts() void testDownCasts()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::CDATASection<string_type> cd = d.createCDATASection(SA::construct_from_utf8("some data")); Arabica::DOM::CDATASection<string_type> cd = d.createCDATASection(SA::construct_from_utf8("some data"));
DOM::Text<string_type> t = cd; Arabica::DOM::Text<string_type> t = cd;
DOM::CharacterData<string_type> c = t; Arabica::DOM::CharacterData<string_type> c = t;
DOM::Node<string_type> n = c; Arabica::DOM::Node<string_type> n = c;
assert(c == cd); assert(c == cd);
assert(c == t); assert(c == t);
@ -116,11 +116,11 @@ class CharacterDataTest : public TestCase
void testTextUpCasts() void testTextUpCasts()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Node<string_type> n = d.createTextNode(SA::construct_from_utf8("some data")); Arabica::DOM::Node<string_type> n = d.createTextNode(SA::construct_from_utf8("some data"));
DOM::CharacterData<string_type> c = DOM::CharacterData<string_type>(n); Arabica::DOM::CharacterData<string_type> c = Arabica::DOM::CharacterData<string_type>(n);
DOM::Text<string_type> t = DOM::Text<string_type>(c); Arabica::DOM::Text<string_type> t = Arabica::DOM::Text<string_type>(c);
assert(c == t); assert(c == t);
assert(c == n); assert(c == n);
@ -129,12 +129,12 @@ class CharacterDataTest : public TestCase
void testCDATAUpCasts() void testCDATAUpCasts()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Node<string_type> n = d.createCDATASection(SA::construct_from_utf8("some data")); Arabica::DOM::Node<string_type> n = d.createCDATASection(SA::construct_from_utf8("some data"));
DOM::CharacterData<string_type> c = DOM::CharacterData<string_type>(n); Arabica::DOM::CharacterData<string_type> c = Arabica::DOM::CharacterData<string_type>(n);
DOM::Text<string_type> t = DOM::Text<string_type>(c); Arabica::DOM::Text<string_type> t = Arabica::DOM::Text<string_type>(c);
DOM::CDATASection<string_type> cd = DOM::CDATASection<string_type>(c); Arabica::DOM::CDATASection<string_type> cd = Arabica::DOM::CDATASection<string_type>(c);
assert(c == cd); assert(c == cd);
assert(c == t); assert(c == t);

View file

@ -23,11 +23,11 @@ class DOMImplementationTest : public TestCase
void testNull() void testNull()
{ {
DOM::DOMImplementation<string_type> di; Arabica::DOM::DOMImplementation<string_type> di;
assert(di == 0); assert(di == 0);
assert(!di); assert(!di);
DOM::DOMImplementation<string_type> di2 = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); Arabica::DOM::DOMImplementation<string_type> di2 = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
assert(di2 != 0); assert(di2 != 0);
assert(di2); assert(di2);
@ -41,7 +41,7 @@ class DOMImplementationTest : public TestCase
void testFeatures() void testFeatures()
{ {
DOM::DOMImplementation<string_type> di = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); Arabica::DOM::DOMImplementation<string_type> di = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("")) == true); assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("")) == true);
assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("1.0")) == true); assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("1.0")) == true);

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class DocumentTest : public TestCase class DocumentTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
@ -22,13 +22,13 @@ class DocumentTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void testNull() void testNull()
{ {
DOM::Document<string_type> d; Arabica::DOM::Document<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -38,13 +38,13 @@ class DocumentTest : public TestCase
void testAssignment() void testAssignment()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
assert(d != 0); assert(d != 0);
assert(d); assert(d);
assert(d.getNodeName() == SA::construct_from_utf8("#document")); assert(d.getNodeName() == SA::construct_from_utf8("#document"));
assert(d.getNodeValue() == SA::construct_from_utf8("")); assert(d.getNodeValue() == SA::construct_from_utf8(""));
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(n == 0); assert(n == 0);
assert(!n); assert(!n);
assert(n != d); assert(n != d);
@ -53,16 +53,16 @@ class DocumentTest : public TestCase
assert(n); assert(n);
assert(n == d); assert(n == d);
assert(d == DOM::Document<string_type>(n)); assert(d == Arabica::DOM::Document<string_type>(n));
DOM::Document<string_type> d2; Arabica::DOM::Document<string_type> d2;
assert(d != d2); assert(d != d2);
assert(d2!= d); assert(d2!= d);
d2 = d; d2 = d;
assert(d == d2); assert(d == d2);
assert(d2 == d); assert(d2 == d);
DOM::Document<string_type> d3 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d3 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
assert(d != d3); assert(d != d3);
assert(d3!= d); assert(d3!= d);
d3 = d; d3 = d;
@ -72,11 +72,11 @@ class DocumentTest : public TestCase
void testDocElem() void testDocElem()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::NodeList<string_type> nl = d.getChildNodes(); Arabica::DOM::NodeList<string_type> nl = d.getChildNodes();
assert(nl.getLength() == 0); assert(nl.getLength() == 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
assert(elem.getParentNode() == 0); assert(elem.getParentNode() == 0);
assert(elem.getOwnerDocument() == d); assert(elem.getOwnerDocument() == d);
@ -89,12 +89,12 @@ class DocumentTest : public TestCase
assert(d.getFirstChild() == elem); assert(d.getFirstChild() == elem);
assert(nl.item(0) == elem); assert(nl.item(0) == elem);
DOM::Element<string_type> elem2 = d.createElement(SA::construct_from_utf8("root1")); Arabica::DOM::Element<string_type> elem2 = d.createElement(SA::construct_from_utf8("root1"));
try try
{ {
d.appendChild(elem2); d.appendChild(elem2);
} }
catch(const DOM::DOMException&) catch(const Arabica::DOM::DOMException&)
{ {
} }
@ -115,25 +115,25 @@ class DocumentTest : public TestCase
void test4() void test4()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
d.appendChild(d.createElement(SA::construct_from_utf8("root"))); d.appendChild(d.createElement(SA::construct_from_utf8("root")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child2"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child2")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child3"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child3")));
DOM::Document<string_type> clone = DOM::Document<string_type>(d.cloneNode(false)); Arabica::DOM::Document<string_type> clone = Arabica::DOM::Document<string_type>(d.cloneNode(false));
assert(clone.getFirstChild() == 0); assert(clone.getFirstChild() == 0);
} // test4 } // test4
void test5() void test5()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
d.appendChild(d.createElement(SA::construct_from_utf8("root"))); d.appendChild(d.createElement(SA::construct_from_utf8("root")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child2"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child2")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child3"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child3")));
DOM::Document<string_type> clone = DOM::Document<string_type>(d.cloneNode(true)); Arabica::DOM::Document<string_type> clone = Arabica::DOM::Document<string_type>(d.cloneNode(true));
assert(clone.getFirstChild().getNodeName() == SA::construct_from_utf8("root")); assert(clone.getFirstChild().getNodeName() == SA::construct_from_utf8("root"));
assert(clone.getFirstChild().getFirstChild().getNodeName() == SA::construct_from_utf8("child")); assert(clone.getFirstChild().getFirstChild().getNodeName() == SA::construct_from_utf8("child"));
assert(clone.getFirstChild().getLastChild().getNodeName() == SA::construct_from_utf8("child3")); assert(clone.getFirstChild().getLastChild().getNodeName() == SA::construct_from_utf8("child3"));
@ -141,30 +141,30 @@ class DocumentTest : public TestCase
void test6() void test6()
{ {
DOM::Document<string_type> d1 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d1 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Document<string_type> d2 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d2 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Attr<string_type> a1 = d1.createAttribute(SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> a1 = d1.createAttribute(SA::construct_from_utf8("attr"));
a1.setNodeValue(SA::construct_from_utf8("value")); a1.setNodeValue(SA::construct_from_utf8("value"));
DOM::Node<string_type> a2 = d2.importNode(a1, true); Arabica::DOM::Node<string_type> a2 = d2.importNode(a1, true);
assert(a2.getNodeType() == DOM::Node<string_type>::ATTRIBUTE_NODE); assert(a2.getNodeType() == Arabica::DOM::Node<string_type>::ATTRIBUTE_NODE);
assert(a2.getNodeName() == a1.getNodeName()); assert(a2.getNodeName() == a1.getNodeName());
assert(a2.getNodeValue() == a1.getNodeValue()); assert(a2.getNodeValue() == a1.getNodeValue());
assert(a2.getOwnerDocument() == d2); assert(a2.getOwnerDocument() == d2);
assert(a2.getChildNodes().getLength() == 1); assert(a2.getChildNodes().getLength() == 1);
assert(a2.getFirstChild().getNodeValue() == SA::construct_from_utf8("value")); assert(a2.getFirstChild().getNodeValue() == SA::construct_from_utf8("value"));
DOM::Attr<string_type> asAttr = DOM::Attr<string_type>(a2); Arabica::DOM::Attr<string_type> asAttr = Arabica::DOM::Attr<string_type>(a2);
assert(asAttr.getSpecified()); assert(asAttr.getSpecified());
assert(asAttr.getOwnerElement() == 0); assert(asAttr.getOwnerElement() == 0);
} // test6 } // test6
void test7() void test7()
{ {
DOM::Document<string_type> d1 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d1 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Document<string_type> d2 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d2 = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::DocumentFragment<string_type> df1 = d1.createDocumentFragment(); Arabica::DOM::DocumentFragment<string_type> df1 = d1.createDocumentFragment();
df1.appendChild(d1.createElement(SA::construct_from_utf8("c1"))); df1.appendChild(d1.createElement(SA::construct_from_utf8("c1")));
df1.appendChild(d1.createElement(SA::construct_from_utf8("c2"))); df1.appendChild(d1.createElement(SA::construct_from_utf8("c2")));
df1.appendChild(d1.createElement(SA::construct_from_utf8("c3"))); df1.appendChild(d1.createElement(SA::construct_from_utf8("c3")));
@ -174,16 +174,16 @@ class DocumentTest : public TestCase
df1.getFirstChild().appendChild(d1.createElement(SA::construct_from_utf8("c3"))); df1.getFirstChild().appendChild(d1.createElement(SA::construct_from_utf8("c3")));
df1.getFirstChild().appendChild(d1.createElement(SA::construct_from_utf8("c4"))); df1.getFirstChild().appendChild(d1.createElement(SA::construct_from_utf8("c4")));
DOM::Node<string_type> df2nc = d2.importNode(df1, false); Arabica::DOM::Node<string_type> df2nc = d2.importNode(df1, false);
assert(df2nc.getOwnerDocument() == d2); assert(df2nc.getOwnerDocument() == d2);
assert(df2nc.getChildNodes().getLength() == 0); assert(df2nc.getChildNodes().getLength() == 0);
DOM::Node<string_type> df2 = d2.importNode(df1, true); Arabica::DOM::Node<string_type> df2 = d2.importNode(df1, true);
assert(df2.getOwnerDocument() == d2); assert(df2.getOwnerDocument() == d2);
assert(df2.getNodeType() == DOM::Node<string_type>::DOCUMENT_FRAGMENT_NODE); assert(df2.getNodeType() == Arabica::DOM::Node<string_type>::DOCUMENT_FRAGMENT_NODE);
assert(df2.getChildNodes().getLength() == 4); assert(df2.getChildNodes().getLength() == 4);
assert(df2.getFirstChild().getChildNodes().getLength() == 4); assert(df2.getFirstChild().getChildNodes().getLength() == 4);
DOM::NodeList<string_type> c = df2.getChildNodes(); Arabica::DOM::NodeList<string_type> c = df2.getChildNodes();
assert(c.item(0).getNodeName() == SA::construct_from_utf8("c1")); assert(c.item(0).getNodeName() == SA::construct_from_utf8("c1"));
assert(c.item(1).getNodeName() == SA::construct_from_utf8("c2")); assert(c.item(1).getNodeName() == SA::construct_from_utf8("c2"));
assert(c.item(2).getNodeName() == SA::construct_from_utf8("c3")); assert(c.item(2).getNodeName() == SA::construct_from_utf8("c3"));
@ -201,7 +201,7 @@ class DocumentTest : public TestCase
void test8() void test8()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
d.appendChild(d.createElement(SA::construct_from_utf8("root"))); d.appendChild(d.createElement(SA::construct_from_utf8("root")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child")));
d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child"))); d.getFirstChild().appendChild(d.createElement(SA::construct_from_utf8("child")));
@ -212,7 +212,7 @@ class DocumentTest : public TestCase
assert(d.getElementsByTagName(SA::construct_from_utf8("*")).getLength() == 4); assert(d.getElementsByTagName(SA::construct_from_utf8("*")).getLength() == 4);
assert(d.getElementsByTagNameNS(SA::construct_from_utf8("*"), SA::construct_from_utf8("*")).getLength() == 4); assert(d.getElementsByTagNameNS(SA::construct_from_utf8("*"), SA::construct_from_utf8("*")).getLength() == 4);
DOM::NodeList<string_type> children = d.getElementsByTagName(SA::construct_from_utf8("child")); Arabica::DOM::NodeList<string_type> children = d.getElementsByTagName(SA::construct_from_utf8("child"));
assert(children.getLength() == 3); assert(children.getLength() == 3);
assert(children.item(0) == d.getFirstChild().getFirstChild()); assert(children.item(0) == d.getFirstChild().getFirstChild());
@ -224,13 +224,13 @@ class DocumentTest : public TestCase
d.getFirstChild().getLastChild().appendChild(d.createElement(SA::construct_from_utf8("donkey"))); d.getFirstChild().getLastChild().appendChild(d.createElement(SA::construct_from_utf8("donkey")));
assert(children.getLength() == 5); assert(children.getLength() == 5);
assert(DOM::Element<string_type>(d.getFirstChild().getFirstChild()).getElementsByTagName(SA::construct_from_utf8("donkey")).getLength() == 2); assert(Arabica::DOM::Element<string_type>(d.getFirstChild().getFirstChild()).getElementsByTagName(SA::construct_from_utf8("donkey")).getLength() == 2);
assert(DOM::Element<string_type>(d.getFirstChild()).getElementsByTagName(SA::construct_from_utf8("donkey")).getLength() == 4); assert(Arabica::DOM::Element<string_type>(d.getFirstChild()).getElementsByTagName(SA::construct_from_utf8("donkey")).getLength() == 4);
} // test8 } // test8
void test9() void test9()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0);
assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("root")); assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("root"));
assert(d.getFirstChild().hasPrefix() == false); assert(d.getFirstChild().hasPrefix() == false);
assert(d.getFirstChild().hasNamespaceURI() == false); assert(d.getFirstChild().hasNamespaceURI() == false);
@ -241,7 +241,7 @@ class DocumentTest : public TestCase
void test10() void test10()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("test:root"), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("test:root"), 0);
assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("test:root")); assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("test:root"));
assert(d.getFirstChild().hasPrefix() == true); assert(d.getFirstChild().hasPrefix() == true);
assert(d.getFirstChild().hasNamespaceURI() == true); assert(d.getFirstChild().hasNamespaceURI() == true);
@ -252,7 +252,7 @@ class DocumentTest : public TestCase
void test11() void test11()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("root"), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("root"), 0);
assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("root")); assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("root"));
assert(d.getFirstChild().hasPrefix() == false); assert(d.getFirstChild().hasPrefix() == false);
assert(d.getFirstChild().hasNamespaceURI() == true); assert(d.getFirstChild().hasNamespaceURI() == true);
@ -263,7 +263,7 @@ class DocumentTest : public TestCase
void test12() void test12()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("root"), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("root"), 0);
assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("root")); assert(d.getFirstChild().getNodeName() == SA::construct_from_utf8("root"));
assert(d.getFirstChild().hasPrefix() == false); assert(d.getFirstChild().hasPrefix() == false);
assert(d.getFirstChild().hasNamespaceURI() == true); assert(d.getFirstChild().hasNamespaceURI() == true);
@ -282,8 +282,8 @@ class DocumentTest : public TestCase
void test13() void test13()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("root"), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("root"), 0);
DOM::Element<string_type> root = d.getDocumentElement(); Arabica::DOM::Element<string_type> root = d.getDocumentElement();
root.appendChild(d.createTextNode(SA::construct_from_utf8("hello "))); root.appendChild(d.createTextNode(SA::construct_from_utf8("hello ")));
root.appendChild(d.createTextNode(SA::construct_from_utf8("mother, "))); root.appendChild(d.createTextNode(SA::construct_from_utf8("mother, ")));
root.appendChild(d.createTextNode(SA::construct_from_utf8("how "))); root.appendChild(d.createTextNode(SA::construct_from_utf8("how ")));

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class DocumentFragmentTest : public TestCase class DocumentFragmentTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class DocumentFragmentTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void test1() void test1()
{ {
DOM::DocumentFragment<string_type> d; Arabica::DOM::DocumentFragment<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,8 +35,8 @@ class DocumentFragmentTest : public TestCase
void test2() void test2()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::DocumentFragment<string_type> frag = d.createDocumentFragment(); Arabica::DOM::DocumentFragment<string_type> frag = d.createDocumentFragment();
frag.appendChild(d.createElement(SA::construct_from_utf8("child"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child")));
frag.appendChild(d.createElement(SA::construct_from_utf8("child2"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child2")));
@ -47,13 +47,13 @@ class DocumentFragmentTest : public TestCase
void test3() void test3()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::DocumentFragment<string_type> frag = d.createDocumentFragment(); Arabica::DOM::DocumentFragment<string_type> frag = d.createDocumentFragment();
frag.appendChild(d.createElement(SA::construct_from_utf8("child"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child")));
frag.appendChild(d.createElement(SA::construct_from_utf8("child2"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child2")));
frag.appendChild(d.createElement(SA::construct_from_utf8("child3"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child3")));
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
elem.appendChild(frag); elem.appendChild(frag);
assert(elem.getChildNodes().getLength() == 3); assert(elem.getChildNodes().getLength() == 3);
assert(elem.getFirstChild().getNodeName() == SA::construct_from_utf8("child")); assert(elem.getFirstChild().getNodeName() == SA::construct_from_utf8("child"));
@ -63,13 +63,13 @@ class DocumentFragmentTest : public TestCase
void test4() void test4()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::DocumentFragment<string_type> frag = d.createDocumentFragment(); Arabica::DOM::DocumentFragment<string_type> frag = d.createDocumentFragment();
frag.appendChild(d.createElement(SA::construct_from_utf8("child"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child")));
frag.appendChild(d.createElement(SA::construct_from_utf8("child2"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child2")));
frag.appendChild(d.createElement(SA::construct_from_utf8("child3"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child3")));
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
elem.appendChild(d.createElement(SA::construct_from_utf8("t"))); elem.appendChild(d.createElement(SA::construct_from_utf8("t")));
assert(elem.getChildNodes().getLength() == 1); assert(elem.getChildNodes().getLength() == 1);
@ -82,13 +82,13 @@ class DocumentFragmentTest : public TestCase
void test5() void test5()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::DocumentFragment<string_type> frag = d.createDocumentFragment(); Arabica::DOM::DocumentFragment<string_type> frag = d.createDocumentFragment();
frag.appendChild(d.createElement(SA::construct_from_utf8("child"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child")));
frag.appendChild(d.createElement(SA::construct_from_utf8("child2"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child2")));
frag.appendChild(d.createElement(SA::construct_from_utf8("child3"))); frag.appendChild(d.createElement(SA::construct_from_utf8("child3")));
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
elem.appendChild(d.createElement(SA::construct_from_utf8("t"))); elem.appendChild(d.createElement(SA::construct_from_utf8("t")));
assert(elem.getChildNodes().getLength() == 1); assert(elem.getChildNodes().getLength() == 1);

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class DocumentTypeTest : public TestCase class DocumentTypeTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class DocumentTypeTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void testNull() void testNull()
{ {
DOM::DocumentType<string_type> d; Arabica::DOM::DocumentType<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,28 +35,28 @@ class DocumentTypeTest : public TestCase
void testCreate() void testCreate()
{ {
DOM::DocumentType<string_type> d = factory.createDocumentType(SA::construct_from_utf8("charlie"), Arabica::DOM::DocumentType<string_type> d = factory.createDocumentType(SA::construct_from_utf8("charlie"),
SA::construct_from_utf8(""), SA::construct_from_utf8(""),
SA::construct_from_utf8("http://gruesome/")); SA::construct_from_utf8("http://gruesome/"));
assert(d != 0); assert(d != 0);
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(n == 0); assert(n == 0);
assert(n != d); assert(n != d);
n = d; n = d;
assert(n == d); assert(n == d);
assert(d == DOM::DocumentType<string_type>(n)); assert(d == Arabica::DOM::DocumentType<string_type>(n));
DOM::DocumentType<string_type> d2; Arabica::DOM::DocumentType<string_type> d2;
assert(d != d2); assert(d != d2);
assert(d2 != d); assert(d2 != d);
d2 = d; d2 = d;
assert(d == d2); assert(d == d2);
assert(d2 == d); assert(d2 == d);
DOM::DocumentType<string_type> d3 = factory.createDocumentType(SA::construct_from_utf8("billy"), Arabica::DOM::DocumentType<string_type> d3 = factory.createDocumentType(SA::construct_from_utf8("billy"),
SA::construct_from_utf8(""), SA::construct_from_utf8(""),
SA::construct_from_utf8("http://gruesome/")); SA::construct_from_utf8("http://gruesome/"));
assert(d != d3); assert(d != d3);
@ -68,15 +68,15 @@ class DocumentTypeTest : public TestCase
void testDoc() void testDoc()
{ {
DOM::DocumentType<string_type> d = factory.createDocumentType(SA::construct_from_utf8("charlie"), Arabica::DOM::DocumentType<string_type> d = factory.createDocumentType(SA::construct_from_utf8("charlie"),
SA::construct_from_utf8("sss"), SA::construct_from_utf8("sss"),
SA::construct_from_utf8("http://gruesome/")); SA::construct_from_utf8("http://gruesome/"));
DOM::Document<string_type> doc = factory.createDocument(SA::construct_from_utf8(""), Arabica::DOM::Document<string_type> doc = factory.createDocument(SA::construct_from_utf8(""),
SA::construct_from_utf8("doc"), SA::construct_from_utf8("doc"),
d); d);
DOM::DocumentType<string_type> dt = doc.getDoctype(); Arabica::DOM::DocumentType<string_type> dt = doc.getDoctype();
assert(dt.getPublicId() == SA::construct_from_utf8("sss")); assert(dt.getPublicId() == SA::construct_from_utf8("sss"));
assert(dt.getSystemId() == SA::construct_from_utf8("http://gruesome/")); assert(dt.getSystemId() == SA::construct_from_utf8("http://gruesome/"));
assert(dt.getNodeName() == SA::construct_from_utf8("charlie")); assert(dt.getNodeName() == SA::construct_from_utf8("charlie"));

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class ElementTest : public TestCase class ElementTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class ElementTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void test1() void test1()
{ {
DOM::Element<string_type> d; Arabica::DOM::Element<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,43 +35,43 @@ class ElementTest : public TestCase
void test2() void test2()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
assert(elem.getParentNode() == 0); assert(elem.getParentNode() == 0);
assert(elem.getOwnerDocument() == d); assert(elem.getOwnerDocument() == d);
d.appendChild(elem); d.appendChild(elem);
DOM::Element<string_type> child = d.createElement(SA::construct_from_utf8("child")); Arabica::DOM::Element<string_type> child = d.createElement(SA::construct_from_utf8("child"));
elem.appendChild(child); elem.appendChild(child);
} // test2 } // test2
void test3() void test3()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
assert(elem.getParentNode() == 0); assert(elem.getParentNode() == 0);
assert(elem.getOwnerDocument() == d); assert(elem.getOwnerDocument() == d);
d.appendChild(elem); d.appendChild(elem);
DOM::Attr<string_type> attr = d.createAttribute(SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = d.createAttribute(SA::construct_from_utf8("attr"));
attr.setNodeValue(SA::construct_from_utf8("trousers")); attr.setNodeValue(SA::construct_from_utf8("trousers"));
try try
{ {
elem.appendChild(attr); elem.appendChild(attr);
} }
catch(const DOM::DOMException&) { } catch(const Arabica::DOM::DOMException&) { }
assert(elem.getFirstChild() == 0); assert(elem.getFirstChild() == 0);
} // test3 } // test3
void test4() void test4()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
assert(elem.getParentNode() == 0); assert(elem.getParentNode() == 0);
assert(elem.getOwnerDocument() == d); assert(elem.getOwnerDocument() == d);
d.appendChild(elem); d.appendChild(elem);
DOM::Attr<string_type> attr = d.createAttribute(SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = d.createAttribute(SA::construct_from_utf8("attr"));
elem.setAttributeNode(attr); elem.setAttributeNode(attr);
assert(elem.getAttributeNode(SA::construct_from_utf8("attr")) == attr); assert(elem.getAttributeNode(SA::construct_from_utf8("attr")) == attr);
assert(elem.removeAttributeNode(attr) == attr); assert(elem.removeAttributeNode(attr) == attr);
@ -79,8 +79,8 @@ class ElementTest : public TestCase
void test5() void test5()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
assert(elem.getParentNode() == 0); assert(elem.getParentNode() == 0);
assert(elem.getOwnerDocument() == d); assert(elem.getOwnerDocument() == d);
d.appendChild(elem); d.appendChild(elem);
@ -91,15 +91,15 @@ class ElementTest : public TestCase
assert(elem.hasAttributes() == true); assert(elem.hasAttributes() == true);
assert(elem.hasAttribute(SA::construct_from_utf8("attr")) == true); assert(elem.hasAttribute(SA::construct_from_utf8("attr")) == true);
DOM::Node<string_type> n = elem.getAttributeNode(SA::construct_from_utf8("attr")); Arabica::DOM::Node<string_type> n = elem.getAttributeNode(SA::construct_from_utf8("attr"));
assert(n.getNodeValue() == SA::construct_from_utf8("poop")); assert(n.getNodeValue() == SA::construct_from_utf8("poop"));
assert(elem.setAttributeNode(d.createAttribute(SA::construct_from_utf8("attr"))) == n); assert(elem.setAttributeNode(d.createAttribute(SA::construct_from_utf8("attr"))) == n);
} // test5 } // test5
void test6() void test6()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
assert(elem.getParentNode() == 0); assert(elem.getParentNode() == 0);
assert(elem.getOwnerDocument() == d); assert(elem.getOwnerDocument() == d);
d.appendChild(elem); d.appendChild(elem);
@ -116,12 +116,12 @@ class ElementTest : public TestCase
void test7() void test7()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
elem.setAttribute(SA::construct_from_utf8("attr"), SA::construct_from_utf8("poop")); elem.setAttribute(SA::construct_from_utf8("attr"), SA::construct_from_utf8("poop"));
elem.appendChild(d.createElement(SA::construct_from_utf8("child"))); elem.appendChild(d.createElement(SA::construct_from_utf8("child")));
DOM::Element<string_type> e2 = DOM::Element<string_type>(elem.cloneNode(false)); Arabica::DOM::Element<string_type> e2 = Arabica::DOM::Element<string_type>(elem.cloneNode(false));
assert(e2.getOwnerDocument() == d); assert(e2.getOwnerDocument() == d);
assert(e2.getParentNode() == 0); assert(e2.getParentNode() == 0);
assert(e2.hasAttributes() == true); assert(e2.hasAttributes() == true);
@ -131,12 +131,12 @@ class ElementTest : public TestCase
void test8() void test8()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> elem = d.createElement(SA::construct_from_utf8("root"));
elem.setAttribute(SA::construct_from_utf8("attr"), SA::construct_from_utf8("poop")); elem.setAttribute(SA::construct_from_utf8("attr"), SA::construct_from_utf8("poop"));
elem.appendChild(d.createElement(SA::construct_from_utf8("child"))); elem.appendChild(d.createElement(SA::construct_from_utf8("child")));
DOM::Element<string_type> e2 = DOM::Element<string_type>(elem.cloneNode(true)); Arabica::DOM::Element<string_type> e2 = Arabica::DOM::Element<string_type>(elem.cloneNode(true));
assert(e2.getOwnerDocument() == d); assert(e2.getOwnerDocument() == d);
assert(e2.getParentNode() == 0); assert(e2.getParentNode() == 0);
assert(e2.hasAttributes() == true); assert(e2.hasAttributes() == true);

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class PITest : public TestCase class PITest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class PITest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void testNull() void testNull()
{ {
DOM::ProcessingInstruction<string_type> d; Arabica::DOM::ProcessingInstruction<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,8 +35,8 @@ class PITest : public TestCase
void testCreate() void testCreate()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::ProcessingInstruction<string_type> p = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data")); Arabica::DOM::ProcessingInstruction<string_type> p = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
assert(p.getTarget() == SA::construct_from_utf8("target")); assert(p.getTarget() == SA::construct_from_utf8("target"));
assert(p.getData() == SA::construct_from_utf8("data")); assert(p.getData() == SA::construct_from_utf8("data"));
@ -49,10 +49,10 @@ class PITest : public TestCase
void testConversion() void testConversion()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::ProcessingInstruction<string_type> pi = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data")); Arabica::DOM::ProcessingInstruction<string_type> pi = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(n != pi); assert(n != pi);
@ -60,20 +60,20 @@ class PITest : public TestCase
assert(n == pi); assert(n == pi);
DOM::ProcessingInstruction<string_type> pi2; Arabica::DOM::ProcessingInstruction<string_type> pi2;
assert(n != pi2); assert(n != pi2);
pi2 = DOM::ProcessingInstruction<string_type>(n); pi2 = Arabica::DOM::ProcessingInstruction<string_type>(n);
assert(pi == pi2); assert(pi == pi2);
assert(n == pi2); assert(n == pi2);
} // testConverstion } // testConverstion
void testEverythingElse() void testEverythingElse()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::ProcessingInstruction<string_type> pi = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data")); Arabica::DOM::ProcessingInstruction<string_type> pi = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
assert(pi.getNodeType() == DOM::Node<string_type>::PROCESSING_INSTRUCTION_NODE); assert(pi.getNodeType() == Arabica::DOM::Node<string_type>::PROCESSING_INSTRUCTION_NODE);
assert(pi.hasAttributes() == false); assert(pi.hasAttributes() == false);
assert(pi.getAttributes() == 0); assert(pi.getAttributes() == 0);
assert(pi.getChildNodes() == 0); assert(pi.getChildNodes() == 0);
@ -81,9 +81,9 @@ class PITest : public TestCase
try try
{ {
pi.appendChild(DOM::Node<string_type>()); pi.appendChild(Arabica::DOM::Node<string_type>());
} }
catch(const DOM::DOMException&) catch(const Arabica::DOM::DOMException&)
{ {
} }

View file

@ -23,14 +23,14 @@ class SAX2DOMTest : public TestCase
{ {
} // setUp } // setUp
DOM::Document<string_type> parse(string_type str) Arabica::DOM::Document<string_type> parse(string_type str)
{ {
std::stringstream ss; std::stringstream ss;
ss << SA::asStdString(str); ss << SA::asStdString(str);
Arabica::SAX::basic_InputSource<string_type> is(ss); Arabica::SAX::basic_InputSource<string_type> is(ss);
Arabica::SAX::CatchErrorHandler<string_type> eh; Arabica::SAX::CatchErrorHandler<string_type> eh;
SAX2DOM::Parser<string_type, string_adaptor> parser; Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
parser.setErrorHandler(eh); parser.setErrorHandler(eh);
parser.parse(is); parser.parse(is);
@ -42,8 +42,8 @@ class SAX2DOMTest : public TestCase
void test1() void test1()
{ {
DOM::Element<string_type> d; Arabica::DOM::Element<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -51,24 +51,24 @@ class SAX2DOMTest : public TestCase
void test2() void test2()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assert(elem.getParentNode() == d); assert(elem.getParentNode() == d);
assert(elem.getOwnerDocument() == d); assert(elem.getOwnerDocument() == d);
} // test2 } // test2
void test3() void test3()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"/>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assert(elem.hasAttributes() == true); assert(elem.hasAttributes() == true);
assert(elem.getAttribute(SA::construct_from_utf8("attr")) == SA::construct_from_utf8("poop")); assert(elem.getAttribute(SA::construct_from_utf8("attr")) == SA::construct_from_utf8("poop"));
} // test3 } // test3
void test4() void test4()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><child attr=\"poop\"/></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><child attr=\"poop\"/></root>"));
DOM::Element<string_type> elem = DOM::Element<string_type>(d.getDocumentElement().getFirstChild()); Arabica::DOM::Element<string_type> elem = Arabica::DOM::Element<string_type>(d.getDocumentElement().getFirstChild());
assert(SA::construct_from_utf8("child") == elem.getNodeName()); assert(SA::construct_from_utf8("child") == elem.getNodeName());
assertEquals(true, elem.hasAttributes()); assertEquals(true, elem.hasAttributes());
assert(SA::construct_from_utf8("poop") == elem.getAttribute(SA::construct_from_utf8("attr"))); assert(SA::construct_from_utf8("poop") == elem.getAttribute(SA::construct_from_utf8("attr")));
@ -76,44 +76,44 @@ class SAX2DOMTest : public TestCase
void test5() void test5()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<stuff:elem attr='something' xmlns:stuff='http://example.com/stuff'/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<stuff:elem attr='something' xmlns:stuff='http://example.com/stuff'/>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assertEquals(true, elem.hasNamespaceURI()); assertEquals(true, elem.hasNamespaceURI());
assert(SA::construct_from_utf8("http://example.com/stuff") == elem.getNamespaceURI()); assert(SA::construct_from_utf8("http://example.com/stuff") == elem.getNamespaceURI());
DOM::Attr<string_type> attr = elem.getAttributeNode(SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = elem.getAttributeNode(SA::construct_from_utf8("attr"));
assertEquals(false, attr.hasNamespaceURI()); assertEquals(false, attr.hasNamespaceURI());
} // test5 } // test5
void test6() void test6()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<stuff:elem stuff:attr='something' xmlns:stuff='http://example.com/stuff'/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<stuff:elem stuff:attr='something' xmlns:stuff='http://example.com/stuff'/>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assertEquals(true, elem.hasNamespaceURI()); assertEquals(true, elem.hasNamespaceURI());
assert(SA::construct_from_utf8("http://example.com/stuff") == elem.getNamespaceURI()); assert(SA::construct_from_utf8("http://example.com/stuff") == elem.getNamespaceURI());
DOM::Attr<string_type> attr = elem.getAttributeNodeNS(SA::construct_from_utf8("http://example.com/stuff"), SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = elem.getAttributeNodeNS(SA::construct_from_utf8("http://example.com/stuff"), SA::construct_from_utf8("attr"));
assertEquals(true, attr.hasNamespaceURI()); assertEquals(true, attr.hasNamespaceURI());
assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI()); assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI());
} // test6 } // test6
void test7() void test7()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<elem stuff:attr='something' xmlns:stuff='http://example.com/stuff'/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<elem stuff:attr='something' xmlns:stuff='http://example.com/stuff'/>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assertEquals(false, elem.hasNamespaceURI()); assertEquals(false, elem.hasNamespaceURI());
DOM::Attr<string_type> attr = elem.getAttributeNodeNS(SA::construct_from_utf8("http://example.com/stuff"), SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = elem.getAttributeNodeNS(SA::construct_from_utf8("http://example.com/stuff"), SA::construct_from_utf8("attr"));
assertEquals(true, attr.hasNamespaceURI()); assertEquals(true, attr.hasNamespaceURI());
assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI()); assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI());
} // test7 } // test7
void test8() void test8()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"><child/></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"><child/></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Element<string_type> e2 = DOM::Element<string_type>(elem.cloneNode(true)); Arabica::DOM::Element<string_type> e2 = Arabica::DOM::Element<string_type>(elem.cloneNode(true));
assert(e2.getOwnerDocument() == d); assert(e2.getOwnerDocument() == d);
assert(e2.getParentNode() == 0); assert(e2.getParentNode() == 0);
assert(e2.hasAttributes() == true); assert(e2.hasAttributes() == true);
@ -123,23 +123,23 @@ class SAX2DOMTest : public TestCase
void test9() void test9()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<elem attr='something' xmlns:stuff='http://example.com/stuff'/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<elem attr='something' xmlns:stuff='http://example.com/stuff'/>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assertEquals(false, elem.hasNamespaceURI()); assertEquals(false, elem.hasNamespaceURI());
DOM::Attr<string_type> attr = elem.getAttributeNode(SA::construct_from_utf8("attr")); Arabica::DOM::Attr<string_type> attr = elem.getAttributeNode(SA::construct_from_utf8("attr"));
assertEquals(false, attr.hasNamespaceURI()); assertEquals(false, attr.hasNamespaceURI());
} // test9 } // test9
void test10() void test10()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<elem stuff:attr='something' poop:attr='fail' xmlns:stuff='http://example.com/stuff'/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<elem stuff:attr='something' poop:attr='fail' xmlns:stuff='http://example.com/stuff'/>"));
assert(d == 0); assert(d == 0);
} // test10 } // test10
void test11() void test11()
{ {
SAX2DOM::Parser<string_type, string_adaptor> parser; Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
assert(parser.getFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation")) == false); assert(parser.getFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation")) == false);
parser.setFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation"), true); parser.setFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation"), true);
assert(parser.getFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation")) == true); assert(parser.getFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation")) == true);
@ -151,7 +151,7 @@ class SAX2DOMTest : public TestCase
void test12() void test12()
{ {
SAX2DOM::Parser<string_type, string_adaptor> parser; Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
try try
{ {
parser.getFeature(SA::construct_from_utf8("made up name")); parser.getFeature(SA::construct_from_utf8("made up name"));

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class SiblingsTest : public TestCase class SiblingsTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,19 +21,19 @@ class SiblingsTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void test1() void test1()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Element<string_type> root = d.createElement(SA::construct_from_utf8("root")); Arabica::DOM::Element<string_type> root = d.createElement(SA::construct_from_utf8("root"));
d.appendChild(root); d.appendChild(root);
assert(root.getPreviousSibling() == 0); assert(root.getPreviousSibling() == 0);
assert(root.getNextSibling() == 0); assert(root.getNextSibling() == 0);
DOM::ProcessingInstruction<string_type> p = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data")); Arabica::DOM::ProcessingInstruction<string_type> p = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
d.insertBefore(p, root); d.insertBefore(p, root);
assert(d.getFirstChild() == p); assert(d.getFirstChild() == p);
assert(d.getLastChild() == root); assert(d.getLastChild() == root);
@ -42,7 +42,7 @@ class SiblingsTest : public TestCase
assert(root.getPreviousSibling() == p); assert(root.getPreviousSibling() == p);
assert(root.getNextSibling() == 0); assert(root.getNextSibling() == 0);
DOM::ProcessingInstruction<string_type> p2 = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data")); Arabica::DOM::ProcessingInstruction<string_type> p2 = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
d.insertBefore(p2, root); d.insertBefore(p2, root);
assert(d.getFirstChild() == p); assert(d.getFirstChild() == p);
assert(d.getLastChild() == root); assert(d.getLastChild() == root);
@ -106,30 +106,30 @@ class SiblingsTest : public TestCase
void test2() void test2()
{ {
DOM::Element<string_type> root; Arabica::DOM::Element<string_type> root;
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
root = d.createElement(SA::construct_from_utf8("root")); root = d.createElement(SA::construct_from_utf8("root"));
d.appendChild(root); d.appendChild(root);
assert(root.getPreviousSibling() == 0); assert(root.getPreviousSibling() == 0);
assert(root.getNextSibling() == 0); assert(root.getNextSibling() == 0);
DOM::ProcessingInstruction<string_type> p = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data")); Arabica::DOM::ProcessingInstruction<string_type> p = d.createProcessingInstruction(SA::construct_from_utf8("target"), SA::construct_from_utf8("data"));
d.insertBefore(p, root); d.insertBefore(p, root);
} }
DOM::Node<string_type> n = root.getPreviousSibling(); Arabica::DOM::Node<string_type> n = root.getPreviousSibling();
DOM::ProcessingInstruction<string_type> p = DOM::ProcessingInstruction<string_type>(n); Arabica::DOM::ProcessingInstruction<string_type> p = Arabica::DOM::ProcessingInstruction<string_type>(n);
assert(p.getTarget() == SA::construct_from_utf8("target")); assert(p.getTarget() == SA::construct_from_utf8("target"));
assert(p.getData() == SA::construct_from_utf8("data")); assert(p.getData() == SA::construct_from_utf8("data"));
} // test2 } // test2
void test3() void test3()
{ {
DOM::Element<string_type> root; Arabica::DOM::Element<string_type> root;
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
root = d.createElement(SA::construct_from_utf8("root")); root = d.createElement(SA::construct_from_utf8("root"));
d.appendChild(root); d.appendChild(root);
@ -137,7 +137,7 @@ class SiblingsTest : public TestCase
root.appendChild(d.createElement(SA::construct_from_utf8("child2"))); root.appendChild(d.createElement(SA::construct_from_utf8("child2")));
} }
DOM::Node<string_type> c = root.getFirstChild(); Arabica::DOM::Node<string_type> c = root.getFirstChild();
assert(c.getNextSibling() == root.getLastChild()); assert(c.getNextSibling() == root.getLastChild());
root.purgeChild(c); root.purgeChild(c);
@ -148,9 +148,9 @@ class SiblingsTest : public TestCase
void test4() void test4()
{ {
DOM::Element<string_type> root; Arabica::DOM::Element<string_type> root;
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
root = d.createElement(SA::construct_from_utf8("root")); root = d.createElement(SA::construct_from_utf8("root"));
d.appendChild(root); d.appendChild(root);
@ -158,15 +158,15 @@ class SiblingsTest : public TestCase
root.appendChild(d.createElement(SA::construct_from_utf8("child2"))); root.appendChild(d.createElement(SA::construct_from_utf8("child2")));
} }
DOM::Node<string_type> c1 = root.getFirstChild(); Arabica::DOM::Node<string_type> c1 = root.getFirstChild();
DOM::Node<string_type> c2 = root.getLastChild(); Arabica::DOM::Node<string_type> c2 = root.getLastChild();
try { try {
c1.purgeChild(c2); c1.purgeChild(c2);
} }
catch(DOM::DOMException& e) catch(Arabica::DOM::DOMException& e)
{ {
assert(e.code() == DOM::DOMException::NOT_FOUND_ERR); assert(e.code() == Arabica::DOM::DOMException::NOT_FOUND_ERR);
} // catch } // catch

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class TextTest : public TestCase class TextTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory; Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -21,13 +21,13 @@ class TextTest : public TestCase
void setUp() void setUp()
{ {
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp } // setUp
void testNull() void testNull()
{ {
DOM::Text<string_type> d; Arabica::DOM::Text<string_type> d;
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(d == 0); assert(d == 0);
assert(n == 0); assert(n == 0);
assert(n == d); assert(n == d);
@ -35,8 +35,8 @@ class TextTest : public TestCase
void testCreate() void testCreate()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
DOM::Text<string_type> t = d.createTextNode(SA::construct_from_utf8("some data")); Arabica::DOM::Text<string_type> t = d.createTextNode(SA::construct_from_utf8("some data"));
assert(t.getData() == SA::construct_from_utf8("some data")); assert(t.getData() == SA::construct_from_utf8("some data"));
assert(t.getNodeName() == SA::construct_from_utf8("#text")); assert(t.getNodeName() == SA::construct_from_utf8("#text"));
@ -48,32 +48,32 @@ class TextTest : public TestCase
void testConversion() void testConversion()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Text<string_type> t = d.createTextNode(SA::construct_from_utf8("some data")); Arabica::DOM::Text<string_type> t = d.createTextNode(SA::construct_from_utf8("some data"));
DOM::Node<string_type> n; Arabica::DOM::Node<string_type> n;
assert(n != t); assert(n != t);
n = t; n = t;
assert(n == t); assert(n == t);
DOM::Text<string_type> t2; Arabica::DOM::Text<string_type> t2;
assert(n != t2); assert(n != t2);
t2 = DOM::Text<string_type>(n); t2 = Arabica::DOM::Text<string_type>(n);
assert(t == t2); assert(t == t2);
assert(n == t2); assert(n == t2);
DOM::Text<string_type> t3; Arabica::DOM::Text<string_type> t3;
t3 = t2; t3 = t2;
assert(t3 == t2); assert(t3 == t2);
assert(t3 == t); assert(t3 == t);
DOM::Comment<string_type> c = d.createComment(SA::construct_from_utf8("woo")); Arabica::DOM::Comment<string_type> c = d.createComment(SA::construct_from_utf8("woo"));
try { try {
t = DOM::Text<string_type>(c); t = Arabica::DOM::Text<string_type>(c);
assertImplementation(false, "converted comment to text"); assertImplementation(false, "converted comment to text");
} }
catch(const std::bad_cast&) { catch(const std::bad_cast&) {
@ -82,10 +82,10 @@ class TextTest : public TestCase
void testEverythingElse() void testEverythingElse()
{ {
DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0); Arabica::DOM::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
DOM::Text<string_type> t = d.createTextNode(SA::construct_from_utf8("some data")); Arabica::DOM::Text<string_type> t = d.createTextNode(SA::construct_from_utf8("some data"));
assert(t.getNodeType() == DOM::Node<string_type>::TEXT_NODE); assert(t.getNodeType() == Arabica::DOM::Node<string_type>::TEXT_NODE);
assert(t.hasAttributes() == false); assert(t.hasAttributes() == false);
assert(t.getAttributes() == 0); assert(t.getAttributes() == 0);
assert(t.getChildNodes() == 0); assert(t.getChildNodes() == 0);
@ -93,9 +93,9 @@ class TextTest : public TestCase
try try
{ {
t.appendChild(DOM::Node<string_type>()); t.appendChild(Arabica::DOM::Node<string_type>());
} }
catch(const DOM::DOMException&) catch(const Arabica::DOM::DOMException&)
{ {
} }

View file

@ -23,14 +23,14 @@ class TreeWalkerTest : public TestCase
{ {
} // setUp } // setUp
DOM::Document<string_type> parse(string_type str) Arabica::DOM::Document<string_type> parse(string_type str)
{ {
std::stringstream ss; std::stringstream ss;
ss << SA::asStdString(str); ss << SA::asStdString(str);
Arabica::SAX::basic_InputSource<string_type> is(ss); Arabica::SAX::basic_InputSource<string_type> is(ss);
Arabica::SAX::CatchErrorHandler<string_type> eh; Arabica::SAX::CatchErrorHandler<string_type> eh;
SAX2DOM::Parser<string_type, string_adaptor> parser; Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
parser.setErrorHandler(eh); parser.setErrorHandler(eh);
parser.parse(is); parser.parse(is);
@ -42,14 +42,14 @@ class TreeWalkerTest : public TestCase
void test1() void test1()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL, Arabica::DOM::Traversal::SHOW_ALL,
true); true);
assert(walker.getWhatToShow() == DOM::Traversal::SHOW_ALL); assert(walker.getWhatToShow() == Arabica::DOM::Traversal::SHOW_ALL);
assert(walker.getFilter() == 0); assert(walker.getFilter() == 0);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == 0); assert(walker.nextNode() == 0);
@ -57,12 +57,12 @@ class TreeWalkerTest : public TestCase
void test2() void test2()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp/><poop/></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp/><poop/></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL, Arabica::DOM::Traversal::SHOW_ALL,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild()); assert(walker.nextNode() == elem.getFirstChild());
@ -72,12 +72,12 @@ class TreeWalkerTest : public TestCase
void test3() void test3()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL, Arabica::DOM::Traversal::SHOW_ALL,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild()); assert(walker.nextNode() == elem.getFirstChild());
@ -89,12 +89,12 @@ class TreeWalkerTest : public TestCase
void test4() void test4()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ELEMENT, Arabica::DOM::Traversal::SHOW_ELEMENT,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild()); assert(walker.nextNode() == elem.getFirstChild());
@ -104,12 +104,12 @@ class TreeWalkerTest : public TestCase
void test5() void test5()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_TEXT, Arabica::DOM::Traversal::SHOW_TEXT,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild().getFirstChild()); assert(walker.nextNode() == elem.getFirstChild().getFirstChild());
@ -119,12 +119,12 @@ class TreeWalkerTest : public TestCase
void test6() void test6()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop>mother</poop></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop>mother</poop></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL, Arabica::DOM::Traversal::SHOW_ALL,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild()); assert(walker.nextNode() == elem.getFirstChild());
@ -136,12 +136,12 @@ class TreeWalkerTest : public TestCase
void test7() void test7()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop><!--woo-->mother</poop></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop><!--woo-->mother</poop></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_COMMENT, Arabica::DOM::Traversal::SHOW_COMMENT,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getLastChild().getFirstChild()); assert(walker.nextNode() == elem.getLastChild().getFirstChild());
@ -150,26 +150,26 @@ class TreeWalkerTest : public TestCase
void test8() void test8()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop><!--woo-->mother<?nard nurb?></poop></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop><!--woo-->mother<?nard nurb?></poop></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_PROCESSING_INSTRUCTION, Arabica::DOM::Traversal::SHOW_PROCESSING_INSTRUCTION,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getLastChild().getLastChild()); assert(walker.nextNode() == elem.getLastChild().getLastChild());
assert(walker.nextNode() == 0); assert(walker.nextNode() == 0);
} // test8 } // test8
class TestFilter : public DOM::Traversal::NodeFilter<string_type> class TestFilter : public Arabica::DOM::Traversal::NodeFilter<string_type>
{ {
typedef DOM::Traversal::NodeFilter<string_type> base_t; typedef Arabica::DOM::Traversal::NodeFilter<string_type> base_t;
public: public:
typedef typename DOM::Traversal::NodeFilter<string_type>::Result Result; typedef typename Arabica::DOM::Traversal::NodeFilter<string_type>::Result Result;
virtual Result acceptNode(const DOM::Node<string_type>& node) const virtual Result acceptNode(const Arabica::DOM::Node<string_type>& node) const
{ {
if(node.getFirstChild().getNodeType() == DOM::Node_base::COMMENT_NODE) if(node.getFirstChild().getNodeType() == Arabica::DOM::Node_base::COMMENT_NODE)
return base_t::FILTER_REJECT; return base_t::FILTER_REJECT;
return base_t::FILTER_ACCEPT; return base_t::FILTER_ACCEPT;
} // acceptNode } // acceptNode
@ -177,13 +177,13 @@ class TreeWalkerTest : public TestCase
void test9() void test9()
{ {
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop><!--woo-->mother<?nard nurb?></poop></root>")); Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop><!--woo-->mother<?nard nurb?></poop></root>"));
DOM::Element<string_type> elem = d.getDocumentElement(); Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal(); Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
TestFilter filter; TestFilter filter;
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(), Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ELEMENT, Arabica::DOM::Traversal::SHOW_ELEMENT,
filter, filter,
true); true);
assert(walker.getCurrentNode() == elem); assert(walker.getCurrentNode() == elem);

View file

@ -175,7 +175,7 @@ public:
} // test14 } // test14
private: private:
DOM::Node<string_type> dummy_; Arabica::DOM::Node<string_type> dummy_;
}; // ArithmeticTest }; // ArithmeticTest
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>

View file

@ -24,7 +24,7 @@ public:
void testParse() void testParse()
{ {
DOM::Node<string_type> dummy; Arabica::DOM::Node<string_type> dummy;
assertTrue(SA::construct_from_utf8("hello") == compileThis("hello")->evaluateAsString(dummy)); assertTrue(SA::construct_from_utf8("hello") == compileThis("hello")->evaluateAsString(dummy));
assertTrue(SA::construct_from_utf8("") == compileThis("{hello}")->evaluateAsString(dummy)); assertTrue(SA::construct_from_utf8("") == compileThis("{hello}")->evaluateAsString(dummy));
assertTrue(SA::construct_from_utf8("{hello}") == compileThis("{{hello}}")->evaluateAsString(dummy)); assertTrue(SA::construct_from_utf8("{hello}") == compileThis("{{hello}}")->evaluateAsString(dummy));

View file

@ -11,22 +11,22 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class AxisEnumeratorTest : public TestCase class AxisEnumeratorTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory_; Arabica::DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_; Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_; Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_; Arabica::DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_; Arabica::DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_; Arabica::DOM::Element<string_type> element3_;
DOM::Attr<string_type> attr_; Arabica::DOM::Attr<string_type> attr_;
DOM::Text<string_type> text_; Arabica::DOM::Text<string_type> text_;
DOM::Comment<string_type> comment_; Arabica::DOM::Comment<string_type> comment_;
DOM::ProcessingInstruction<string_type> processingInstruction_; Arabica::DOM::ProcessingInstruction<string_type> processingInstruction_;
public: public:
AxisEnumeratorTest(const std::string& name) : TestCase(name) AxisEnumeratorTest(const std::string& name) : TestCase(name)
@ -35,7 +35,7 @@ public:
void setUp() void setUp()
{ {
factory_ = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation(); factory_ = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
document_ = factory_.createDocument(string_adaptor::construct_from_utf8(""), string_adaptor::construct_from_utf8("root"), 0); document_ = factory_.createDocument(string_adaptor::construct_from_utf8(""), string_adaptor::construct_from_utf8("root"), 0);
root_ = document_.getDocumentElement(); root_ = document_.getDocumentElement();
@ -67,7 +67,7 @@ public:
void childTest1() void childTest1()
{ {
DOM::DocumentFragment<string_type> node; Arabica::DOM::DocumentFragment<string_type> node;
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::CHILD); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::CHILD);
assertTrue(*e == 0); assertTrue(*e == 0);
@ -76,7 +76,7 @@ public:
void childTest2() void childTest2()
{ {
DOM::Node<string_type> node; Arabica::DOM::Node<string_type> node;
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::CHILD); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::CHILD);
assertTrue(*e == 0); assertTrue(*e == 0);
@ -95,7 +95,7 @@ public:
assertTrue(element3_ == *e); assertTrue(element3_ == *e);
assertTrue(string_adaptor::construct_from_utf8("child3") == e->getNodeName()); assertTrue(string_adaptor::construct_from_utf8("child3") == e->getNodeName());
++e; ++e;
assertTrue(DOM::Node<string_type>() == *e); assertTrue(Arabica::DOM::Node<string_type>() == *e);
assertTrue(*e == 0); assertTrue(*e == 0);
} // test3 } // test3
@ -110,7 +110,7 @@ public:
void attributeTest1() void attributeTest1()
{ {
DOM::DocumentFragment<string_type> node; Arabica::DOM::DocumentFragment<string_type> node;
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::ATTRIBUTE); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::ATTRIBUTE);
assertTrue(*e == 0); assertTrue(*e == 0);
@ -119,7 +119,7 @@ public:
void attributeTest2() void attributeTest2()
{ {
DOM::Node<string_type> node; Arabica::DOM::Node<string_type> node;
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::ATTRIBUTE); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::ATTRIBUTE);
assertTrue(*e == 0); assertTrue(*e == 0);
@ -170,7 +170,7 @@ public:
void followingSiblingTest1() void followingSiblingTest1()
{ {
DOM::Node<string_type> node; Arabica::DOM::Node<string_type> node;
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::FOLLOWING_SIBLING); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::FOLLOWING_SIBLING);
assertTrue(*e == 0); assertTrue(*e == 0);
assertTrue(e.forward()); assertTrue(e.forward());
@ -214,7 +214,7 @@ public:
void precedingSiblingTest1() void precedingSiblingTest1()
{ {
DOM::Node<string_type> node; Arabica::DOM::Node<string_type> node;
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::PRECEDING_SIBLING); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::PRECEDING_SIBLING);
assertTrue(*e == 0); assertTrue(*e == 0);
assertTrue(e.reverse()); assertTrue(e.reverse());
@ -275,7 +275,7 @@ public:
void selfTest3() void selfTest3()
{ {
DOM::Node<string_type> node; Arabica::DOM::Node<string_type> node;
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::SELF); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(node, Arabica::XPath::SELF);
assertTrue(*e == 0); assertTrue(*e == 0);
} // selfTest3 } // selfTest3
@ -686,8 +686,8 @@ public:
void namespaceNodeTest1() void namespaceNodeTest1()
{ {
using namespace Arabica::XPath; using namespace Arabica::XPath;
DOM::Node<string_type> node(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri"))); Arabica::DOM::Node<string_type> node(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri")));
DOM::Node<string_type> node2; Arabica::DOM::Node<string_type> node2;
node2 = node; node2 = node;
} // namespaceNodeTest1 } // namespaceNodeTest1
@ -695,9 +695,9 @@ public:
void namespaceNodeTest2() void namespaceNodeTest2()
{ {
using namespace Arabica::XPath; using namespace Arabica::XPath;
DOM::Node<string_type> node; Arabica::DOM::Node<string_type> node;
{ {
DOM::Node<string_type> node2(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri"))); Arabica::DOM::Node<string_type> node2(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri")));
node = node2; node = node2;
} }
} // namespaceNodeTest2 } // namespaceNodeTest2
@ -705,9 +705,9 @@ public:
void namespaceNodeTest3() void namespaceNodeTest3()
{ {
using namespace Arabica::XPath; using namespace Arabica::XPath;
DOM::Node<string_type> node; Arabica::DOM::Node<string_type> node;
{ {
DOM::Node<string_type> node2(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri"))); Arabica::DOM::Node<string_type> node2(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri")));
node = node2; node = node2;
} }
node = 0; node = 0;
@ -716,7 +716,7 @@ public:
void namespaceNodeTest4() void namespaceNodeTest4()
{ {
using namespace Arabica::XPath; using namespace Arabica::XPath;
DOM::Node<string_type> node(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri"))); Arabica::DOM::Node<string_type> node(new impl::NamespaceNodeImpl<string_type, string_adaptor>(string_adaptor::construct_from_utf8("p"), string_adaptor::construct_from_utf8("test-uri")));
assertTrue(string_adaptor::construct_from_utf8("p") == node.getLocalName()); assertTrue(string_adaptor::construct_from_utf8("p") == node.getLocalName());
assertTrue(string_adaptor::construct_from_utf8("test-uri") == node.getNodeValue()); assertTrue(string_adaptor::construct_from_utf8("test-uri") == node.getNodeValue());
assertTrue(string_adaptor::construct_from_utf8("") == node.getNamespaceURI()); assertTrue(string_adaptor::construct_from_utf8("") == node.getNamespaceURI());
@ -727,7 +727,7 @@ public:
{ {
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(root_, Arabica::XPath::NAMESPACE); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(root_, Arabica::XPath::NAMESPACE);
assertTrue(*e != 0); assertTrue(*e != 0);
DOM::Node<string_type> ns = *e; Arabica::DOM::Node<string_type> ns = *e;
assertTrue(string_adaptor::construct_from_utf8("xml") == ns.getLocalName()); assertTrue(string_adaptor::construct_from_utf8("xml") == ns.getLocalName());
assertTrue(string_adaptor::construct_from_utf8("http://www.w3.org/XML/1998/namespace") == ns.getNodeValue()); assertTrue(string_adaptor::construct_from_utf8("http://www.w3.org/XML/1998/namespace") == ns.getNodeValue());
++e; ++e;
@ -741,7 +741,7 @@ public:
string_adaptor::construct_from_utf8("urn:test")); string_adaptor::construct_from_utf8("urn:test"));
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(root_, Arabica::XPath::NAMESPACE); Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(root_, Arabica::XPath::NAMESPACE);
assertTrue(*e != 0); assertTrue(*e != 0);
DOM::Node<string_type> ns = *e; Arabica::DOM::Node<string_type> ns = *e;
assertTrue(string_adaptor::construct_from_utf8("xml") == ns.getLocalName()); assertTrue(string_adaptor::construct_from_utf8("xml") == ns.getLocalName());
++e; ++e;
assertTrue(*e != 0); assertTrue(*e != 0);

View file

@ -65,7 +65,7 @@ public:
TestFunction(const std::vector<Arabica::XPath::XPathExpressionPtr<string_type> >& args) : TestFunction(const std::vector<Arabica::XPath::XPathExpressionPtr<string_type> >& args) :
Arabica::XPath::XPathFunction<string_type, string_adaptor>(0, 0, args) { } Arabica::XPath::XPathFunction<string_type, string_adaptor>(0, 0, args) { }
virtual Arabica::XPath::XPathValue<string_type>* evaluate(const DOM::Node<string_type>& context, virtual Arabica::XPath::XPathValue<string_type>* evaluate(const Arabica::DOM::Node<string_type>& context,
const Arabica::XPath::ExecutionContext<string_type, string_adaptor>& executionContext) const const Arabica::XPath::ExecutionContext<string_type, string_adaptor>& executionContext) const
{ {
string_type name = string_adaptor::construct_from_utf8("test-"); string_type name = string_adaptor::construct_from_utf8("test-");
@ -94,27 +94,27 @@ template<class string_type, class string_adaptor>
class ExecuteTest : public TestCase class ExecuteTest : public TestCase
{ {
Arabica::XPath::XPath<string_type> parser; Arabica::XPath::XPath<string_type> parser;
DOM::DOMImplementation<string_type> factory_; Arabica::DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_; Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_; Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_; Arabica::DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_; Arabica::DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_; Arabica::DOM::Element<string_type> element3_;
DOM::Element<string_type> spinkle_; Arabica::DOM::Element<string_type> spinkle_;
DOM::Attr<string_type> attr_; Arabica::DOM::Attr<string_type> attr_;
DOM::Text<string_type> text_; Arabica::DOM::Text<string_type> text_;
DOM::Comment<string_type> comment_; Arabica::DOM::Comment<string_type> comment_;
DOM::ProcessingInstruction<string_type> processingInstruction_; Arabica::DOM::ProcessingInstruction<string_type> processingInstruction_;
DOM::Document<string_type> chapters_; Arabica::DOM::Document<string_type> chapters_;
DOM::Document<string_type> numbers_; Arabica::DOM::Document<string_type> numbers_;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -124,7 +124,7 @@ public:
void setUp() void setUp()
{ {
factory_ = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation(); factory_ = Arabica::SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0); document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0);
root_ = document_.getDocumentElement(); root_ = document_.getDocumentElement();
@ -182,7 +182,7 @@ public:
assertValuesEqual(NODE_SET, result->type()); assertValuesEqual(NODE_SET, result->type());
assertValuesEqual(1, result->asNodeSet().size()); assertValuesEqual(1, result->asNodeSet().size());
DOM::Node<string_type> n = result->asNodeSet()[0]; Arabica::DOM::Node<string_type> n = result->asNodeSet()[0];
assertTrue(root_ == n); assertTrue(root_ == n);
} // test1 } // test1
@ -194,7 +194,7 @@ public:
assertValuesEqual(NODE_SET, result->type()); assertValuesEqual(NODE_SET, result->type());
assertValuesEqual(1, result->asNodeSet().size()); assertValuesEqual(1, result->asNodeSet().size());
DOM::Node<string_type> n = result->asNodeSet()[0]; Arabica::DOM::Node<string_type> n = result->asNodeSet()[0];
assertTrue(element2_ == n); assertTrue(element2_ == n);
} // test2 } // test2
@ -341,7 +341,7 @@ public:
assertValuesEqual(NODE_SET, result->type()); assertValuesEqual(NODE_SET, result->type());
assertValuesEqual(1, result->asNodeSet().size()); assertValuesEqual(1, result->asNodeSet().size());
DOM::Node<string_type> n = result->asNodeSet()[0]; Arabica::DOM::Node<string_type> n = result->asNodeSet()[0];
assertTrue(element2_ == n); assertTrue(element2_ == n);
} // test12 } // test12
@ -414,7 +414,7 @@ public:
assertValuesEqual(NODE_SET, result->type()); assertValuesEqual(NODE_SET, result->type());
assertValuesEqual(1, result->asNodeSet().size()); assertValuesEqual(1, result->asNodeSet().size());
DOM::Node<string_type> n = result->asNodeSet()[0]; Arabica::DOM::Node<string_type> n = result->asNodeSet()[0];
assertTrue(element2_ == n); assertTrue(element2_ == n);
} // test19 } // test19
@ -651,10 +651,10 @@ public:
void test42() void test42()
{ {
using namespace Arabica::XPath; using namespace Arabica::XPath;
DOM::Element<string_type> f1 = chapters_.createElement(SA::construct_from_utf8("footer")); Arabica::DOM::Element<string_type> f1 = chapters_.createElement(SA::construct_from_utf8("footer"));
DOM::Element<string_type> f2 = chapters_.createElement(SA::construct_from_utf8("footer")); Arabica::DOM::Element<string_type> f2 = chapters_.createElement(SA::construct_from_utf8("footer"));
XPathValuePtr<string_type> ch = parser.evaluate(SA::construct_from_utf8("/document/chapter"), chapters_); XPathValuePtr<string_type> ch = parser.evaluate(SA::construct_from_utf8("/document/chapter"), chapters_);
DOM::Node<string_type> n = ch->asNodeSet()[0]; Arabica::DOM::Node<string_type> n = ch->asNodeSet()[0];
n.appendChild(f1); n.appendChild(f1);
n = ch->asNodeSet()[1]; n = ch->asNodeSet()[1];
n.appendChild(f2); n.appendChild(f2);
@ -799,7 +799,7 @@ public:
void testUnion11() void testUnion11()
{ {
using namespace Arabica::XPath; using namespace Arabica::XPath;
DOM::DocumentFragment<string_type> frag = document_.createDocumentFragment(); Arabica::DOM::DocumentFragment<string_type> frag = document_.createDocumentFragment();
frag.appendChild(document_.createElement(SA::construct_from_utf8("foo"))); frag.appendChild(document_.createElement(SA::construct_from_utf8("foo")));
NodeSetVariableResolver<string_type, string_adaptor> svr; NodeSetVariableResolver<string_type, string_adaptor> svr;
@ -817,9 +817,9 @@ public:
void testUnion12() void testUnion12()
{ {
using namespace Arabica::XPath; using namespace Arabica::XPath;
DOM::DocumentFragment<string_type> frag = document_.createDocumentFragment(); Arabica::DOM::DocumentFragment<string_type> frag = document_.createDocumentFragment();
DOM::Node<string_type> n1 = document_.createElement(SA::construct_from_utf8("foo")); Arabica::DOM::Node<string_type> n1 = document_.createElement(SA::construct_from_utf8("foo"));
DOM::Node<string_type> n2 = document_.createElement(SA::construct_from_utf8("bar")); Arabica::DOM::Node<string_type> n2 = document_.createElement(SA::construct_from_utf8("bar"));
frag.appendChild(n1); frag.appendChild(n1);
frag.appendChild(n2); frag.appendChild(n2);

View file

@ -13,27 +13,27 @@ template<class string_type, class string_adaptor>
class ExpressionTest : public TestCase class ExpressionTest : public TestCase
{ {
Arabica::XPath::XPath<string_type> parser; Arabica::XPath::XPath<string_type> parser;
DOM::DOMImplementation<string_type> factory_; Arabica::DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_; Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_; Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_; Arabica::DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_; Arabica::DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_; Arabica::DOM::Element<string_type> element3_;
DOM::Element<string_type> spinkle_; Arabica::DOM::Element<string_type> spinkle_;
DOM::Attr<string_type> attr_; Arabica::DOM::Attr<string_type> attr_;
DOM::Text<string_type> text_; Arabica::DOM::Text<string_type> text_;
DOM::Comment<string_type> comment_; Arabica::DOM::Comment<string_type> comment_;
DOM::ProcessingInstruction<string_type> processingInstruction_; Arabica::DOM::ProcessingInstruction<string_type> processingInstruction_;
DOM::Document<string_type> chapters_; Arabica::DOM::Document<string_type> chapters_;
DOM::Document<string_type> numbers_; Arabica::DOM::Document<string_type> numbers_;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:
@ -43,7 +43,7 @@ public:
void setUp() void setUp()
{ {
factory_ = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation(); factory_ = Arabica::SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0); document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0);
root_ = document_.getDocumentElement(); root_ = document_.getDocumentElement();

View file

@ -76,7 +76,7 @@ public:
} // test8 } // test8
private: private:
DOM::Node<string_type> dummy_; Arabica::DOM::Node<string_type> dummy_;
}; // class LogicalTest }; // class LogicalTest
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>

View file

@ -100,7 +100,7 @@ public:
void testEvaluateDocMatch() void testEvaluateDocMatch()
{ {
DOM::Document<string_type> doc = parseXML("<doc><para>hello</para></doc>"); Arabica::DOM::Document<string_type> doc = parseXML("<doc><para>hello</para></doc>");
assertTrue(applyMatch("/", doc)); assertTrue(applyMatch("/", doc));
@ -111,7 +111,7 @@ public:
void testDocElementMatch() void testDocElementMatch()
{ {
DOM::Document<string_type> doc = parseXML("<doc><para>hello</para></doc>"); Arabica::DOM::Document<string_type> doc = parseXML("<doc><para>hello</para></doc>");
assertTrue(applyMatch("doc", doc.getFirstChild())); assertTrue(applyMatch("doc", doc.getFirstChild()));
assertTrue(applyMatch("doc[para]", doc.getFirstChild())); assertTrue(applyMatch("doc[para]", doc.getFirstChild()));
@ -135,7 +135,7 @@ public:
void testDocElementNotMatch() void testDocElementNotMatch()
{ {
DOM::Document<string_type> doc = parseXML("<doc><para>hello</para></doc>"); Arabica::DOM::Document<string_type> doc = parseXML("<doc><para>hello</para></doc>");
assertFalse(applyMatch("para", doc.getFirstChild())); assertFalse(applyMatch("para", doc.getFirstChild()));
assertFalse(applyMatch("@*", doc.getFirstChild())); assertFalse(applyMatch("@*", doc.getFirstChild()));
@ -152,9 +152,9 @@ public:
void testAttributeMatch() void testAttributeMatch()
{ {
DOM::Document<string_type> doc = parseXML("<doc><para id='woop' name='charlie'>hello</para></doc>"); Arabica::DOM::Document<string_type> doc = parseXML("<doc><para id='woop' name='charlie'>hello</para></doc>");
DOM::Node<string_type> a1 = doc.getFirstChild().getFirstChild().getAttributes().getNamedItem(SA::construct_from_utf8("id")); Arabica::DOM::Node<string_type> a1 = doc.getFirstChild().getFirstChild().getAttributes().getNamedItem(SA::construct_from_utf8("id"));
DOM::Node<string_type> a2 = doc.getFirstChild().getFirstChild().getAttributes().getNamedItem(SA::construct_from_utf8("name")); Arabica::DOM::Node<string_type> a2 = doc.getFirstChild().getFirstChild().getAttributes().getNamedItem(SA::construct_from_utf8("name"));
assertTrue(applyMatch("@id", a1)); assertTrue(applyMatch("@id", a1));
assertTrue(applyMatch("@*", a1)); assertTrue(applyMatch("@*", a1));
@ -184,8 +184,8 @@ public:
void testCommentMatch() void testCommentMatch()
{ {
DOM::Document<string_type> doc = parseXML("<doc><para>hello</para><!-- woo --></doc>"); Arabica::DOM::Document<string_type> doc = parseXML("<doc><para>hello</para><!-- woo --></doc>");
DOM::Node<string_type> comment = doc.getFirstChild().getLastChild(); Arabica::DOM::Node<string_type> comment = doc.getFirstChild().getLastChild();
assertFalse(applyMatch("comment()", doc)); assertFalse(applyMatch("comment()", doc));
assertFalse(applyMatch("comment()", doc.getFirstChild())); assertFalse(applyMatch("comment()", doc.getFirstChild()));
@ -195,8 +195,8 @@ public:
void testProcessingInstructionMatch() void testProcessingInstructionMatch()
{ {
DOM::Document<string_type> doc = parseXML("<doc><para>hello</para><?target data?></doc>"); Arabica::DOM::Document<string_type> doc = parseXML("<doc><para>hello</para><?target data?></doc>");
DOM::Node<string_type> pi = doc.getFirstChild().getLastChild(); Arabica::DOM::Node<string_type> pi = doc.getFirstChild().getLastChild();
assertFalse(applyMatch("processing-instruction()", doc)); assertFalse(applyMatch("processing-instruction()", doc));
assertFalse(applyMatch("processing-instruction()", doc.getFirstChild())); assertFalse(applyMatch("processing-instruction()", doc.getFirstChild()));
@ -220,7 +220,7 @@ public:
nsContext.addNamespaceDeclaration(SA::construct_from_utf8("bang"), SA::construct_from_utf8("bang")); nsContext.addNamespaceDeclaration(SA::construct_from_utf8("bang"), SA::construct_from_utf8("bang"));
parser.setNamespaceContext(nsContext); parser.setNamespaceContext(nsContext);
DOM::Document<string_type> doc = parseXML("<bang:doc xmlns:bang='bang'><bang:para>hello</bang:para></bang:doc>"); Arabica::DOM::Document<string_type> doc = parseXML("<bang:doc xmlns:bang='bang'><bang:para>hello</bang:para></bang:doc>");
assertFalse(applyMatch("bang:*", doc)); assertFalse(applyMatch("bang:*", doc));
assertTrue(applyMatch("bang:*", doc.getFirstChild())); assertTrue(applyMatch("bang:*", doc.getFirstChild()));
@ -385,7 +385,7 @@ public:
return matches; return matches;
} // compileMatches } // compileMatches
bool applyMatches(const char* match, const DOM::Node<string_type>& node) bool applyMatches(const char* match, const Arabica::DOM::Node<string_type>& node)
{ {
compileMatches(match); compileMatches(match);
for(unsigned int i = 0; i < matches.size(); ++i) for(unsigned int i = 0; i < matches.size(); ++i)
@ -394,19 +394,19 @@ public:
return false; return false;
} // applyMatches } // applyMatches
bool applyMatch(const char* match, const DOM::Node<string_type>& node) bool applyMatch(const char* match, const Arabica::DOM::Node<string_type>& node)
{ {
return compileMatch(match)->evaluateAsBool(node); return compileMatch(match)->evaluateAsBool(node);
} // applyMatch } // applyMatch
DOM::Document<string_type> parseXML(const char* match) Arabica::DOM::Document<string_type> parseXML(const char* match)
{ {
std::stringstream ss; std::stringstream ss;
ss << match; ss << match;
Arabica::SAX::basic_InputSource<string_type> is(ss); Arabica::SAX::basic_InputSource<string_type> is(ss);
Arabica::SAX::CatchErrorHandler<string_type> eh; Arabica::SAX::CatchErrorHandler<string_type> eh;
SAX2DOM::Parser<string_type, string_adaptor> parser; Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
parser.setErrorHandler(eh); parser.setErrorHandler(eh);
parser.parse(is); parser.parse(is);

View file

@ -11,22 +11,22 @@
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>
class NodeTestTest : public TestCase class NodeTestTest : public TestCase
{ {
DOM::DOMImplementation<string_type> factory_; Arabica::DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_; Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_; Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_; Arabica::DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_; Arabica::DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_; Arabica::DOM::Element<string_type> element3_;
DOM::Attr<string_type> attr_; Arabica::DOM::Attr<string_type> attr_;
DOM::Text<string_type> text_; Arabica::DOM::Text<string_type> text_;
DOM::Comment<string_type> comment_; Arabica::DOM::Comment<string_type> comment_;
DOM::ProcessingInstruction<string_type> processingInstruction_; Arabica::DOM::ProcessingInstruction<string_type> processingInstruction_;
typedef string_adaptor SA; typedef string_adaptor SA;
@ -37,7 +37,7 @@ public:
void setUp() void setUp()
{ {
factory_ = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation(); factory_ = Arabica::SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0); document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0);
root_ = document_.getDocumentElement(); root_ = document_.getDocumentElement();
@ -218,17 +218,17 @@ public:
impl::QNameNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test"), impl::QNameNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("one")); SA::construct_from_utf8("one"));
DOM::Element<string_type> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), Arabica::DOM::Element<string_type> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ns:one")); SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), Arabica::DOM::Element<string_type> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ttt:one")); SA::construct_from_utf8("ttt:one"));
DOM::Element<string_type> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), Arabica::DOM::Element<string_type> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ns:two")); SA::construct_from_utf8("ns:two"));
DOM::Element<string_type> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), Arabica::DOM::Element<string_type> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"),
SA::construct_from_utf8("ttt:two")); SA::construct_from_utf8("ttt:two"));
DOM::Element<string_type> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"), Arabica::DOM::Element<string_type> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"),
SA::construct_from_utf8("ns:one")); SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"), Arabica::DOM::Element<string_type> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"),
SA::construct_from_utf8("ttt:one")); SA::construct_from_utf8("ttt:one"));
assertTrue(test(e1_)); assertTrue(test(e1_));
@ -244,12 +244,12 @@ public:
using namespace Arabica::XPath; using namespace Arabica::XPath;
impl::QStarNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test")); impl::QStarNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test"));
DOM::Element<string_type> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:one")); Arabica::DOM::Element<string_type> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:one")); Arabica::DOM::Element<string_type> e2_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:one"));
DOM::Element<string_type> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:two")); Arabica::DOM::Element<string_type> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:two"));
DOM::Element<string_type> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:two")); Arabica::DOM::Element<string_type> e4_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ttt:two"));
DOM::Element<string_type> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"), SA::construct_from_utf8("ns:one")); Arabica::DOM::Element<string_type> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"), SA::construct_from_utf8("ns:one"));
DOM::Element<string_type> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"), SA::construct_from_utf8("ttt:one")); Arabica::DOM::Element<string_type> e6_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/eeee"), SA::construct_from_utf8("ttt:one"));
assertTrue(test(e1_)); assertTrue(test(e1_));
assertTrue(test(e2_)); assertTrue(test(e2_));

View file

@ -174,7 +174,7 @@ public:
} // testLessThanEquals3 } // testLessThanEquals3
private: private:
DOM::Node<string_type> dummy_; Arabica::DOM::Node<string_type> dummy_;
}; // class RelationalTest }; // class RelationalTest
template<class string_type, class string_adaptor> template<class string_type, class string_adaptor>

View file

@ -13,16 +13,16 @@ class StepTest : public TestCase
{ {
typedef string_adaptor SA; typedef string_adaptor SA;
DOM::DOMImplementation<string_type> factory_; Arabica::DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_; Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_; Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_; Arabica::DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_; Arabica::DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_; Arabica::DOM::Element<string_type> element3_;
DOM::Attr<string_type> attr_; Arabica::DOM::Attr<string_type> attr_;
public: public:
StepTest(const std::string& name) : TestCase(name) StepTest(const std::string& name) : TestCase(name)
@ -31,7 +31,7 @@ public:
void setUp() void setUp()
{ {
factory_ = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation(); factory_ = Arabica::SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0); document_ = factory_.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8("root"), 0);
root_ = document_.getDocumentElement(); root_ = document_.getDocumentElement();
@ -75,13 +75,13 @@ public:
NodeSet<string_type> set = step->evaluateAsNodeSet(element2_); NodeSet<string_type> set = step->evaluateAsNodeSet(element2_);
assertEquals(4, set.size()); assertEquals(4, set.size());
DOM::Attr<string_type> attr = static_cast<DOM::Attr<string_type> >(set[0]); Arabica::DOM::Attr<string_type> attr = static_cast<Arabica::DOM::Attr<string_type> >(set[0]);
assertTrue(attr.getNodeName() == SA::construct_from_utf8("one")); assertTrue(attr.getNodeName() == SA::construct_from_utf8("one"));
attr = static_cast<DOM::Attr<string_type> >(set[1]); attr = static_cast<Arabica::DOM::Attr<string_type> >(set[1]);
assertTrue(attr.getNodeName() == SA::construct_from_utf8("two")); assertTrue(attr.getNodeName() == SA::construct_from_utf8("two"));
attr = static_cast<DOM::Attr<string_type> >(set[2]); attr = static_cast<Arabica::DOM::Attr<string_type> >(set[2]);
assertTrue(attr.getNodeName() == SA::construct_from_utf8("three")); assertTrue(attr.getNodeName() == SA::construct_from_utf8("three"));
attr = static_cast<DOM::Attr<string_type> >(set[3]); attr = static_cast<Arabica::DOM::Attr<string_type> >(set[3]);
assertTrue(attr.getNodeName() == SA::construct_from_utf8("four")); assertTrue(attr.getNodeName() == SA::construct_from_utf8("four"));
} // test2 } // test2

View file

@ -11,7 +11,7 @@ template<class string_type, class string_adaptor>
class ValueTest : public TestCase class ValueTest : public TestCase
{ {
private: private:
DOM::Node<string_type> dummy_; Arabica::DOM::Node<string_type> dummy_;
typedef string_adaptor SA; typedef string_adaptor SA;
public: public:

View file

@ -16,30 +16,30 @@ const std::string PATH_PREFIX=test_path;
const std::string SEPERATOR = "/"; const std::string SEPERATOR = "/";
#endif #endif
DOM::Document<std::string> buildDOM(const std::string& filename) Arabica::DOM::Document<std::string> buildDOM(const std::string& filename)
{ {
Arabica::SAX::InputSource is(filename); Arabica::SAX::InputSource is(filename);
SAX2DOM::Parser<std::string> parser; Arabica::SAX2DOM::Parser<std::string> parser;
parser.parse(is); parser.parse(is);
DOM::Document<std::string> d = parser.getDocument(); Arabica::DOM::Document<std::string> d = parser.getDocument();
if(d != 0) if(d != 0)
d.normalize(); d.normalize();
return d; return d;
} // buildDOM } // buildDOM
Arabica::XPath::NodeSet<std::string> selectNodes(const std::string& path, const DOM::Node<std::string>& node) Arabica::XPath::NodeSet<std::string> selectNodes(const std::string& path, const Arabica::DOM::Node<std::string>& node)
{ {
Arabica::XPath::XPath<std::string> xpath; Arabica::XPath::XPath<std::string> xpath;
return xpath.evaluate(path, node)->asNodeSet(); return xpath.evaluate(path, node)->asNodeSet();
} // selectNodes } // selectNodes
DOM::Node<std::string> selectNode(const std::string& path, const DOM::Node<std::string>& node) Arabica::DOM::Node<std::string> selectNode(const std::string& path, const Arabica::DOM::Node<std::string>& node)
{ {
return selectNodes(path, node)[0]; return selectNodes(path, node)[0];
} // selectNode } // selectNode
std::string selectString(const std::string& path, const DOM::Node<std::string>& node) std::string selectString(const std::string& path, const Arabica::DOM::Node<std::string>& node)
{ {
Arabica::XPath::XPath<std::string> xpath; Arabica::XPath::XPath<std::string> xpath;
return xpath.evaluate_expr(path, node)->asString(); return xpath.evaluate_expr(path, node)->asString();
@ -124,7 +124,7 @@ protected:
std::ostringstream errors; std::ostringstream errors;
stylesheet->set_error_output(errors); stylesheet->set_error_output(errors);
DOM::Document<std::string> document = buildDOM(input_xml_); Arabica::DOM::Document<std::string> document = buildDOM(input_xml_);
try { try {
stylesheet->execute(document); stylesheet->execute(document);
} }
@ -169,7 +169,7 @@ protected:
std::ostringstream errors; std::ostringstream errors;
stylesheet->set_error_output(errors); stylesheet->set_error_output(errors);
DOM::Document<std::string> document = buildDOM(input_xml_); Arabica::DOM::Document<std::string> document = buildDOM(input_xml_);
try { try {
stylesheet->execute(document); stylesheet->execute(document);
} }
@ -177,10 +177,10 @@ protected:
assertImplementation(false, "Failed to run " + input_xslt_ + " : " + e.what()); assertImplementation(false, "Failed to run " + input_xslt_ + " : " + e.what());
} }
DOM::Document<std::string> ref = buildDOM(output_xml_); Arabica::DOM::Document<std::string> ref = buildDOM(output_xml_);
if(ref == 0) if(ref == 0)
assertImplementation(false, "Couldn't read " + output_xml_ + ". Perhaps it isn't well-formed XML?"); assertImplementation(false, "Couldn't read " + output_xml_ + ". Perhaps it isn't well-formed XML?");
DOM::Node<std::string> out = output.node(); Arabica::DOM::Node<std::string> out = output.node();
std::string refs = docToString(ref.getFirstChild()); std::string refs = docToString(ref.getFirstChild());
std::string outs = docToString(out.getFirstChild()); std::string outs = docToString(out.getFirstChild());
@ -196,19 +196,19 @@ protected:
} }
} // runTest } // runTest
std::string docToString(DOM::Node<std::string> node) std::string docToString(Arabica::DOM::Node<std::string> node)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << node; ss << node;
return Arabica::string::normalize_whitespace<std::string, Arabica::default_string_adaptor<std::string> >(ss.str()); return Arabica::string::normalize_whitespace<std::string, Arabica::default_string_adaptor<std::string> >(ss.str());
} // docToString } // docToString
void stripWhitespace(DOM::Node<std::string> doc) void stripWhitespace(Arabica::DOM::Node<std::string> doc)
{ {
Arabica::XPath::NodeSet<std::string> textNodes = selectNodes("//text()", doc); Arabica::XPath::NodeSet<std::string> textNodes = selectNodes("//text()", doc);
for(int i = 0; i != textNodes.size(); ++i) for(int i = 0; i != textNodes.size(); ++i)
{ {
DOM::Node<std::string> t = textNodes[i]; Arabica::DOM::Node<std::string> t = textNodes[i];
std::string text = t.getNodeValue(); std::string text = t.getNodeValue();
size_t index = text.find_first_of(" \n"); size_t index = text.find_first_of(" \n");
while(index != std::string::npos) while(index != std::string::npos)
@ -230,7 +230,7 @@ class Expected
public: public:
Expected() Expected()
{ {
DOM::Document<std::string> fail_doc = buildDOM(PATH_PREFIX + "arabica-expected-fails.xml"); Arabica::DOM::Document<std::string> fail_doc = buildDOM(PATH_PREFIX + "arabica-expected-fails.xml");
Arabica::XPath::NodeSet<std::string> failcases = selectNodes("/test-suite/test-case", fail_doc); Arabica::XPath::NodeSet<std::string> failcases = selectNodes("/test-suite/test-case", fail_doc);
for(int i = 0; i != failcases.size(); ++i) for(int i = 0; i != failcases.size(); ++i)
{ {
@ -264,7 +264,7 @@ static Expected expected;
TestSuite* XSLTTest_suite(const std::string& path) TestSuite* XSLTTest_suite(const std::string& path)
{ {
static DOM::Document<std::string> catalog = buildDOM(PATH_PREFIX + "catalog.xml"); static Arabica::DOM::Document<std::string> catalog = buildDOM(PATH_PREFIX + "catalog.xml");
TestSuite *suiteOfTests = new TestSuite; TestSuite *suiteOfTests = new TestSuite;