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)
{ // narrow
SAX2DOM::Parser<std::string> domParser;
Arabica::SAX2DOM::Parser<std::string> domParser;
Arabica::SAX::CatchErrorHandler<std::string> eh;
domParser.setErrorHandler(eh);
@ -42,7 +42,7 @@ int main(int argc, char* argv[])
if(!eh.errorsReported())
{
DOM::Document<std::string> doc = domParser.getDocument();
Arabica::DOM::Document<std::string> doc = domParser.getDocument();
doc.normalize();
std::cout << doc;
}
@ -57,7 +57,7 @@ int main(int argc, char* argv[])
/*
{ // wide
SAX2DOM::Parser<std::wstring> domParser;
SAX2Arabica::DOM::Parser<std::wstring> domParser;
Arabica::SAX::wInputSource is;
is.setSystemId(L"stdin");
@ -65,7 +65,7 @@ int main(int argc, char* argv[])
domParser.parse(is);
DOM::Document<std::wstring> doc = domParser.getDocument();
Arabica::DOM::Document<std::wstring> doc = domParser.getDocument();
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;
domParser.setErrorHandler(eh);
@ -54,7 +54,7 @@ int main(int argc, char* argv[])
if(!eh.errorsReported())
{
DOM::Document<std::string> doc = domParser.getDocument();
Arabica::DOM::Document<std::string> doc = domParser.getDocument();
// doc.normalize();
Arabica::XPath::XPathValuePtr<std::string> result;
result = xpath->evaluate(doc);
@ -66,7 +66,7 @@ int main(int argc, char* argv[])
const Arabica::XPath::NodeSet<std::string>& ns = result->asNodeSet();
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;
}
} // if ..

View file

@ -10,7 +10,7 @@
#include <XSLT/XSLT.hpp>
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[])
{
@ -43,7 +43,7 @@ int main(int argc, const char* argv[])
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)
{
std::cerr << "Could not parse XML source" << std::endl;
@ -62,10 +62,10 @@ int main(int argc, const char* argv[])
return 0;
} // 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);
SAX2DOM::Parser<std::string> parser;
Arabica::SAX2DOM::Parser<std::string> parser;
parser.parse(is);
return parser.getDocument();

View file

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

View file

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

View file

@ -9,6 +9,8 @@
#include <DOM/Node.hpp>
namespace Arabica
{
namespace DOM
{
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;
}; // CharacterData_impl
} // namespace DOM
} // namespace Arabica
#endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,13 +3,15 @@
#include <DOM/Simple/DocumentTypeImpl.hpp>
namespace Arabica
{
namespace SAX2DOM
{
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:
DocumentType(const stringT& qualifiedName,
const stringT& publicId,
@ -22,30 +24,30 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT
//////////////////////////////////////////////////////
// DOM::DOMImplementation extensions
void addEntity(SimpleDOM::EntityImpl<stringT, string_adaptorT>* entity)
void addEntity(Arabica::SimpleDOM::EntityImpl<stringT, string_adaptorT>* entity)
{
BaseDT::addEntity(entity);
} // addEntity
void addNotation(SimpleDOM::NotationImpl<stringT, string_adaptorT>* notation)
void addNotation(Arabica::SimpleDOM::NotationImpl<stringT, string_adaptorT>* notation)
{
BaseDT::addNotation(notation);
} // addNotation
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
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)
{
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->setSpecified(false);
elem->setAttributeNode(attr);
@ -58,6 +60,7 @@ class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT
}; // class DOMImplementation
} // namespace SAX2DOM
} // namespace Arabica
#endif
// end of file

View file

@ -15,6 +15,8 @@
#include <SAX/helpers/PropertyNames.hpp>
#include <SAX/SAXParseException.hpp>
namespace Arabica
{
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_DeclHandler<stringT> DeclHandlerT;
typedef Arabica::SAX::basic_InputSource<stringT> InputSourceT;
typedef SimpleDOM::EntityImpl<stringT, string_adaptorT> EntityT;
typedef SimpleDOM::NotationImpl<stringT, string_adaptorT> NotationT;
typedef SimpleDOM::ElementImpl<stringT, string_adaptorT> ElementT;
typedef Arabica::SimpleDOM::EntityImpl<stringT, string_adaptorT> EntityT;
typedef Arabica::SimpleDOM::NotationImpl<stringT, string_adaptorT> NotationT;
typedef Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT> ElementT;
typedef typename Arabica::SAX::basic_ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
public:
@ -78,7 +80,7 @@ class Parser : protected Arabica::SAX::basic_DefaultHandler<stringT>
{
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);
currentNode_ = document_;
inCDATA_ = false;
@ -391,7 +393,8 @@ class Parser : protected Arabica::SAX::basic_DefaultHandler<stringT>
} // unparsedEntityDecl
}; // class Parser
} // namespace
} // namespace SAX2DOM
} // namespace Arabica
#endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,15 +7,17 @@
#include <algorithm>
#include <functional>
namespace Arabica
{
namespace SimpleDOM
{
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:
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_);
} // operator()
@ -211,6 +213,7 @@ class NamedNodeMapImpl : public DOM::NamedNodeMap_impl<stringT>
}; // class NamedNodeMapImpl
} // namespace SAX2DOM
} // namespace Arabica
#endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,13 +20,13 @@ namespace impl
{
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:
NamespaceNodeImpl(stringT localname,
stringT value) :
SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT>(0),
Arabica::SimpleDOM::ChildlessNodeImpl<stringT, string_adaptorT>(0),
localname_(localname),
value_(value),
ref_(0)

View file

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

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor>
class CDATATest : public TestCase
{
DOM::DOMImplementation<string_type> factory;
Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA;
public:
@ -21,13 +21,13 @@ class CDATATest : public TestCase
void setUp()
{
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp
void testNull()
{
DOM::CDATASection<string_type> d;
DOM::Node<string_type> n;
Arabica::DOM::CDATASection<string_type> d;
Arabica::DOM::Node<string_type> n;
assert(d == 0);
assert(n == 0);
assert(n == d);
@ -35,8 +35,8 @@ class CDATATest : public TestCase
void testCreate()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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.getNodeName() == SA::construct_from_utf8("#cdata-section"));
@ -48,32 +48,32 @@ class CDATATest : public TestCase
void testConversion()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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);
n = t;
assert(n == t);
DOM::CDATASection<string_type> t2;
Arabica::DOM::CDATASection<string_type> t2;
assert(n != t2);
t2 = DOM::CDATASection<string_type>(n);
t2 = Arabica::DOM::CDATASection<string_type>(n);
assert(t == t2);
assert(n == t2);
DOM::CDATASection<string_type> t3;
Arabica::DOM::CDATASection<string_type> t3;
t3 = t2;
assert(t3 == t2);
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 {
t = DOM::CDATASection<string_type>(c);
t = Arabica::DOM::CDATASection<string_type>(c);
assertImplementation(false, "converted comment to text");
}
catch(const std::bad_cast&) {
@ -82,18 +82,18 @@ class CDATATest : public TestCase
void testConversionToText()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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(cd != t);
t = cd;
assert(cd == t);
DOM::CDATASection<string_type> cd2;
Arabica::DOM::CDATASection<string_type> cd2;
assert(cd2 == 0);
cd2 = DOM::CDATASection<string_type>(t);
cd2 = Arabica::DOM::CDATASection<string_type>(t);
assert(cd2 == t);
assert(t == cd2);
assert(cd == cd2);
@ -101,7 +101,7 @@ class CDATATest : public TestCase
t = d.createTextNode(SA::construct_from_utf8("boom"));
try {
cd = DOM::CDATASection<string_type>(t);
cd = Arabica::DOM::CDATASection<string_type>(t);
assertImplementation(false, "converted text to CDATA");
}
catch(const std::bad_cast&) {
@ -110,10 +110,10 @@ class CDATATest : public TestCase
void testEverythingElse()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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.getAttributes() == 0);
assert(t.getChildNodes() == 0);
@ -121,9 +121,9 @@ class CDATATest : public TestCase
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>
class CharacterDataTest : public TestCase
{
DOM::DOMImplementation<string_type> factory;
Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA;
public:
@ -21,13 +21,13 @@ class CharacterDataTest : public TestCase
void setUp()
{
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp
void testNull()
{
DOM::CharacterData<string_type> d;
DOM::Node<string_type> n;
Arabica::DOM::CharacterData<string_type> d;
Arabica::DOM::Node<string_type> n;
assert(d == 0);
assert(n == 0);
assert(n == d);
@ -35,8 +35,8 @@ class CharacterDataTest : public TestCase
void testCreateText()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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.getNodeName() == SA::construct_from_utf8("#text"));
@ -45,7 +45,7 @@ class CharacterDataTest : public TestCase
t.setData(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.getAttributes() == 0);
assert(t.getChildNodes() == 0);
@ -53,9 +53,9 @@ class CharacterDataTest : public TestCase
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()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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.getNodeName() == SA::construct_from_utf8("#cdata-section"));
@ -77,7 +77,7 @@ class CharacterDataTest : public TestCase
t.setData(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.getAttributes() == 0);
assert(t.getChildNodes() == 0);
@ -85,9 +85,9 @@ class CharacterDataTest : public TestCase
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()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
Arabica::DOM::CDATASection<string_type> cd = d.createCDATASection(SA::construct_from_utf8("some data"));
DOM::Text<string_type> t = cd;
DOM::CharacterData<string_type> c = t;
Arabica::DOM::Text<string_type> t = cd;
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 == t);
@ -116,11 +116,11 @@ class CharacterDataTest : public TestCase
void testTextUpCasts()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
Arabica::DOM::Node<string_type> n = d.createTextNode(SA::construct_from_utf8("some data"));
DOM::CharacterData<string_type> c = DOM::CharacterData<string_type>(n);
DOM::Text<string_type> t = DOM::Text<string_type>(c);
Arabica::DOM::CharacterData<string_type> c = Arabica::DOM::CharacterData<string_type>(n);
Arabica::DOM::Text<string_type> t = Arabica::DOM::Text<string_type>(c);
assert(c == t);
assert(c == n);
@ -129,12 +129,12 @@ class CharacterDataTest : public TestCase
void testCDATAUpCasts()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
Arabica::DOM::Node<string_type> n = d.createCDATASection(SA::construct_from_utf8("some data"));
DOM::CharacterData<string_type> c = DOM::CharacterData<string_type>(n);
DOM::Text<string_type> t = DOM::Text<string_type>(c);
DOM::CDATASection<string_type> cd = DOM::CDATASection<string_type>(c);
Arabica::DOM::CharacterData<string_type> c = Arabica::DOM::CharacterData<string_type>(n);
Arabica::DOM::Text<string_type> t = Arabica::DOM::Text<string_type>(c);
Arabica::DOM::CDATASection<string_type> cd = Arabica::DOM::CDATASection<string_type>(c);
assert(c == cd);
assert(c == t);

View file

@ -23,11 +23,11 @@ class DOMImplementationTest : public TestCase
void testNull()
{
DOM::DOMImplementation<string_type> di;
Arabica::DOM::DOMImplementation<string_type> di;
assert(di == 0);
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);
@ -41,7 +41,7 @@ class DOMImplementationTest : public TestCase
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("1.0")) == true);

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor>
class DocumentTest : public TestCase
{
DOM::DOMImplementation<string_type> factory;
Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA;
@ -22,13 +22,13 @@ class DocumentTest : public TestCase
void setUp()
{
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp
void testNull()
{
DOM::Document<string_type> d;
DOM::Node<string_type> n;
Arabica::DOM::Document<string_type> d;
Arabica::DOM::Node<string_type> n;
assert(d == 0);
assert(n == 0);
assert(n == d);
@ -38,13 +38,13 @@ class DocumentTest : public TestCase
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);
assert(d.getNodeName() == SA::construct_from_utf8("#document"));
assert(d.getNodeValue() == SA::construct_from_utf8(""));
DOM::Node<string_type> n;
Arabica::DOM::Node<string_type> n;
assert(n == 0);
assert(!n);
assert(n != d);
@ -53,16 +53,16 @@ class DocumentTest : public TestCase
assert(n);
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(d2!= d);
d2 = d;
assert(d == d2);
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(d3!= d);
d3 = d;
@ -72,11 +72,11 @@ class DocumentTest : public TestCase
void testDocElem()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
Arabica::DOM::NodeList<string_type> nl = d.getChildNodes();
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.getOwnerDocument() == d);
@ -89,12 +89,12 @@ class DocumentTest : public TestCase
assert(d.getFirstChild() == 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
{
d.appendChild(elem2);
}
catch(const DOM::DOMException&)
catch(const Arabica::DOM::DOMException&)
{
}
@ -115,25 +115,25 @@ class DocumentTest : public TestCase
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.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("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);
} // test4
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.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("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().getFirstChild().getNodeName() == SA::construct_from_utf8("child"));
assert(clone.getFirstChild().getLastChild().getNodeName() == SA::construct_from_utf8("child3"));
@ -141,30 +141,30 @@ class DocumentTest : public TestCase
void test6()
{
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> d1 = 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"));
DOM::Node<string_type> a2 = d2.importNode(a1, true);
assert(a2.getNodeType() == DOM::Node<string_type>::ATTRIBUTE_NODE);
Arabica::DOM::Node<string_type> a2 = d2.importNode(a1, true);
assert(a2.getNodeType() == Arabica::DOM::Node<string_type>::ATTRIBUTE_NODE);
assert(a2.getNodeName() == a1.getNodeName());
assert(a2.getNodeValue() == a1.getNodeValue());
assert(a2.getOwnerDocument() == d2);
assert(a2.getChildNodes().getLength() == 1);
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.getOwnerElement() == 0);
} // test6
void test7()
{
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> d1 = 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("c2")));
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("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.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.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.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(1).getNodeName() == SA::construct_from_utf8("c2"));
assert(c.item(2).getNodeName() == SA::construct_from_utf8("c3"));
@ -201,7 +201,7 @@ class DocumentTest : public TestCase
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.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.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.item(0) == d.getFirstChild().getFirstChild());
@ -224,13 +224,13 @@ class DocumentTest : public TestCase
d.getFirstChild().getLastChild().appendChild(d.createElement(SA::construct_from_utf8("donkey")));
assert(children.getLength() == 5);
assert(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().getFirstChild()).getElementsByTagName(SA::construct_from_utf8("donkey")).getLength() == 2);
assert(Arabica::DOM::Element<string_type>(d.getFirstChild()).getElementsByTagName(SA::construct_from_utf8("donkey")).getLength() == 4);
} // test8
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().hasPrefix() == false);
assert(d.getFirstChild().hasNamespaceURI() == false);
@ -241,7 +241,7 @@ class DocumentTest : public TestCase
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().hasPrefix() == true);
assert(d.getFirstChild().hasNamespaceURI() == true);
@ -252,7 +252,7 @@ class DocumentTest : public TestCase
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().hasPrefix() == false);
assert(d.getFirstChild().hasNamespaceURI() == true);
@ -263,7 +263,7 @@ class DocumentTest : public TestCase
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().hasPrefix() == false);
assert(d.getFirstChild().hasNamespaceURI() == true);
@ -282,8 +282,8 @@ class DocumentTest : public TestCase
void test13()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8("http://test/test"), SA::construct_from_utf8("root"), 0);
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("mother, ")));
root.appendChild(d.createTextNode(SA::construct_from_utf8("how ")));

View file

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

View file

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

View file

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

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor>
class PITest : public TestCase
{
DOM::DOMImplementation<string_type> factory;
Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA;
public:
@ -21,13 +21,13 @@ class PITest : public TestCase
void setUp()
{
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp
void testNull()
{
DOM::ProcessingInstruction<string_type> d;
DOM::Node<string_type> n;
Arabica::DOM::ProcessingInstruction<string_type> d;
Arabica::DOM::Node<string_type> n;
assert(d == 0);
assert(n == 0);
assert(n == d);
@ -35,8 +35,8 @@ class PITest : public TestCase
void testCreate()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
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.getData() == SA::construct_from_utf8("data"));
@ -49,10 +49,10 @@ class PITest : public TestCase
void testConversion()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
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);
@ -60,20 +60,20 @@ class PITest : public TestCase
assert(n == pi);
DOM::ProcessingInstruction<string_type> pi2;
Arabica::DOM::ProcessingInstruction<string_type> pi2;
assert(n != pi2);
pi2 = DOM::ProcessingInstruction<string_type>(n);
pi2 = Arabica::DOM::ProcessingInstruction<string_type>(n);
assert(pi == pi2);
assert(n == pi2);
} // testConverstion
void testEverythingElse()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
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.getAttributes() == 0);
assert(pi.getChildNodes() == 0);
@ -81,9 +81,9 @@ class PITest : public TestCase
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
DOM::Document<string_type> parse(string_type str)
Arabica::DOM::Document<string_type> parse(string_type str)
{
std::stringstream ss;
ss << SA::asStdString(str);
Arabica::SAX::basic_InputSource<string_type> is(ss);
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.parse(is);
@ -42,8 +42,8 @@ class SAX2DOMTest : public TestCase
void test1()
{
DOM::Element<string_type> d;
DOM::Node<string_type> n;
Arabica::DOM::Element<string_type> d;
Arabica::DOM::Node<string_type> n;
assert(d == 0);
assert(n == 0);
assert(n == d);
@ -51,24 +51,24 @@ class SAX2DOMTest : public TestCase
void test2()
{
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>"));
DOM::Element<string_type> elem = d.getDocumentElement();
Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assert(elem.getParentNode() == d);
assert(elem.getOwnerDocument() == d);
} // test2
void test3()
{
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"/>"));
DOM::Element<string_type> elem = d.getDocumentElement();
Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"/>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assert(elem.hasAttributes() == true);
assert(elem.getAttribute(SA::construct_from_utf8("attr")) == SA::construct_from_utf8("poop"));
} // test3
void test4()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<root><child attr=\"poop\"/></root>"));
Arabica::DOM::Element<string_type> elem = Arabica::DOM::Element<string_type>(d.getDocumentElement().getFirstChild());
assert(SA::construct_from_utf8("child") == elem.getNodeName());
assertEquals(true, elem.hasAttributes());
assert(SA::construct_from_utf8("poop") == elem.getAttribute(SA::construct_from_utf8("attr")));
@ -76,44 +76,44 @@ class SAX2DOMTest : public TestCase
void test5()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<stuff:elem attr='something' xmlns:stuff='http://example.com/stuff'/>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assertEquals(true, elem.hasNamespaceURI());
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());
} // test5
void test6()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<stuff:elem stuff:attr='something' xmlns:stuff='http://example.com/stuff'/>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
assertEquals(true, elem.hasNamespaceURI());
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());
assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI());
} // test6
void test7()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<elem stuff:attr='something' xmlns:stuff='http://example.com/stuff'/>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
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());
assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI());
} // test7
void test8()
{
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"><child/></root>"));
DOM::Element<string_type> elem = d.getDocumentElement();
Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root attr=\"poop\"><child/></root>"));
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.getParentNode() == 0);
assert(e2.hasAttributes() == true);
@ -123,23 +123,23 @@ class SAX2DOMTest : public TestCase
void test9()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<elem attr='something' xmlns:stuff='http://example.com/stuff'/>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
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());
} // test9
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);
} // test10
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);
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);
@ -151,7 +151,7 @@ class SAX2DOMTest : public TestCase
void test12()
{
SAX2DOM::Parser<string_type, string_adaptor> parser;
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
try
{
parser.getFeature(SA::construct_from_utf8("made up name"));

View file

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

View file

@ -10,7 +10,7 @@
template<class string_type, class string_adaptor>
class TextTest : public TestCase
{
DOM::DOMImplementation<string_type> factory;
Arabica::DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA;
public:
@ -21,13 +21,13 @@ class TextTest : public TestCase
void setUp()
{
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
factory = Arabica::SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp
void testNull()
{
DOM::Text<string_type> d;
DOM::Node<string_type> n;
Arabica::DOM::Text<string_type> d;
Arabica::DOM::Node<string_type> n;
assert(d == 0);
assert(n == 0);
assert(n == d);
@ -35,8 +35,8 @@ class TextTest : public TestCase
void testCreate()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""), SA::construct_from_utf8(""), 0);
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.getNodeName() == SA::construct_from_utf8("#text"));
@ -48,32 +48,32 @@ class TextTest : public TestCase
void testConversion()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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);
n = t;
assert(n == t);
DOM::Text<string_type> t2;
Arabica::DOM::Text<string_type> t2;
assert(n != t2);
t2 = DOM::Text<string_type>(n);
t2 = Arabica::DOM::Text<string_type>(n);
assert(t == t2);
assert(n == t2);
DOM::Text<string_type> t3;
Arabica::DOM::Text<string_type> t3;
t3 = t2;
assert(t3 == t2);
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 {
t = DOM::Text<string_type>(c);
t = Arabica::DOM::Text<string_type>(c);
assertImplementation(false, "converted comment to text");
}
catch(const std::bad_cast&) {
@ -82,10 +82,10 @@ class TextTest : public TestCase
void testEverythingElse()
{
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::Document<string_type> d = factory.createDocument(SA::construct_from_utf8(""),SA::construct_from_utf8(""), 0);
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.getAttributes() == 0);
assert(t.getChildNodes() == 0);
@ -93,9 +93,9 @@ class TextTest : public TestCase
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
DOM::Document<string_type> parse(string_type str)
Arabica::DOM::Document<string_type> parse(string_type str)
{
std::stringstream ss;
ss << SA::asStdString(str);
Arabica::SAX::basic_InputSource<string_type> is(ss);
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.parse(is);
@ -42,14 +42,14 @@ class TreeWalkerTest : public TestCase
void test1()
{
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>"));
DOM::Element<string_type> elem = d.getDocumentElement();
Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root/>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_ALL,
true);
assert(walker.getWhatToShow() == DOM::Traversal::SHOW_ALL);
assert(walker.getWhatToShow() == Arabica::DOM::Traversal::SHOW_ALL);
assert(walker.getFilter() == 0);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == 0);
@ -57,12 +57,12 @@ class TreeWalkerTest : public TestCase
void test2()
{
DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp/><poop/></root>"));
DOM::Element<string_type> elem = d.getDocumentElement();
Arabica::DOM::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp/><poop/></root>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_ALL,
true);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild());
@ -72,12 +72,12 @@ class TreeWalkerTest : public TestCase
void test3()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_ALL,
true);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild());
@ -89,12 +89,12 @@ class TreeWalkerTest : public TestCase
void test4()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ELEMENT,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_ELEMENT,
true);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild());
@ -104,12 +104,12 @@ class TreeWalkerTest : public TestCase
void test5()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<root><parp>hello</parp><poop>mother</poop></root>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_TEXT,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_TEXT,
true);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild().getFirstChild());
@ -119,12 +119,12 @@ class TreeWalkerTest : public TestCase
void test6()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop>mother</poop></root>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ALL,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_ALL,
true);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getFirstChild());
@ -136,12 +136,12 @@ class TreeWalkerTest : public TestCase
void test7()
{
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::Document<string_type> d = parse(SA::construct_from_utf8("<root id='0'><parp>hello</parp><poop><!--woo-->mother</poop></root>"));
Arabica::DOM::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_COMMENT,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_COMMENT,
true);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getLastChild().getFirstChild());
@ -150,26 +150,26 @@ class TreeWalkerTest : public TestCase
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>"));
DOM::Element<string_type> elem = d.getDocumentElement();
Arabica::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::Element<string_type> elem = d.getDocumentElement();
DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_PROCESSING_INSTRUCTION,
Arabica::DOM::Traversal::DocumentTraversal<string_type> traversal = d.createDocumentTraversal();
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_PROCESSING_INSTRUCTION,
true);
assert(walker.getCurrentNode() == elem);
assert(walker.nextNode() == elem.getLastChild().getLastChild());
assert(walker.nextNode() == 0);
} // 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:
typedef typename DOM::Traversal::NodeFilter<string_type>::Result Result;
virtual Result acceptNode(const DOM::Node<string_type>& node) const
typedef typename Arabica::DOM::Traversal::NodeFilter<string_type>::Result Result;
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_ACCEPT;
} // acceptNode
@ -177,13 +177,13 @@ class TreeWalkerTest : public TestCase
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>"));
DOM::Element<string_type> elem = d.getDocumentElement();
Arabica::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::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;
DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
DOM::Traversal::SHOW_ELEMENT,
Arabica::DOM::Traversal::TreeWalker<string_type> walker = traversal.createTreeWalker(d.getDocumentElement(),
Arabica::DOM::Traversal::SHOW_ELEMENT,
filter,
true);
assert(walker.getCurrentNode() == elem);

View file

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

View file

@ -24,7 +24,7 @@ public:
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("") == 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>
class AxisEnumeratorTest : public TestCase
{
DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_;
Arabica::DOM::DOMImplementation<string_type> factory_;
Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_;
Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_;
Arabica::DOM::Element<string_type> element1_;
Arabica::DOM::Element<string_type> element2_;
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:
AxisEnumeratorTest(const std::string& name) : TestCase(name)
@ -35,7 +35,7 @@ public:
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);
root_ = document_.getDocumentElement();
@ -67,7 +67,7 @@ public:
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);
assertTrue(*e == 0);
@ -76,7 +76,7 @@ public:
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);
assertTrue(*e == 0);
@ -95,7 +95,7 @@ public:
assertTrue(element3_ == *e);
assertTrue(string_adaptor::construct_from_utf8("child3") == e->getNodeName());
++e;
assertTrue(DOM::Node<string_type>() == *e);
assertTrue(Arabica::DOM::Node<string_type>() == *e);
assertTrue(*e == 0);
} // test3
@ -110,7 +110,7 @@ public:
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);
assertTrue(*e == 0);
@ -119,7 +119,7 @@ public:
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);
assertTrue(*e == 0);
@ -170,7 +170,7 @@ public:
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);
assertTrue(*e == 0);
assertTrue(e.forward());
@ -214,7 +214,7 @@ public:
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);
assertTrue(*e == 0);
assertTrue(e.reverse());
@ -275,7 +275,7 @@ public:
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);
assertTrue(*e == 0);
} // selfTest3
@ -686,8 +686,8 @@ public:
void namespaceNodeTest1()
{
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")));
DOM::Node<string_type> node2;
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")));
Arabica::DOM::Node<string_type> node2;
node2 = node;
} // namespaceNodeTest1
@ -695,9 +695,9 @@ public:
void namespaceNodeTest2()
{
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;
}
} // namespaceNodeTest2
@ -705,9 +705,9 @@ public:
void namespaceNodeTest3()
{
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 = 0;
@ -716,7 +716,7 @@ public:
void namespaceNodeTest4()
{
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("test-uri") == node.getNodeValue());
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);
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("http://www.w3.org/XML/1998/namespace") == ns.getNodeValue());
++e;
@ -741,7 +741,7 @@ public:
string_adaptor::construct_from_utf8("urn:test"));
Arabica::XPath::AxisEnumerator<string_type, string_adaptor> e(root_, Arabica::XPath::NAMESPACE);
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());
++e;
assertTrue(*e != 0);

View file

@ -65,7 +65,7 @@ public:
TestFunction(const std::vector<Arabica::XPath::XPathExpressionPtr<string_type> >& 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
{
string_type name = string_adaptor::construct_from_utf8("test-");
@ -94,27 +94,27 @@ template<class string_type, class string_adaptor>
class ExecuteTest : public TestCase
{
Arabica::XPath::XPath<string_type> parser;
DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_;
Arabica::DOM::DOMImplementation<string_type> factory_;
Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_;
Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_;
DOM::Element<string_type> spinkle_;
Arabica::DOM::Element<string_type> element1_;
Arabica::DOM::Element<string_type> element2_;
Arabica::DOM::Element<string_type> element3_;
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;
public:
@ -124,7 +124,7 @@ public:
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);
root_ = document_.getDocumentElement();
@ -182,7 +182,7 @@ public:
assertValuesEqual(NODE_SET, result->type());
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);
} // test1
@ -194,7 +194,7 @@ public:
assertValuesEqual(NODE_SET, result->type());
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);
} // test2
@ -341,7 +341,7 @@ public:
assertValuesEqual(NODE_SET, result->type());
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);
} // test12
@ -414,7 +414,7 @@ public:
assertValuesEqual(NODE_SET, result->type());
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);
} // test19
@ -651,10 +651,10 @@ public:
void test42()
{
using namespace Arabica::XPath;
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> f1 = 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_);
DOM::Node<string_type> n = ch->asNodeSet()[0];
Arabica::DOM::Node<string_type> n = ch->asNodeSet()[0];
n.appendChild(f1);
n = ch->asNodeSet()[1];
n.appendChild(f2);
@ -799,7 +799,7 @@ public:
void testUnion11()
{
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")));
NodeSetVariableResolver<string_type, string_adaptor> svr;
@ -817,9 +817,9 @@ public:
void testUnion12()
{
using namespace Arabica::XPath;
DOM::DocumentFragment<string_type> frag = document_.createDocumentFragment();
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::DocumentFragment<string_type> frag = document_.createDocumentFragment();
Arabica::DOM::Node<string_type> n1 = document_.createElement(SA::construct_from_utf8("foo"));
Arabica::DOM::Node<string_type> n2 = document_.createElement(SA::construct_from_utf8("bar"));
frag.appendChild(n1);
frag.appendChild(n2);

View file

@ -13,27 +13,27 @@ template<class string_type, class string_adaptor>
class ExpressionTest : public TestCase
{
Arabica::XPath::XPath<string_type> parser;
DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_;
Arabica::DOM::DOMImplementation<string_type> factory_;
Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_;
Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_;
DOM::Element<string_type> spinkle_;
Arabica::DOM::Element<string_type> element1_;
Arabica::DOM::Element<string_type> element2_;
Arabica::DOM::Element<string_type> element3_;
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;
public:
@ -43,7 +43,7 @@ public:
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);
root_ = document_.getDocumentElement();

View file

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

View file

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

View file

@ -11,22 +11,22 @@
template<class string_type, class string_adaptor>
class NodeTestTest : public TestCase
{
DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_;
Arabica::DOM::DOMImplementation<string_type> factory_;
Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_;
Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_;
Arabica::DOM::Element<string_type> element1_;
Arabica::DOM::Element<string_type> element2_;
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;
@ -37,7 +37,7 @@ public:
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);
root_ = document_.getDocumentElement();
@ -218,17 +218,17 @@ public:
impl::QNameNodeTest<string_type> test(SA::construct_from_utf8("http://example.com/test"),
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"));
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"));
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"));
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"));
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"));
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"));
assertTrue(test(e1_));
@ -244,12 +244,12 @@ public:
using namespace Arabica::XPath;
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"));
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"));
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"));
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> e1_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:one"));
Arabica::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> e3_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/test"), SA::construct_from_utf8("ns:two"));
Arabica::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> e5_ = document_.createElementNS(SA::construct_from_utf8("http://example.com/ssss"), SA::construct_from_utf8("ns: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(e2_));

View file

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

View file

@ -13,16 +13,16 @@ class StepTest : public TestCase
{
typedef string_adaptor SA;
DOM::DOMImplementation<string_type> factory_;
DOM::Document<string_type> document_;
Arabica::DOM::DOMImplementation<string_type> factory_;
Arabica::DOM::Document<string_type> document_;
DOM::Element<string_type> root_;
Arabica::DOM::Element<string_type> root_;
DOM::Element<string_type> element1_;
DOM::Element<string_type> element2_;
DOM::Element<string_type> element3_;
Arabica::DOM::Element<string_type> element1_;
Arabica::DOM::Element<string_type> element2_;
Arabica::DOM::Element<string_type> element3_;
DOM::Attr<string_type> attr_;
Arabica::DOM::Attr<string_type> attr_;
public:
StepTest(const std::string& name) : TestCase(name)
@ -31,7 +31,7 @@ public:
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);
root_ = document_.getDocumentElement();
@ -75,13 +75,13 @@ public:
NodeSet<string_type> set = step->evaluateAsNodeSet(element2_);
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"));
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"));
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"));
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"));
} // test2

View file

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

View file

@ -16,30 +16,30 @@ const std::string PATH_PREFIX=test_path;
const std::string SEPERATOR = "/";
#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);
SAX2DOM::Parser<std::string> parser;
Arabica::SAX2DOM::Parser<std::string> parser;
parser.parse(is);
DOM::Document<std::string> d = parser.getDocument();
Arabica::DOM::Document<std::string> d = parser.getDocument();
if(d != 0)
d.normalize();
return d;
} // 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;
return xpath.evaluate(path, node)->asNodeSet();
} // 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];
} // 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;
return xpath.evaluate_expr(path, node)->asString();
@ -124,7 +124,7 @@ protected:
std::ostringstream errors;
stylesheet->set_error_output(errors);
DOM::Document<std::string> document = buildDOM(input_xml_);
Arabica::DOM::Document<std::string> document = buildDOM(input_xml_);
try {
stylesheet->execute(document);
}
@ -169,7 +169,7 @@ protected:
std::ostringstream errors;
stylesheet->set_error_output(errors);
DOM::Document<std::string> document = buildDOM(input_xml_);
Arabica::DOM::Document<std::string> document = buildDOM(input_xml_);
try {
stylesheet->execute(document);
}
@ -177,10 +177,10 @@ protected:
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)
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 outs = docToString(out.getFirstChild());
@ -196,19 +196,19 @@ protected:
}
} // runTest
std::string docToString(DOM::Node<std::string> node)
std::string docToString(Arabica::DOM::Node<std::string> node)
{
std::ostringstream ss;
ss << node;
return Arabica::string::normalize_whitespace<std::string, Arabica::default_string_adaptor<std::string> >(ss.str());
} // 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);
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();
size_t index = text.find_first_of(" \n");
while(index != std::string::npos)
@ -230,7 +230,7 @@ class Expected
public:
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);
for(int i = 0; i != failcases.size(); ++i)
{
@ -264,7 +264,7 @@ static Expected expected;
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;