chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chLatin_##ff, chNull}
+#define UNICODE_LITERAL_33(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chLatin_##ff, chLatin_##gg, chNull}
+#define UNICODE_LITERAL_34(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh) \
+ {chLatin_##a, chLatin_##b, chLatin_##c, chLatin_##d, chLatin_##e, chLatin_##f, chLatin_##g, chLatin_##h, chLatin_##i, \
+ chLatin_##j, chLatin_##k, chLatin_##l, chLatin_##m, chLatin_##n, chLatin_##o, chLatin_##p, chLatin_##q, chLatin_##r, \
+ chLatin_##s, chLatin_##t, chLatin_##u, chLatin_##v, chLatin_##w, chLatin_##x, chLatin_##y, chLatin_##z, \
+ chLatin_##aa, chLatin_##bb, chLatin_##cc, chLatin_##dd, chLatin_##ee, chLatin_##ff, chLatin_##gg, chLatin_##hh, chNull}
#endif /* DOXYGEN_SKIP */
/**
*/
#include "internal.h"
-#include "AbstractAttributeExtensibleXMLObject.h"
-#include "AbstractElementProxy.h"
#include "exceptions.h"
#include "impl/AnyElement.h"
-#include "io/AbstractXMLObjectMarshaller.h"
-#include "io/AbstractXMLObjectUnmarshaller.h"
#include "util/NDC.h"
#include "util/XMLHelper.h"
using namespace log4cpp;
using namespace std;
-#if defined (_MSC_VER)
- #pragma warning( push )
- #pragma warning( disable : 4250 4251 )
-#endif
+XMLObject* AnyElementImpl::clone() const {
+ auto_ptr<XMLObject> domClone(AbstractDOMCachingXMLObject::clone());
+ AnyElementImpl* ret=dynamic_cast<AnyElementImpl*>(domClone.get());
+ if (ret) {
+ domClone.release();
+ return ret;
+ }
-namespace xmltooling {
-
- /**
- * Implements a smart wrapper around unknown DOM content.
- */
- class XMLTOOL_DLLLOCAL AnyElementImpl : public AbstractDOMCachingXMLObject,
- public AbstractElementProxy, public AbstractAttributeExtensibleXMLObject,
- public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller
- {
- public:
- virtual ~AnyElementImpl() {}
-
- AnyElementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL)
- : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
-
- AnyElementImpl* clone() const {
- auto_ptr<XMLObject> domClone(AbstractDOMCachingXMLObject::clone());
- AnyElementImpl* ret=dynamic_cast<AnyElementImpl*>(domClone.get());
- if (ret) {
- domClone.release();
- return ret;
- }
-
- return new AnyElementImpl(*this);
- }
-
- protected:
- AnyElementImpl(const AnyElementImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src),
- AbstractElementProxy(src), AbstractAttributeExtensibleXMLObject(src) {
- for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
- getXMLObjects().push_back((*i) ? (*i)->clone() : NULL);
- }
- }
-
- void marshallAttributes(DOMElement* domElement) const {
- for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
- DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
- if (i->first.hasPrefix())
- attr->setPrefix(i->first.getPrefix());
- attr->setNodeValue(i->second);
- domElement->setAttributeNode(attr);
- }
- }
-
- void marshallElementContent(DOMElement* domElement) const {
- if(getTextContent()) {
- domElement->appendChild(domElement->getOwnerDocument()->createTextNode(getTextContent()));
- }
- }
-
- void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- getXMLObjects().push_back(childXMLObject);
- }
+ return new AnyElementImpl(*this);
+}
- void processAttribute(const DOMAttr* attribute) {
- QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
- setAttribute(q,attribute->getNodeValue());
- }
+AnyElementImpl::AnyElementImpl(const AnyElementImpl& src) : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src),
+ AbstractElementProxy(src), AbstractAttributeExtensibleXMLObject(src) {
+ for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
+ getXMLObjects().push_back((*i) ? (*i)->clone() : NULL);
+ }
+}
+
+void AnyElementImpl::marshallAttributes(DOMElement* domElement) const {
+ for (map<QName,XMLCh*>::const_iterator i=m_attributeMap.begin(); i!=m_attributeMap.end(); i++) {
+ DOMAttr* attr=domElement->getOwnerDocument()->createAttributeNS(i->first.getNamespaceURI(),i->first.getLocalPart());
+ if (i->first.hasPrefix())
+ attr->setPrefix(i->first.getPrefix());
+ attr->setNodeValue(i->second);
+ domElement->setAttributeNode(attr);
+ }
+}
- void processElementContent(const XMLCh* elementContent) {
- setTextContent(elementContent);
- }
- };
+void AnyElementImpl::marshallElementContent(DOMElement* domElement) const {
+ if(getTextContent()) {
+ domElement->appendChild(domElement->getOwnerDocument()->createTextNode(getTextContent()));
+ }
+}
-};
+void AnyElementImpl::processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
+ getXMLObjects().push_back(childXMLObject);
+}
-#if defined (_MSC_VER)
- #pragma warning( pop )
-#endif
+void AnyElementImpl::processAttribute(const DOMAttr* attribute) {
+ QName q(attribute->getNamespaceURI(),attribute->getLocalName(),attribute->getPrefix());
+ setAttribute(q,attribute->getNodeValue());
+}
+void AnyElementImpl::processElementContent(const XMLCh* elementContent) {
+ setTextContent(elementContent);
+}
XMLObject* AnyElementBuilder::buildObject(
const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType
#if !defined(__xmltooling_anyelement_h__)
#define __xmltooling_anyelement_h__
+#include <xmltooling/AbstractAttributeExtensibleXMLObject.h>
+#include <xmltooling/AbstractElementProxy.h>
#include <xmltooling/XMLObjectBuilder.h>
+#include <xmltooling/io/AbstractXMLObjectMarshaller.h>
+#include <xmltooling/io/AbstractXMLObjectUnmarshaller.h>
+
+#if defined (_MSC_VER)
+ #pragma warning( push )
+ #pragma warning( disable : 4250 4251 )
+#endif
namespace xmltooling {
/**
+ * Implements a smart wrapper around unknown or arbitrary DOM content.
+ */
+ class XMLTOOL_API AnyElementImpl : public AbstractDOMCachingXMLObject,
+ public AbstractElementProxy,
+ public AbstractAttributeExtensibleXMLObject,
+ public AbstractXMLObjectMarshaller,
+ public AbstractXMLObjectUnmarshaller
+ {
+ public:
+ virtual ~AnyElementImpl() {}
+
+ AnyElementImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=NULL, const QName* schemaType=NULL)
+ : AbstractXMLObject(nsURI, localName, prefix, schemaType) {}
+
+ XMLObject* clone() const;
+
+ protected:
+ AnyElementImpl(const AnyElementImpl& src);
+
+ void marshallAttributes(DOMElement* domElement) const;
+ void marshallElementContent(DOMElement* domElement) const;
+ void processChildElement(XMLObject* childXMLObject, const DOMElement* root);
+ void processAttribute(const DOMAttr* attribute);
+ void processElementContent(const XMLCh* elementContent);
+ };
+
+ /**
* Builder for AnyElementImpl objects.
* Use as the default builder when you want to wrap each unknown element and
* process the DOM content through xmltooling interfaces.
};
+#if defined (_MSC_VER)
+ #pragma warning( pop )
+#endif
+
#endif /* __xmltooling_anyelement_h__ */