summaryrefslogtreecommitdiffstats
path: root/unoxml/source/dom
diff options
context:
space:
mode:
authorLars Oppermann <lo@openoffice.org>2004-01-28 15:32:05 +0000
committerLars Oppermann <lo@openoffice.org>2004-01-28 15:32:05 +0000
commitb055c439ed9b580369be05fdc1eab09cdf2fcc14 (patch)
tree95d123a5f67065c5bf3cdd008490317cfd649645 /unoxml/source/dom
parentINTEGRATION: CWS filtercfg (1.1.2); FILE ADDED (diff)
downloadcore-b055c439ed9b580369be05fdc1eab09cdf2fcc14.tar.gz
core-b055c439ed9b580369be05fdc1eab09cdf2fcc14.zip
added
Diffstat (limited to 'unoxml/source/dom')
-rw-r--r--unoxml/source/dom/attr.cxx166
-rw-r--r--unoxml/source/dom/attr.hxx248
-rw-r--r--unoxml/source/dom/attributesmap.cxx242
-rw-r--r--unoxml/source/dom/attributesmap.hxx132
-rw-r--r--unoxml/source/dom/cdatasection.cxx80
-rw-r--r--unoxml/source/dom/cdatasection.hxx261
-rw-r--r--unoxml/source/dom/characterdata.cxx214
-rw-r--r--unoxml/source/dom/characterdata.hxx141
-rw-r--r--unoxml/source/dom/childlist.cxx106
-rw-r--r--unoxml/source/dom/childlist.hxx99
-rw-r--r--unoxml/source/dom/comment.cxx79
-rw-r--r--unoxml/source/dom/comment.hxx254
-rw-r--r--unoxml/source/dom/document.cxx509
-rw-r--r--unoxml/source/dom/document.hxx346
-rw-r--r--unoxml/source/dom/documentbuilder.cxx209
-rw-r--r--unoxml/source/dom/documentbuilder.hxx174
-rw-r--r--unoxml/source/dom/documentfragment.cxx79
-rw-r--r--unoxml/source/dom/documentfragment.hxx214
-rw-r--r--unoxml/source/dom/documenttype.cxx160
-rw-r--r--unoxml/source/dom/documenttype.hxx252
-rw-r--r--unoxml/source/dom/domimplementation.cxx101
-rw-r--r--unoxml/source/dom/domimplementation.hxx108
-rw-r--r--unoxml/source/dom/element.cxx419
-rw-r--r--unoxml/source/dom/element.hxx323
-rw-r--r--unoxml/source/dom/elementlist.cxx128
-rw-r--r--unoxml/source/dom/elementlist.hxx111
-rw-r--r--unoxml/source/dom/entitiesmap.cxx134
-rw-r--r--unoxml/source/dom/entitiesmap.hxx131
-rw-r--r--unoxml/source/dom/entity.cxx122
-rw-r--r--unoxml/source/dom/entity.hxx235
-rw-r--r--unoxml/source/dom/entityreference.cxx84
-rw-r--r--unoxml/source/dom/entityreference.hxx211
-rw-r--r--unoxml/source/dom/makefile.mk105
-rw-r--r--unoxml/source/dom/node.cxx722
-rw-r--r--unoxml/source/dom/node.hxx296
-rw-r--r--unoxml/source/dom/notation.cxx102
-rw-r--r--unoxml/source/dom/notation.hxx226
-rw-r--r--unoxml/source/dom/notationsmap.cxx134
-rw-r--r--unoxml/source/dom/notationsmap.hxx132
-rw-r--r--unoxml/source/dom/processinginstruction.cxx115
-rw-r--r--unoxml/source/dom/processinginstruction.hxx228
-rw-r--r--unoxml/source/dom/saxbuilder.cxx417
-rw-r--r--unoxml/source/dom/saxbuilder.hxx179
-rw-r--r--unoxml/source/dom/text.cxx91
-rw-r--r--unoxml/source/dom/text.hxx266
45 files changed, 9085 insertions, 0 deletions
diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx
new file mode 100644
index 000000000000..93bea1a90e12
--- /dev/null
+++ b/unoxml/source/dom/attr.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * $RCSfile: attr.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:30:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "attr.hxx"
+#include "element.hxx"
+#include <com/sun/star/xml/dom/DOMException.hdl>
+
+namespace DOM
+{
+ CAttr::CAttr(const xmlAttrPtr pAttr)
+ {
+ m_aAttrPtr = pAttr;
+ m_aNodeType = NodeType_ATTRIBUTE_NODE;
+ init_node((xmlNodePtr)pAttr);
+ }
+
+ OUString SAL_CALL CAttr::getNodeName()
+ throw (RuntimeException)
+ {
+ return getName();
+ }
+ OUString SAL_CALL CAttr::getNodeValue()
+ throw (RuntimeException)
+ {
+ return getValue();
+ }
+
+
+ /**
+ Returns the name of this attribute.
+ */
+ OUString SAL_CALL CAttr::getName() throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aAttrPtr != NULL)
+ {
+ aName = OUString((char*)m_aAttrPtr->name, strlen((char*)m_aAttrPtr->name), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+
+ /**
+ The Element node this attribute is attached to or null if this
+ attribute is not in use.
+ */
+ Reference< XElement > SAL_CALL CAttr::getOwnerElement()
+ throw (RuntimeException)
+ {
+ Reference< XElement > aElement;
+ if (m_aAttrPtr != NULL && m_aAttrPtr->parent != NULL)
+ {
+ aElement = Reference< XElement >(static_cast< CElement* >(CNode::get(m_aAttrPtr->parent)));
+ }
+ return aElement;
+ }
+
+ /**
+ If this attribute was explicitly given a value in the original
+ document, this is true; otherwise, it is false.
+ */
+ sal_Bool SAL_CALL CAttr::getSpecified()
+ throw (RuntimeException)
+ {
+ // XXX what is this supposed do exactly?
+ return sal_False;
+ }
+
+ /**
+ On retrieval, the value of the attribute is returned as a string.
+ */
+ OUString SAL_CALL CAttr::getValue()
+ throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aAttrPtr != NULL && m_aAttrPtr->children != NULL)
+ {
+ aName = OUString((char*)m_aAttrPtr->children->content, strlen((char*)m_aAttrPtr->children->content),
+ RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+
+ /**
+ Sets the value of the attribute from a string.
+ */
+ void SAL_CALL CAttr::setValue(const OUString& value)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
+ xmlChar* xValue = (xmlChar*)o1.getStr();
+ // xmlChar* xName = OUStringToOString(m_aAttrPtr->name, RTL_TEXTENCODING_UTF8).getStr();
+ // this does not work if the attribute was created anew
+ // xmlNodePtr pNode = m_aAttrPtr->parent;
+ // xmlSetProp(pNode, m_aAttrPtr->name, xValue);
+ xmlChar *buffer = xmlEncodeEntitiesReentrant(m_aAttrPtr->doc, xValue);
+ m_aAttrPtr->children = xmlStringGetNodeList(m_aAttrPtr->doc, buffer);
+ xmlNodePtr tmp = m_aAttrPtr->children;
+ while (tmp != NULL) {
+ tmp->parent = (xmlNodePtr) m_aNodePtr;
+ tmp->doc = m_aAttrPtr->doc;
+ if (tmp->next == NULL)
+ m_aNodePtr->last = tmp;
+ tmp = tmp->next;
+ }
+ xmlFree(buffer);
+ }
+
+}
diff --git a/unoxml/source/dom/attr.hxx b/unoxml/source/dom/attr.hxx
new file mode 100644
index 000000000000..04c4a6ee901f
--- /dev/null
+++ b/unoxml/source/dom/attr.hxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * $RCSfile: attr.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:30:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ATTR_HXX
+#define _ATTR_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XAttr.hpp>
+#include "node.hxx"
+#include <libxml/tree.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CAttr : public cppu::ImplInheritanceHelper1< CNode, XAttr >
+ {
+ friend class CNode;
+ friend class CElement;
+ private:
+ xmlAttrPtr m_aAttrPtr;
+
+ protected:
+ CAttr(const xmlAttrPtr aAttrPtr);
+
+ public:
+ /**
+ Returns the name of this attribute.
+ */
+ virtual OUString SAL_CALL getName() throw (RuntimeException);
+
+ /**
+ The Element node this attribute is attached to or null if this
+ attribute is not in use.
+ */
+ virtual Reference< XElement > SAL_CALL getOwnerElement() throw (RuntimeException);
+
+ /**
+ If this attribute was explicitly given a value in the original
+ document, this is true; otherwise, it is false.
+ */
+ virtual sal_Bool SAL_CALL getSpecified()throw (RuntimeException);
+
+ /**
+ On retrieval, the value of the attribute is returned as a string.
+ */
+ virtual OUString SAL_CALL getValue() throw (RuntimeException);
+
+ /**
+ Sets the value of the attribute from a string.
+ */
+
+ virtual void SAL_CALL setValue(const OUString& value) throw (RuntimeException);
+
+ // resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+}
+
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/attributesmap.cxx b/unoxml/source/dom/attributesmap.cxx
new file mode 100644
index 000000000000..cce691f5e098
--- /dev/null
+++ b/unoxml/source/dom/attributesmap.cxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * $RCSfile: attributesmap.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:30:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "attributesmap.hxx"
+
+namespace DOM
+{
+ CAttributesMap::CAttributesMap(const CElement* aElement)
+ : m_pElement(aElement)
+ {
+ }
+
+ /**
+ The number of nodes in this map.
+ */
+ sal_Int32 SAL_CALL CAttributesMap::getLength() throw (RuntimeException)
+ {
+ sal_Int32 count = 0;
+ xmlNodePtr pNode = m_pElement->m_aNodePtr;
+ if (pNode != NULL)
+ {
+ xmlAttrPtr cur = pNode->properties;
+ while (cur != NULL)
+ {
+ count++;
+ cur = cur->next;
+ }
+ }
+ return count;
+
+ }
+
+ /**
+ Retrieves a node specified by local name
+ */
+ Reference< XNode > SAL_CALL CAttributesMap::getNamedItem(const OUString& name) throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ xmlNodePtr pNode = m_pElement->m_aNodePtr;
+ if (pNode != NULL)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar* xName = (xmlChar*)o1.getStr();
+ xmlAttrPtr cur = pNode->properties;
+ while (cur != NULL)
+ {
+ if( strcmp((char*)xName, (char*)cur->name) == 0)
+ {
+ aNode = Reference< XNode >(static_cast<CNode*>(CNode::get((xmlNodePtr)cur)));
+ break;
+ }
+ cur = cur->next;
+ }
+ }
+ return aNode;
+ }
+
+ /**
+ Retrieves a node specified by local name and namespace URI.
+ */
+ Reference< XNode > SAL_CALL CAttributesMap::getNamedItemNS(const OUString& namespaceURI,const OUString& localName) throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ xmlNodePtr pNode = m_pElement->m_aNodePtr;
+ if (pNode != NULL)
+ {
+ OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8);
+ xmlChar* xName = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8);
+ xmlChar* xNs = (xmlChar*)o1.getStr();
+ xmlNsPtr pNs = xmlSearchNs(pNode->doc, pNode, xNs);
+ xmlAttrPtr cur = pNode->properties;
+ while (cur != NULL && pNs != NULL)
+ {
+ if( strcmp((char*)xName, (char*)cur->name) == 0 &&
+ cur->ns == pNs)
+ {
+ aNode = Reference< XNode >(static_cast< CNode* >(CNode::get((xmlNodePtr)cur)));
+ break;
+ }
+ cur = cur->next;
+ }
+ }
+ return aNode;
+ }
+
+ /**
+ Returns the indexth item in the map.
+ */
+ Reference< XNode > SAL_CALL CAttributesMap::item(sal_Int32 index) throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ xmlNodePtr pNode = m_pElement->m_aNodePtr;
+ if (pNode != NULL)
+ {
+ xmlAttrPtr cur = pNode->properties;
+ sal_Int32 count = 0;
+ while (cur != NULL)
+ {
+ if (count == index)
+ {
+ aNode = Reference< XNode >(static_cast< CNode* >(CNode::get((xmlNodePtr)cur)));
+ break;
+ }
+ count++;
+ cur = cur->next;
+ }
+ }
+ return aNode;
+
+ }
+
+ /**
+ Removes a node specified by name.
+ */
+ Reference< XNode > SAL_CALL CAttributesMap::removeNamedItem(const OUString& name) throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ xmlNodePtr pNode = m_pElement->m_aNodePtr;
+ if (pNode != NULL)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar* xName = (xmlChar*)o1.getStr();
+ xmlAttrPtr cur = pNode->properties;
+ while (cur != NULL)
+ {
+ if( strcmp((char*)xName, (char*)cur->name) == 0)
+ {
+ aNode = Reference< XNode >(static_cast< CNode* >(CNode::get((xmlNodePtr)cur)));
+ xmlUnlinkNode((xmlNodePtr)cur);
+ break;
+ }
+ cur = cur->next;
+ }
+ }
+ return aNode;
+ }
+
+ /**
+ // Removes a node specified by local name and namespace URI.
+ */
+ Reference< XNode > SAL_CALL CAttributesMap::removeNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ xmlNodePtr pNode = m_pElement->m_aNodePtr;
+ if (pNode != NULL)
+ {
+ OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8);
+ xmlChar* xName = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8);
+ xmlChar* xNs = (xmlChar*)o1.getStr();
+ xmlNsPtr pNs = xmlSearchNs(pNode->doc, pNode, xNs);
+ xmlAttrPtr cur = pNode->properties;
+ while (cur != NULL && pNs != NULL)
+ {
+ if( strcmp((char*)xName, (char*)cur->name) == 0 &&
+ cur->ns == pNs)
+ {
+ aNode = Reference< XNode >(static_cast< CNode* >(CNode::get((xmlNodePtr)cur)));
+ xmlUnlinkNode((xmlNodePtr)cur);
+ break;
+ }
+ cur = cur->next;
+ }
+ }
+ return aNode;
+ }
+
+ /**
+ // Adds a node using its nodeName attribute.
+ */
+ Reference< XNode > SAL_CALL CAttributesMap::setNamedItem(const Reference< XNode >& arg) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Adds a node using its namespaceURI and localName.
+ */
+ Reference< XNode > SAL_CALL CAttributesMap::setNamedItemNS(const Reference< XNode >& arg) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/attributesmap.hxx b/unoxml/source/dom/attributesmap.hxx
new file mode 100644
index 000000000000..05d2d7d9dc10
--- /dev/null
+++ b/unoxml/source/dom/attributesmap.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: attributesmap.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:30:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ATTRIBUTESMAP_HXX
+#define _ATTRIBUTESMAP_HXX
+
+#include <map>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+#include "node.hxx"
+#include "element.hxx"
+#include "attr.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CAttributesMap : public cppu::WeakImplHelper1< XNamedNodeMap >
+ {
+ private:
+ const CElement* m_pElement;
+ public:
+ CAttributesMap(const CElement* aDocType);
+
+ /**
+ The number of nodes in this map.
+ */
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
+
+ /**
+ Retrieves a node specified by local name
+ */
+ virtual Reference< XNode > SAL_CALL getNamedItem(const OUString& name) throw (RuntimeException);
+
+ /**
+ Retrieves a node specified by local name and namespace URI.
+ */
+ virtual Reference< XNode > SAL_CALL getNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException);
+
+ /**
+ Returns the indexth item in the map.
+ */
+ virtual Reference< XNode > SAL_CALL item(sal_Int32 index) throw (RuntimeException);
+
+ /**
+ Removes a node specified by name.
+ */
+ virtual Reference< XNode > SAL_CALL removeNamedItem(const OUString& name) throw (RuntimeException);
+
+ /**
+ // Removes a node specified by local name and namespace URI.
+ */
+ virtual Reference< XNode > SAL_CALL removeNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException);
+
+ /**
+ // Adds a node using its nodeName attribute.
+ */
+ virtual Reference< XNode > SAL_CALL setNamedItem(const Reference< XNode >& arg) throw (RuntimeException);
+
+ /**
+ Adds a node using its namespaceURI and localName.
+ */
+ virtual Reference< XNode > SAL_CALL setNamedItemNS(const Reference< XNode >& arg) throw (RuntimeException);
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/cdatasection.cxx b/unoxml/source/dom/cdatasection.cxx
new file mode 100644
index 000000000000..041e51edae81
--- /dev/null
+++ b/unoxml/source/dom/cdatasection.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * $RCSfile: cdatasection.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:30:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "cdatasection.hxx"
+
+namespace DOM
+{
+ CCDATASection::CCDATASection(const xmlNodePtr aNodePtr)
+ {
+ m_aNodeType = NodeType_CDATA_SECTION_NODE;
+ init_text(aNodePtr);
+ }
+
+ OUString SAL_CALL CCDATASection::getNodeName()throw (RuntimeException)
+ {
+ return OUString::createFromAscii("#cdata-section");
+ }
+ OUString SAL_CALL CCDATASection::getNodeValue() throw (RuntimeException)
+ {
+ return CCharacterData::getData();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/cdatasection.hxx b/unoxml/source/dom/cdatasection.hxx
new file mode 100644
index 000000000000..723dc493b15c
--- /dev/null
+++ b/unoxml/source/dom/cdatasection.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * $RCSfile: cdatasection.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CDATASECTION_HXX
+#define _CDATASECTION_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XCDATASection.hpp>
+
+#include "text.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CCDATASection : public cppu::ImplInheritanceHelper1< CText, XCDATASection >
+ {
+ friend class CNode;
+ protected:
+ CCDATASection(const xmlNodePtr aNodePtr);
+
+ public:
+ virtual Reference< XText > SAL_CALL splitText(sal_Int32 offset)
+ throw (RuntimeException)
+ {
+ return CText::splitText(offset);
+ }
+
+ // --- delegations for XCharacterData
+ virtual void SAL_CALL appendData(const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::appendData(arg);
+ }
+ virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ CCharacterData::deleteData(offset, count);
+ }
+ virtual OUString SAL_CALL getData() throw (RuntimeException)
+ {
+ return CCharacterData::getData();
+ }
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException)
+ {
+ return CCharacterData::getLength();
+ }
+ virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::insertData(offset, arg);
+ }
+ virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::replaceData(offset, count, arg);
+ }
+ virtual void SAL_CALL setData(const OUString& data)
+ throw (RuntimeException)
+ {
+ CCharacterData::setData(data);
+ }
+ virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ return CCharacterData::subStringData(offset, count);
+ }
+
+
+ // --- overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+
+}
+
+#endif
diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx
new file mode 100644
index 000000000000..d3e4fe05d427
--- /dev/null
+++ b/unoxml/source/dom/characterdata.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: characterdata.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "characterdata.hxx"
+
+namespace DOM
+{
+
+ CCharacterData::CCharacterData()
+ {}
+
+ void CCharacterData::init_characterdata(const xmlNodePtr aNodePtr)
+ {
+ init_node(aNodePtr);
+ }
+
+ /**
+ Append the string to the end of the character data of the node.
+ */
+ void SAL_CALL CCharacterData::appendData(const OUString& arg)
+ throw (RuntimeException)
+ {
+ if (m_aNodePtr != NULL)
+ {
+ xmlNodeAddContent(m_aNodePtr, (const xmlChar*)(OUStringToOString(arg, RTL_TEXTENCODING_UTF8).getStr()));
+ }
+ }
+
+ /**
+ Remove a range of 16-bit units from the node.
+ */
+ void SAL_CALL CCharacterData::deleteData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ if (m_aNodePtr != NULL)
+ {
+ // get current data
+ OString aData((const sal_Char*)xmlNodeGetContent(m_aNodePtr));
+ OUString tmp(aData, aData.getLength(), RTL_TEXTENCODING_UTF8);
+ if (offset > tmp.getLength() || offset < 0 || count < 0)
+ return;
+ if ((offset+count) > tmp.getLength())
+ count = tmp.getLength() - offset;
+
+ OUString tmp2 = tmp.copy(0, offset);
+ tmp2 += tmp.copy(offset+count, tmp.getLength() - (offset+count));
+ xmlNodeSetContent(m_aNodePtr, (const xmlChar*)(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
+ }
+ }
+
+
+ /**
+ Return the character data of the node that implements this interface.
+ */
+ OUString SAL_CALL CCharacterData::getData() throw (RuntimeException)
+ {
+ OUString aData;
+ if (m_aNodePtr != NULL)
+ {
+ aData = OUString((const sal_Char*)m_aNodePtr->content, strlen((const sal_Char*)m_aNodePtr->content), RTL_TEXTENCODING_UTF8);
+ }
+ return aData;
+ }
+
+ /**
+ The number of 16-bit units that are available through data and the
+ substringData method below.
+ */
+ sal_Int32 CCharacterData::getLength() throw (RuntimeException)
+ {
+ sal_Int32 length = 0;
+ if (m_aNodePtr != NULL)
+ {
+ OUString aData((const sal_Char*)m_aNodePtr->content, strlen((const sal_Char*)m_aNodePtr->content), RTL_TEXTENCODING_UTF8);
+ length = aData.getLength();
+ }
+ return length;
+ }
+
+ /**
+ Insert a string at the specified 16-bit unit offset.
+ */
+ void SAL_CALL CCharacterData::insertData(sal_Int32 offset, const OUString& arg)
+ throw (RuntimeException)
+ {
+ if (m_aNodePtr != NULL)
+ {
+ // get current data
+ OString aData((const sal_Char*)xmlNodeGetContent(m_aNodePtr));
+ OUString tmp(aData, aData.getLength(), RTL_TEXTENCODING_UTF8);
+ if (offset > tmp.getLength() || offset < 0)
+ return;
+
+ OUString tmp2 = tmp.copy(0, offset);
+ tmp2 += arg;
+ tmp2 += tmp.copy(offset, tmp.getLength() - offset);
+ xmlNodeSetContent(m_aNodePtr, (const xmlChar*)(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
+ }
+ }
+
+
+ /**
+ Replace the characters starting at the specified 16-bit unit offset
+ with the specified string.
+ */
+ void SAL_CALL CCharacterData::replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
+ throw (RuntimeException)
+ {
+ if (m_aNodePtr != NULL)
+ {
+ // get current data
+ OString aData((const sal_Char*)xmlNodeGetContent(m_aNodePtr));
+ OUString tmp(aData, aData.getLength(), RTL_TEXTENCODING_UTF8);
+ if (offset > tmp.getLength() || offset < 0 || count < 0)
+ return;
+ if ((offset+count) > tmp.getLength())
+ count = tmp.getLength() - offset;
+
+ OUString tmp2 = tmp.copy(0, offset);
+ tmp2 += arg;
+ tmp2 += tmp.copy(offset+count, tmp.getLength() - (offset+count));
+ xmlNodeSetContent(m_aNodePtr, (const xmlChar*)(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
+ }
+ }
+
+ /**
+ Set the character data of the node that implements this interface.
+ */
+ void SAL_CALL CCharacterData::setData(const OUString& data)
+ throw (RuntimeException)
+ {
+ if (m_aNodePtr != NULL)
+ {
+ xmlNodeSetContent(m_aNodePtr, (const xmlChar*)(OUStringToOString(data, RTL_TEXTENCODING_UTF8).getStr()));
+ }
+ }
+
+ /**
+ Extracts a range of data from the node.
+ */
+ OUString SAL_CALL CCharacterData::subStringData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ OUString aStr;
+ if (m_aNodePtr != NULL)
+ {
+ // get current data
+ OString aData((const sal_Char*)xmlNodeGetContent(m_aNodePtr));
+ OUString tmp(aData, aData.getLength(), RTL_TEXTENCODING_UTF8);
+ aStr = tmp.copy(offset, count);
+ }
+ return aStr;
+ }
+
+
+} // namspace DOM \ No newline at end of file
diff --git a/unoxml/source/dom/characterdata.hxx b/unoxml/source/dom/characterdata.hxx
new file mode 100644
index 000000000000..d2727d72a1af
--- /dev/null
+++ b/unoxml/source/dom/characterdata.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * $RCSfile: characterdata.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CHARACTERDATA_HXX
+#define _CHARACTERDATA_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XCharacterData.hpp>
+#include <com/sun/star/xml/dom/XElement.hpp>
+#include <com/sun/star/xml/dom/XDOMImplementation.hpp>
+#include <libxml/tree.h>
+#include "node.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CCharacterData : public cppu::ImplInheritanceHelper1< CNode, XCharacterData >
+ {
+ protected:
+ CCharacterData();
+ void init_characterdata(const xmlNodePtr aNodePtr);
+
+ public:
+ /**
+ Append the string to the end of the character data of the node.
+ */
+ virtual void SAL_CALL appendData(const OUString& arg)
+ throw (RuntimeException);
+
+ /**
+ Remove a range of 16-bit units from the node.
+ */
+ virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException);
+
+ /**
+ Return the character data of the node that implements this interface.
+ */
+ virtual OUString SAL_CALL getData() throw (RuntimeException);
+
+ /**
+ The number of 16-bit units that are available through data and the
+ substringData method below.
+ */
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
+
+ /**
+ Insert a string at the specified 16-bit unit offset.
+ */
+ virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
+ throw (RuntimeException);
+
+ /**
+ Replace the characters starting at the specified 16-bit unit offset
+ with the specified string.
+ */
+ virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
+ throw (RuntimeException);
+
+ /**
+ Set the character data of the node that implements this interface.
+ */
+ virtual void SAL_CALL setData(const OUString& data)
+ throw (RuntimeException);
+
+ /**
+ Extracts a range of data from the node.
+ */
+ virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException);
+
+ };
+}
+
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/childlist.cxx b/unoxml/source/dom/childlist.cxx
new file mode 100644
index 000000000000..18f3fd1421b1
--- /dev/null
+++ b/unoxml/source/dom/childlist.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * $RCSfile: childlist.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "childlist.hxx"
+namespace DOM
+{
+ CChildList::CChildList(const CNode* base)
+ : m_pNode(base->m_aNodePtr)
+ {
+ }
+
+ /**
+ The number of nodes in the list.
+ */
+ sal_Int32 SAL_CALL CChildList::getLength() throw (RuntimeException)
+ {
+ sal_Int32 length = 0;
+ if (m_pNode != NULL)
+ {
+ xmlNodePtr cur = m_pNode->children;
+ while (cur != NULL)
+ {
+ length++;
+ cur = cur->next;
+ }
+ }
+ return length;
+
+ }
+ /**
+ Returns the indexth item in the collection.
+ */
+ Reference< XNode > SAL_CALL CChildList::item(sal_Int32 index) throw (RuntimeException)
+ {
+ Reference< XNode >aNode;
+ if (m_pNode != NULL)
+ {
+ xmlNodePtr cur = m_pNode->children;
+ while (cur != NULL)
+ {
+ if (index-- == 0)
+ aNode = Reference< XNode >(CNode::get(cur));
+ cur = cur->next;
+ }
+ }
+ return aNode;
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/childlist.hxx b/unoxml/source/dom/childlist.hxx
new file mode 100644
index 000000000000..e9c40a5c7506
--- /dev/null
+++ b/unoxml/source/dom/childlist.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * $RCSfile: childlist.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CHILDLIST_HXX
+#define _CHILDLIST_HXX
+
+#include <map>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XNodeList.hpp>
+#include "node.hxx"
+#include "libxml/tree.h"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CChildList : public cppu::WeakImplHelper1< XNodeList >
+ {
+ private:
+ const xmlNodePtr m_pNode;
+ public:
+ CChildList(const CNode* base);
+ /**
+ The number of nodes in the list.
+ */
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
+ /**
+ Returns the indexth item in the collection.
+ */
+ virtual Reference< XNode > SAL_CALL item(sal_Int32 index) throw (RuntimeException);
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/comment.cxx b/unoxml/source/dom/comment.cxx
new file mode 100644
index 000000000000..d880664e57a9
--- /dev/null
+++ b/unoxml/source/dom/comment.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: comment.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "comment.hxx"
+
+namespace DOM
+{
+ CComment::CComment(const xmlNodePtr aNodePtr)
+ {
+ m_aNodeType = NodeType_COMMENT_NODE;
+ init_node(aNodePtr);
+ }
+ OUString SAL_CALL CComment::getNodeName()throw (RuntimeException)
+ {
+ return OUString::createFromAscii("#comment");
+ }
+ OUString SAL_CALL CComment::getNodeValue() throw (RuntimeException)
+ {
+ return CCharacterData::getData();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/comment.hxx b/unoxml/source/dom/comment.hxx
new file mode 100644
index 000000000000..8f3f90db9d85
--- /dev/null
+++ b/unoxml/source/dom/comment.hxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * $RCSfile: comment.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COMMENT_HXX
+#define _COMMENT_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XComment.hpp>
+#include "characterdata.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CComment : public cppu::ImplInheritanceHelper1< CCharacterData, XComment >
+ {
+ friend class CNode;
+ protected:
+ CComment(const xmlNodePtr aNodePtr);
+
+ public:
+
+ // --- delegations for XCharacterData
+ virtual void SAL_CALL appendData(const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::appendData(arg);
+ }
+ virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ CCharacterData::deleteData(offset, count);
+ }
+ virtual OUString SAL_CALL getData() throw (RuntimeException)
+ {
+ return CCharacterData::getData();
+ }
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException)
+ {
+ return CCharacterData::getLength();
+ }
+ virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::insertData(offset, arg);
+ }
+ virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::replaceData(offset, count, arg);
+ }
+ virtual void SAL_CALL setData(const OUString& data)
+ throw (RuntimeException)
+ {
+ CCharacterData::setData(data);
+ }
+ virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ return CCharacterData::subStringData(offset, count);
+ }
+
+
+ // --- overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
new file mode 100644
index 000000000000..e04a9efe6220
--- /dev/null
+++ b/unoxml/source/dom/document.cxx
@@ -0,0 +1,509 @@
+/*************************************************************************
+ *
+ * $RCSfile: document.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "document.hxx"
+#include "attr.hxx"
+#include "element.hxx"
+#include "cdatasection.hxx"
+#include "documentfragment.hxx"
+#include "text.hxx"
+#include "cdatasection.hxx"
+#include "comment.hxx"
+#include "processinginstruction.hxx"
+#include "entityreference.hxx"
+#include "documenttype.hxx"
+#include "elementlist.hxx"
+#include "domimplementation.hxx"
+
+namespace DOM
+{
+
+
+ void CDocument::addnode(xmlNodePtr aNode)
+ {
+ if (aNode != (xmlNodePtr)m_aDocPtr)
+ {
+ Reference< XNode >* nref = new Reference< XNode >(CNode::get(aNode));
+ m_aNodeRefList.push_back(nref);
+ }
+ }
+
+ CDocument::~CDocument()
+ {
+ Reference< XNode >* pRef;
+ nodereflist_t::const_iterator r = m_aNodeRefList.begin();
+ while (r!=m_aNodeRefList.end())
+ {
+ pRef = *r;
+ delete pRef;
+ r++;
+ }
+
+ // get rid of leftover instances, if anybody still holds a
+ // reference to one of these, it will be invalid!
+ /*
+ CNode* aNode = 0;
+ nodelist_t::const_iterator i = m_aNodeList.begin();
+ while (i!=m_aNodeList.end())
+ {
+ aNode = CNode::get(*i, sal_False);
+ if (aNode != 0)
+ {
+ // CNode::remove(*i);
+ // delete will remove
+ delete aNode;
+ }
+ i++;
+ }
+ */
+
+ xmlFreeDoc(m_aDocPtr);
+
+ }
+
+ CDocument::CDocument(xmlDocPtr aDocPtr)
+ {
+ m_aDocPtr = aDocPtr;
+ m_aNodeType = NodeType_DOCUMENT_NODE;
+ // init node base
+ init_node((xmlNodePtr)m_aDocPtr);
+ }
+
+ // Creates an Attr of the given name.
+ Reference< XAttr > SAL_CALL CDocument::createAttribute(const OUString& name)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ return Reference< XAttr >(static_cast< CAttr* >(
+ CNode::get((xmlNodePtr)xmlNewDocProp(m_aDocPtr, xName, NULL))));
+ };
+
+ // Creates an attribute of the given qualified name and namespace URI.
+ Reference< XAttr > SAL_CALL CDocument::createAttributeNS(
+ const OUString& ns, const OUString& qname)
+ throw (RuntimeException)
+ {
+
+ // libxml does not allow a NS definition to be attached to an
+ // attribute node - which is a good thing, since namespaces are
+ // only defined as parts of element nodes
+ // thus, we create a temporary element node which carries the ns definition
+ // and is removed/merged as soon as the attribute gets append to it's
+ // actual parent
+ sal_Int32 i = qname.indexOf(':');
+ OString oPrefix, oName, oUri;
+ xmlChar *xPrefix, *xName, *xUri;
+ if (i != -1)
+ {
+ oPrefix = OUStringToOString(qname.copy(0, i), RTL_TEXTENCODING_UTF8);
+ xPrefix = (xmlChar*)oPrefix.getStr();
+ oName = OUStringToOString(qname.copy(i+1, qname.getLength()-i-1), RTL_TEXTENCODING_UTF8);
+ }
+ else
+ {
+ xPrefix = (xmlChar*)"";
+ oName = OUStringToOString(qname, RTL_TEXTENCODING_UTF8);
+ }
+ xName = (xmlChar*)oName.getStr();
+ oUri = OUStringToOString(ns, RTL_TEXTENCODING_UTF8);
+ xUri = (xmlChar*)oUri.getStr();
+
+ // create the carrier node
+ xmlNodePtr pNode = xmlNewDocNode(m_aDocPtr, NULL, (xmlChar*)"__private", NULL);
+ xmlNsPtr pNs = xmlNewNs(pNode, xUri, xPrefix);
+ xmlAttrPtr pAttr = xmlNewNsProp(pNode, pNs, xName, NULL);
+ return Reference< XAttr >(static_cast< CAttr* >(CNode::get((xmlNodePtr)pAttr)));
+ };
+
+ // Creates a CDATASection node whose value is the specified string.
+ Reference< XCDATASection > SAL_CALL CDocument::createCDATASection(const OUString& data)
+ throw (RuntimeException)
+ {
+ xmlChar *xData = (xmlChar*)OUStringToOString(data, RTL_TEXTENCODING_UTF8).getStr();
+ xmlNodePtr pText = xmlNewCDataBlock(m_aDocPtr, xData, strlen((char*)xData));
+ return Reference< XCDATASection >(static_cast< CCDATASection* >(CNode::get(pText)));
+ }
+
+ // Creates a Comment node given the specified string.
+ Reference< XComment > SAL_CALL CDocument::createComment(const OUString& data)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(data, RTL_TEXTENCODING_UTF8);
+ xmlChar *xData = (xmlChar*)o1.getStr();
+ xmlNodePtr pComment = xmlNewDocComment(m_aDocPtr, xData);
+ return Reference< XComment >(static_cast< CComment* >(CNode::get(pComment)));
+ }
+
+ //Creates an empty DocumentFragment object.
+ Reference< XDocumentFragment > SAL_CALL CDocument::createDocumentFragment()
+ throw (RuntimeException)
+ {
+ xmlNodePtr pFrag = xmlNewDocFragment(m_aDocPtr);
+ return Reference< XDocumentFragment >(static_cast< CDocumentFragment* >(CNode::get(pFrag)));
+ }
+
+ // Creates an element of the type specified.
+ Reference< XElement > SAL_CALL CDocument::createElement(const OUString& tagName)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(tagName, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ xmlNodePtr aNodePtr = xmlNewDocNode(m_aDocPtr, NULL, xName, NULL);
+ return Reference< XElement >(static_cast< CElement* >(CNode::get(aNodePtr)));
+ }
+
+ // Creates an element of the given qualified name and namespace URI.
+ Reference< XElement > SAL_CALL CDocument::createElementNS(
+ const OUString& ns, const OUString& qname)
+ throw (RuntimeException)
+ {
+ sal_Int32 i = qname.indexOf(':');
+ if (ns.getLength() == 0) throw RuntimeException();
+ xmlChar *xPrefix;
+ xmlChar *xName;
+ OString o1, o2, o3;
+ if ( i != -1) {
+ o1 = OUStringToOString(qname.copy(0, i), RTL_TEXTENCODING_UTF8);
+ xPrefix = (xmlChar*)o1.getStr();
+ o2 = OUStringToOString(qname.copy(i+1, qname.getLength()-i-1), RTL_TEXTENCODING_UTF8);
+ xName = (xmlChar*)o2.getStr();
+ } else {
+ // default prefix
+ xPrefix = (xmlChar*)"";
+ o2 = OUStringToOString(qname, RTL_TEXTENCODING_UTF8);
+ xName = (xmlChar*)o2.getStr();
+ }
+ o3 = OUStringToOString(ns, RTL_TEXTENCODING_UTF8);
+ xmlChar *xUri = (xmlChar*)o3.getStr();
+
+ // xmlNsPtr aNsPtr = xmlNewReconciledNs?
+ // xmlNsPtr aNsPtr = xmlNewGlobalNs?
+ xmlNodePtr aNodePtr = xmlNewDocNode(m_aDocPtr, NULL, xName, NULL);
+ xmlNsPtr pNs = xmlNewNs(aNodePtr, xUri, xPrefix);
+ xmlSetNs(aNodePtr, pNs);
+ return Reference< XElement >(static_cast< CElement* >(CNode::get(aNodePtr)));
+ }
+
+ //Creates an EntityReference object.
+ Reference< XEntityReference > SAL_CALL CDocument::createEntityReference(const OUString& name)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ xmlNodePtr aNodePtr = xmlNewReference(m_aDocPtr, xName);
+ return Reference< XEntityReference >(static_cast< CEntityReference* >(CNode::get(aNodePtr)));
+ }
+
+ // Creates a ProcessingInstruction node given the specified name and
+ // data strings.
+ Reference< XProcessingInstruction > SAL_CALL CDocument::createProcessingInstruction(
+ const OUString& target, const OUString& data)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(target, RTL_TEXTENCODING_UTF8);
+ xmlChar *xTarget = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(data, RTL_TEXTENCODING_UTF8);
+ xmlChar *xData = (xmlChar*)o2.getStr();
+ xmlNodePtr aNodePtr = xmlNewPI(xTarget, xData);
+ aNodePtr->doc = m_aDocPtr;
+ return Reference< XProcessingInstruction >(static_cast< CProcessingInstruction* >(CNode::get(aNodePtr)));
+ }
+
+ // Creates a Text node given the specified string.
+ Reference< XText > SAL_CALL CDocument::createTextNode(const OUString& data)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(data, RTL_TEXTENCODING_UTF8);
+ xmlChar *xData = (xmlChar*)o1.getStr();
+ xmlNodePtr aNodePtr = xmlNewDocText(m_aDocPtr, xData);
+ return Reference< XText >(static_cast< CText* >(CNode::get(aNodePtr)));
+ }
+
+ // The Document Type Declaration (see DocumentType) associated with this
+ // document.
+ Reference< XDocumentType > SAL_CALL CDocument::getDoctype()
+ throw (RuntimeException)
+ {
+ // find the doc type
+ xmlNodePtr cur = m_aDocPtr->children;
+ while (cur != NULL)
+ {
+ if (cur->type == XML_DOCUMENT_TYPE_NODE || cur->type == XML_DTD_NODE)
+ break;
+ }
+ return Reference< XDocumentType >(static_cast< CDocumentType* >(CNode::get(cur)));
+ }
+
+ // This is a convenience attribute that allows direct access to the child
+ // node that is the root element of the document.
+ Reference< XElement > SAL_CALL CDocument::getDocumentElement()
+ throw (RuntimeException)
+ {
+ // find the document element
+ xmlNodePtr cur = m_aDocPtr->children;
+ while (cur != NULL)
+ {
+ if (cur->type == XML_ELEMENT_NODE)
+ break;
+ cur = cur->next;
+ }
+ return Reference< XElement >(static_cast< CElement* >(CNode::get(cur)));
+ }
+
+ static xmlNodePtr _search_element_by_id(const xmlNodePtr cur, const xmlChar* id)
+ {
+
+ if (cur == NULL)
+ return NULL;
+ // look in current node
+ if (cur->type == XML_ELEMENT_NODE)
+ {
+ xmlAttrPtr a = cur->properties;
+ while (a != NULL)
+ {
+ if (a->atype == XML_ATTRIBUTE_ID) {
+ if (strcmp((char*)a->children->content, (char*)id) == NULL)
+ return cur;
+ }
+ a = a->next;
+ }
+ }
+ // look in children
+ xmlNodePtr result = _search_element_by_id(cur->children, id);
+ if (result != NULL)
+ return result;
+ result = _search_element_by_id(cur->next, id);
+ return result;
+ }
+
+ // Returns the Element whose ID is given by elementId.
+ Reference< XElement > SAL_CALL CDocument::getElementById(const OUString& elementId)
+ throw (RuntimeException)
+ {
+ // search the tree for an element with the given ID
+ OString o1 = OUStringToOString(elementId, RTL_TEXTENCODING_UTF8);
+ xmlChar *xId = (xmlChar*)o1.getStr();
+ Reference< XUnoTunnel > tunnel(getDocumentElement(), UNO_QUERY);
+ xmlNodePtr pStart = (xmlNodePtr)tunnel->getSomething(Sequence< sal_Int8>());
+ xmlNodePtr aNodePtr = _search_element_by_id(pStart, xId);
+ return Reference< XElement >(static_cast< CElement* >(CNode::get(aNodePtr)));
+ }
+
+
+ Reference< XNodeList > SAL_CALL CDocument::getElementsByTagName(const OUString& tagname)
+ throw (RuntimeException)
+ {
+ // build a list
+ return Reference< XNodeList >(
+ new CElementList(static_cast< CElement* >(
+ this->getDocumentElement().get()), tagname));
+ }
+
+ Reference< XNodeList > SAL_CALL CDocument::getElementsByTagNameNS(
+ const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException)
+ {
+ return Reference< XNodeList >(
+ new CElementList(static_cast< CElement* >(
+ this->getDocumentElement().get()), namespaceURI, localName));
+ }
+
+ Reference< XDOMImplementation > SAL_CALL CDocument::getImplementation()
+ throw (RuntimeException)
+ {
+ // XXX
+ return Reference< XDOMImplementation >(CDOMImplementation::get());
+ }
+
+ // helper function to recall import for siblings
+ static Reference< XNode > _import_siblings (
+ const Reference< XNode > aNode, const Reference< XNode> parent, CDocument* pTarget)
+ {
+ Reference< XNode > sibling = aNode;
+ Reference< XNode > tmp;
+ Reference< XNode > firstImported;
+ while (sibling.is())
+ {
+ tmp = pTarget->importNode(sibling, sal_True);
+ parent->appendChild(tmp);
+ if (!firstImported.is())
+ firstImported = tmp;
+ sibling = sibling->getNextSibling();
+ }
+ return firstImported;
+ }
+
+ Reference< XNode > SAL_CALL CDocument::importNode(
+ const Reference< XNode >& importedNode, sal_Bool deep)
+ throw (RuntimeException)
+ {
+ // this node could be from another memory model
+ // only use uno interfaces to access is!!!
+
+ // allready in doc?
+ if ( importedNode->getOwnerDocument() ==
+ Reference< XDocument>(static_cast< CDocument* >(CNode::get((xmlNodePtr)m_aDocPtr))))
+ return importedNode;
+
+ Reference< XNode > aNode;
+ switch (importedNode->getNodeType())
+ {
+ case NodeType_ATTRIBUTE_NODE:
+ {
+ Reference< XAttr > attr(importedNode, UNO_QUERY);
+ Reference< XAttr > newAttr = createAttribute(attr->getName());
+ newAttr->setValue(attr->getValue());
+ aNode.set(newAttr, UNO_QUERY);
+ break;
+ }
+ case NodeType_CDATA_SECTION_NODE:
+ {
+ Reference< XCDATASection > cdata(importedNode, UNO_QUERY);
+ Reference< XCDATASection > newCdata = createCDATASection(cdata->getData());
+ aNode.set(newCdata, UNO_QUERY);
+ break;
+ }
+ case NodeType_COMMENT_NODE:
+ {
+ Reference< XComment > comment(importedNode, UNO_QUERY);
+ Reference< XComment > newComment = createComment(comment->getData());
+ aNode.set(newComment, UNO_QUERY);
+ break;
+ }
+ case NodeType_DOCUMENT_FRAGMENT_NODE:
+ {
+ Reference< XDocumentFragment > frag(importedNode, UNO_QUERY);
+ Reference< XDocumentFragment > newFrag = createDocumentFragment();
+ aNode.set(newFrag, UNO_QUERY);
+ break;
+ }
+ case NodeType_ELEMENT_NODE:
+ {
+ Reference< XElement > element(importedNode, UNO_QUERY);
+ Reference< XElement > newElement(createElement(element->getTagName()));
+ // get attributes
+ if (element->hasAttributes())
+ {
+ Reference< XNamedNodeMap > attribs = element->getAttributes();
+ Reference< XAttr > curAttr;
+ for (sal_Int32 i = 0; i < attribs->getLength(); i++)
+ {
+ curAttr = Reference< XAttr >(attribs->item(i), UNO_QUERY);
+ newElement->setAttributeNS(curAttr->getNamespaceURI(), curAttr->getNodeName(), curAttr->getValue());
+ }
+ }
+ aNode.set(newElement, UNO_QUERY);
+ break;
+ }
+ case NodeType_ENTITY_REFERENCE_NODE:
+ {
+ Reference< XEntityReference > ref(importedNode, UNO_QUERY);
+ Reference< XEntityReference > newRef(createEntityReference(ref->getNodeName()));
+ aNode.set(newRef, UNO_QUERY);
+ break;
+ }
+ case NodeType_PROCESSING_INSTRUCTION_NODE:
+ {
+ Reference< XProcessingInstruction > pi(importedNode, UNO_QUERY);
+ Reference< XProcessingInstruction > newPi(
+ createProcessingInstruction(pi->getTarget(), pi->getData()));
+ aNode.set(newPi, UNO_QUERY);
+ break;
+ }
+ case NodeType_TEXT_NODE:
+ {
+ Reference< XText > text(importedNode, UNO_QUERY);
+ Reference< XText > newText(createTextNode(text->getData()));
+ aNode.set(newText, UNO_QUERY);
+ break;
+ }
+ case NodeType_ENTITY_NODE:
+ case NodeType_DOCUMENT_NODE:
+ case NodeType_DOCUMENT_TYPE_NODE:
+ case NodeType_NOTATION_NODE:
+ default:
+ // can't be imported
+ throw RuntimeException();
+ break;
+
+ }
+ if (deep)
+ {
+ // get children and import them
+ Reference< XNode > child = importedNode->getFirstChild();
+ if (child.is())
+ {
+ Reference< XNode > ic = _import_siblings(child, aNode, this);
+ aNode->appendChild(ic);
+ }
+ }
+ return aNode;
+ }
+ OUString SAL_CALL CDocument::getNodeName()throw (RuntimeException)
+ {
+ return OUString::createFromAscii("#document");
+ }
+ OUString SAL_CALL CDocument::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+}
diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx
new file mode 100644
index 000000000000..944c756fe39a
--- /dev/null
+++ b/unoxml/source/dom/document.hxx
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *
+ * $RCSfile: document.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DOCUMENT_HXX
+#define _DOCUMENT_HXX
+
+#include <list>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XAttr.hpp>
+#include <com/sun/star/xml/dom/XElement.hpp>
+#include <com/sun/star/xml/dom/XDOMImplementation.hpp>
+
+#include "node.hxx"
+
+#include <libxml/tree.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+
+ typedef std::list< Reference< XNode >* > nodereflist_t;
+
+ class CDocument : public cppu::ImplInheritanceHelper1< CNode, XDocument >
+ {
+ friend class CNode;
+ private:
+
+ nodereflist_t m_aNodeRefList;
+
+ xmlDocPtr m_aDocPtr;
+ Reference< XDocumentType > m_rDocType;
+ Reference< XElement > m_rDocElement;
+
+ protected:
+ CDocument(xmlDocPtr aDocPtr);
+
+ void addnode(xmlNodePtr aNode);
+ public:
+
+ virtual ~CDocument();
+
+ /**
+ Creates an Attr of the given name.
+ */
+ virtual Reference< XAttr > SAL_CALL createAttribute(const OUString& name)
+ throw (RuntimeException);
+
+ /**
+ Creates an attribute of the given qualified name and namespace URI.
+ */
+ virtual Reference< XAttr > SAL_CALL createAttributeNS(const OUString& namespaceURI, const OUString& qualifiedName)
+ throw (RuntimeException);
+
+ /**
+ Creates a CDATASection node whose value is the specified string.
+ */
+ virtual Reference< XCDATASection > SAL_CALL createCDATASection(const OUString& data)
+ throw (RuntimeException);
+
+ /**
+ Creates a Comment node given the specified string.
+ */
+ virtual Reference< XComment > SAL_CALL createComment(const OUString& data)
+ throw (RuntimeException);
+
+ /**
+ Creates an empty DocumentFragment object.
+ */
+ virtual Reference< XDocumentFragment > SAL_CALL createDocumentFragment()
+ throw (RuntimeException);
+
+ /**
+ Creates an element of the type specified.
+ */
+ virtual Reference< XElement > SAL_CALL createElement(const OUString& tagName)
+ throw (RuntimeException);
+
+ /**
+ Creates an element of the given qualified name and namespace URI.
+ */
+ virtual Reference< XElement > SAL_CALL createElementNS(const OUString& namespaceURI, const OUString& qualifiedName)
+ throw (RuntimeException);
+
+ /**
+ Creates an EntityReference object.
+ */
+ virtual Reference< XEntityReference > SAL_CALL createEntityReference(const OUString& name)
+ throw (RuntimeException);
+
+ /**
+ Creates a ProcessingInstruction node given the specified name and
+ data strings.
+ */
+ virtual Reference< XProcessingInstruction > SAL_CALL createProcessingInstruction(
+ const OUString& target, const OUString& data)
+ throw (RuntimeException);
+
+ /**
+ Creates a Text node given the specified string.
+ */
+ virtual Reference< XText > SAL_CALL createTextNode(const OUString& data)
+ throw (RuntimeException);
+
+ /**
+ The Document Type Declaration (see DocumentType) associated with this
+ document.
+ */
+ virtual Reference< XDocumentType > SAL_CALL getDoctype()
+ throw (RuntimeException);
+
+ /**
+ This is a convenience attribute that allows direct access to the child
+ node that is the root element of the document.
+ */
+ virtual Reference< XElement > SAL_CALL getDocumentElement()
+ throw (RuntimeException);
+
+ /**
+ Returns the Element whose ID is given by elementId.
+ */
+ virtual Reference< XElement > SAL_CALL getElementById(const OUString& elementId)
+ throw (RuntimeException);
+
+ /**
+ Returns a NodeList of all the Elements with a given tag name in the
+ order in which they are encountered in a preorder traversal of the
+ Document tree.
+ */
+ virtual Reference< XNodeList > SAL_CALL getElementsByTagName(const OUString& tagname)
+ throw (RuntimeException);
+
+ /**
+ Returns a NodeList of all the Elements with a given local name and
+ namespace URI in the order in which they are encountered in a preorder
+ traversal of the Document tree.
+ */
+ virtual Reference< XNodeList > SAL_CALL getElementsByTagNameNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException);
+
+ /**
+ The DOMImplementation object that handles this document.
+ */
+ virtual Reference< XDOMImplementation > SAL_CALL getImplementation()
+ throw (RuntimeException);
+
+ /**
+ Imports a node from another document to this document.
+ */
+ virtual Reference< XNode > SAL_CALL importNode(const Reference< XNode >& importedNode, sal_Bool deep)
+ throw (RuntimeException);
+
+ // ---- resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+}
+
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx
new file mode 100644
index 000000000000..69aaf82e6379
--- /dev/null
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * $RCSfile: documentbuilder.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "documentbuilder.hxx"
+#include "node.hxx"
+#include "document.hxx"
+
+#include <rtl/alloc.h>
+#include <rtl/memory.h>
+
+namespace DOM
+{
+ extern "C" {
+ //char *strdup(const char *s);
+ static char* strdupfunc(const char* s)
+ {
+ sal_Int32 len = 0;
+ while (s[len] != '\0') len++;
+ char *newStr = (char*)rtl_allocateMemory(len+1);
+ if (newStr != NULL)
+ rtl_copyMemory(newStr, s, len+1);
+ return newStr;
+ }
+ }
+ sal_Bool CDocumentBuilder::m_bXmlInit = sal_False;
+ CDocumentBuilder::CDocumentBuilder(const Reference< XMultiServiceFactory >& xFactory)
+ : m_aFactory(xFactory)
+ {
+ // init libxml
+ if (! m_bXmlInit)
+ {
+ xmlMemSetup(rtl_freeMemory, (xmlMallocFunc)rtl_allocateMemory,
+ (xmlReallocFunc)rtl_reallocateMemory, strdupfunc);
+ xmlInitParser();
+ m_bXmlInit = sal_True;
+ }
+ }
+
+ Reference< XInterface > CDocumentBuilder::_getInstance(const Reference< XMultiServiceFactory >& rSMgr)
+ {
+ // XXX
+ return static_cast< XDocumentBuilder* >(new CDocumentBuilder(rSMgr));
+ }
+
+ const char* CDocumentBuilder::aImplementationName = "com.sun.star.comp.xml.dom.DocumentBuilder";
+ const char* CDocumentBuilder::aSupportedServiceNames[] = {
+ "com.sun.star.xml.dom.DocumentBuilder",
+ NULL
+ };
+
+ OUString CDocumentBuilder::_getImplementationName()
+ {
+ return OUString::createFromAscii(aImplementationName);
+ }
+ Sequence<OUString> CDocumentBuilder::_getSupportedServiceNames()
+ {
+ Sequence<OUString> aSequence;
+ for (int i=0; aSupportedServiceNames[i]!=NULL; i++) {
+ aSequence.realloc(i+1);
+ aSequence[i]=(OUString::createFromAscii(aSupportedServiceNames[i]));
+ }
+ return aSequence;
+ }
+
+ Sequence< OUString > SAL_CALL CDocumentBuilder::getSupportedServiceNames()
+ throw (RuntimeException)
+ {
+ return CDocumentBuilder::_getSupportedServiceNames();
+ }
+
+ OUString SAL_CALL CDocumentBuilder::getImplementationName()
+ throw (RuntimeException)
+ {
+ return CDocumentBuilder::_getImplementationName();
+ }
+
+ sal_Bool SAL_CALL CDocumentBuilder::supportsService(const OUString& aServiceName)
+ throw (RuntimeException)
+ {
+ Sequence< OUString > supported = CDocumentBuilder::_getSupportedServiceNames();
+ for (sal_Int32 i=0; i<supported.getLength(); i++)
+ {
+ if (supported[i] == aServiceName) return sal_True;
+ }
+ return sal_False;
+ }
+
+ Reference< XDOMImplementation > SAL_CALL CDocumentBuilder::getDOMImplementation()
+ throw (RuntimeException)
+ {
+
+ return Reference< XDOMImplementation >();
+ }
+
+ sal_Bool SAL_CALL CDocumentBuilder::isNamespaceAware()
+ throw (RuntimeException)
+ {
+ return sal_True;
+ }
+
+ sal_Bool SAL_CALL CDocumentBuilder::isValidating()
+ throw (RuntimeException)
+ {
+ return sal_False;
+ }
+
+ Reference< XDocument > SAL_CALL CDocumentBuilder::newDocument()
+ throw (RuntimeException)
+ {
+ // create a new document
+ xmlDocPtr pDocument = xmlNewDoc((const xmlChar*)"1.0");
+ return Reference< XDocument >(static_cast< CDocument* >(CNode::get((xmlNodePtr)pDocument)));
+ }
+
+ Reference< XDocument > SAL_CALL CDocumentBuilder::parse(const Reference< XInputStream >& is)
+ throw (RuntimeException)
+ {
+ sal_Int32 bsize = 4096;
+ char* buffer = new char[bsize];
+ sal_Int32 nbytes = 0;
+ sal_Int32 nread = 0;
+ sal_Int32 csize = bsize;
+ Sequence< sal_Int8 > chunk(csize);
+ do
+ {
+ // read mac csize bytes
+ nread = is->readBytes(chunk, csize);
+ // grow buffer?
+ if ((nbytes + nread) > bsize)
+ {
+ bsize = 2*bsize;
+ char *new_buffer = (char*)rtl_reallocateMemory(buffer, bsize);
+ if (new_buffer == 0)
+ throw RuntimeException();
+ buffer = new_buffer;
+ }
+ // copy bytes to buffer
+ rtl_copyMemory(buffer+nbytes, chunk.getConstArray(), nread);
+ nbytes += nread;
+ }
+ while(nread == csize);
+
+ // try to parse the buffer
+ xmlDocPtr pDoc = xmlParseMemory(buffer, nbytes);
+ // XXX error checking
+
+ return Reference< XDocument >(static_cast< CDocument* >(CNode::get((xmlNodePtr)pDoc)));
+
+ }
+
+}
diff --git a/unoxml/source/dom/documentbuilder.hxx b/unoxml/source/dom/documentbuilder.hxx
new file mode 100644
index 000000000000..2bf16a33dd36
--- /dev/null
+++ b/unoxml/source/dom/documentbuilder.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * $RCSfile: documentbuilder.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DOCUMENTBUILDER_HXX
+#define _DOCUMENTBUILDER_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/xml/dom/XDOMImplementation.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include "libxml/tree.h"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+using namespace com::sun::star::io;
+
+namespace DOM
+{
+ class CDocumentBuilder
+ : public ::cppu::WeakImplHelper2< XDocumentBuilder, XServiceInfo >
+ {
+ private:
+ Reference< XMultiServiceFactory > m_aFactory;
+
+ public:
+
+ // ctor
+ CDocumentBuilder(const Reference< XMultiServiceFactory >& xFactory);
+ static sal_Bool m_bXmlInit;
+
+ // call for factory
+ static Reference< XInterface > getInstance(const Reference < XMultiServiceFactory >& xFactory);
+
+ // static helpers for service info and component management
+ static const char* aImplementationName;
+ static const char* aSupportedServiceNames[];
+ static OUString _getImplementationName();
+ static Sequence< OUString > _getSupportedServiceNames();
+ static Reference< XInterface > _getInstance(const Reference< XMultiServiceFactory >& rSMgr);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
+ throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
+ throw (RuntimeException);
+
+ /**
+ Obtain an instance of a DOMImplementation object.
+ */
+ virtual Reference< XDOMImplementation > SAL_CALL getDOMImplementation()
+ throw (RuntimeException);
+
+ /**
+ Indicates whether or not this parser is configured to understand
+ namespaces.
+ */
+ virtual sal_Bool SAL_CALL isNamespaceAware()
+ throw (RuntimeException);
+
+ /**
+ Indicates whether or not this parser is configured to validate XML
+ documents.
+ */
+ virtual sal_Bool SAL_CALL isValidating()
+ throw (RuntimeException);
+
+ /**
+ Obtain a new instance of a DOM Document object to build a DOM tree
+ with.
+ */
+ virtual Reference< XDocument > SAL_CALL newDocument()
+ throw (RuntimeException);
+
+ /**
+ Parse the content of the given InputStream as an XML document and
+ return a new DOM Document object.
+ */
+ virtual Reference< XDocument > SAL_CALL parse(const Reference< XInputStream >& is)
+ throw (RuntimeException);
+
+ /**
+ Parse the content of the given URI as an XML document and return
+ a new DOM Document object.
+ */
+ //virtual XDocument SAL_CALL parse(const string& uri);
+
+ /**
+ Specify the EntityResolver to be used to resolve entities present
+ in the XML document to be parsed.
+ */
+ // virtual void SAL_CALL setEntityResolver(const XEntityResolver& er);
+
+ /**
+ Specify the ErrorHandler to be used to report errors present in
+ the XML document to be parsed.
+ */
+ //virtual void SAL_CALL setErrorHandler(const XErrorHandler& eh);
+ };
+}
+
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/documentfragment.cxx b/unoxml/source/dom/documentfragment.cxx
new file mode 100644
index 000000000000..0582b81bc3ac
--- /dev/null
+++ b/unoxml/source/dom/documentfragment.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: documentfragment.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "documentfragment.hxx"
+
+namespace DOM
+{
+ CDocumentFragment::CDocumentFragment(const xmlNodePtr aNodePtr)
+ {
+ m_aNodeType = NodeType_DOCUMENT_FRAGMENT_NODE;
+ init_node(aNodePtr);
+ }
+ OUString SAL_CALL CDocumentFragment::getNodeName()throw (RuntimeException)
+ {
+ return OUString::createFromAscii("#document-fragment");
+ }
+ OUString SAL_CALL CDocumentFragment::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/documentfragment.hxx b/unoxml/source/dom/documentfragment.hxx
new file mode 100644
index 000000000000..cde84989f1f9
--- /dev/null
+++ b/unoxml/source/dom/documentfragment.hxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: documentfragment.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DOCUMENTFRAGMENT_HXX
+#define _DOCUMENTFRAGMENT_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XDocumentFragment.hpp>
+
+#include "node.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CDocumentFragment : public cppu::ImplInheritanceHelper1< CNode, XDocumentFragment >
+ {
+ friend class CNode;
+ protected:
+ CDocumentFragment(const xmlNodePtr aNodePtr);
+
+ public:
+ // ---- resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+
+ };
+}
+#endif
+
diff --git a/unoxml/source/dom/documenttype.cxx b/unoxml/source/dom/documenttype.cxx
new file mode 100644
index 000000000000..f0639a483690
--- /dev/null
+++ b/unoxml/source/dom/documenttype.cxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * $RCSfile: documenttype.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:18 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "documenttype.hxx"
+#include "entitiesmap.hxx"
+#include "notationsmap.hxx"
+
+
+namespace DOM
+{
+
+ CDocumentType::CDocumentType(const xmlDtdPtr aDtdPtr)
+ {
+ m_aNodeType = NodeType_DOCUMENT_TYPE_NODE;
+ m_aDtdPtr = aDtdPtr;
+ init_node((xmlNodePtr)aDtdPtr);
+ }
+
+ /**
+ A NamedNodeMap containing the general entities, both external and
+ internal, declared in the DTD.
+ */
+ Reference< XNamedNodeMap > SAL_CALL CDocumentType::getEntities() throw (RuntimeException)
+ {
+ Reference< XNamedNodeMap > aMap;
+ if (m_aDtdPtr != NULL)
+ {
+ aMap = Reference< XNamedNodeMap >(new CEntitiesMap(this));
+ }
+ return aMap;
+ }
+
+ /**
+ The internal subset as a string, or null if there is none.
+ */
+ OUString SAL_CALL CDocumentType::getInternalSubset() throw (RuntimeException)
+ {
+ // XXX
+ return OUString();
+ }
+
+ /**
+ The name of DTD; i.e., the name immediately following the DOCTYPE
+ keyword.
+ */
+ OUString SAL_CALL CDocumentType::getName() throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aDtdPtr != NULL)
+ {
+ aName = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->name), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+
+ /**
+ A NamedNodeMap containing the notations declared in the DTD.
+ */
+ Reference< XNamedNodeMap > SAL_CALL CDocumentType::getNotations() throw (RuntimeException)
+ {
+ Reference< XNamedNodeMap > aMap;
+ if (m_aDtdPtr != NULL)
+ {
+ aMap.set(new CNotationsMap(this));
+ }
+ return aMap;
+ }
+
+ /**
+ The public identifier of the external subset.
+ */
+ OUString SAL_CALL CDocumentType::getPublicId() throw (RuntimeException)
+ {
+ OUString aId;
+ if (m_aDtdPtr != NULL)
+ {
+ aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->ExternalID), RTL_TEXTENCODING_UTF8);
+ }
+ return aId;
+ }
+
+ /**
+ The system identifier of the external subset.
+ */
+ OUString SAL_CALL CDocumentType::getSystemId() throw (RuntimeException)
+ {
+ OUString aId;
+ if (m_aDtdPtr != NULL)
+ {
+ aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->SystemID), RTL_TEXTENCODING_UTF8);
+ }
+ return aId;
+ }
+ OUString SAL_CALL CDocumentType::getNodeName()throw (RuntimeException)
+ {
+ return getName();
+ }
+ OUString SAL_CALL CDocumentType::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/documenttype.hxx b/unoxml/source/dom/documenttype.hxx
new file mode 100644
index 000000000000..ebab5389ea3e
--- /dev/null
+++ b/unoxml/source/dom/documenttype.hxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * $RCSfile: documenttype.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:21 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DOCUMENTTYPE_HXX
+#define _DOCUMENTTYPE_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XDocumentType.hpp>
+#include <com/sun/star/xml/dom/XNodeList.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+
+#include "node.hxx"
+
+#include <libxml/tree.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CDocumentType : public cppu::ImplInheritanceHelper1< CNode, XDocumentType >
+ {
+ friend class CNode;
+ private:
+ xmlDtdPtr m_aDtdPtr;
+
+ protected:
+ CDocumentType(const xmlDtdPtr aDtdPtr);
+
+ public:
+ /**
+ A NamedNodeMap containing the general entities, both external and
+ internal, declared in the DTD.
+ */
+ virtual Reference< XNamedNodeMap > SAL_CALL getEntities() throw (RuntimeException);
+
+ /**
+ The internal subset as a string, or null if there is none.
+ */
+ virtual OUString SAL_CALL getInternalSubset() throw (RuntimeException);
+
+ /**
+ The name of DTD; i.e., the name immediately following the DOCTYPE
+ keyword.
+ */
+ virtual OUString SAL_CALL getName() throw (RuntimeException);
+
+ /**
+ A NamedNodeMap containing the notations declared in the DTD.
+ */
+ virtual Reference< XNamedNodeMap > SAL_CALL getNotations() throw (RuntimeException);
+
+ /**
+ The public identifier of the external subset.
+ */
+ virtual OUString SAL_CALL getPublicId() throw (RuntimeException);
+
+ /**
+ The system identifier of the external subset.
+ */
+ virtual OUString SAL_CALL getSystemId() throw (RuntimeException);
+
+ // ---- resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+}
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/domimplementation.cxx b/unoxml/source/dom/domimplementation.cxx
new file mode 100644
index 000000000000..b60425951005
--- /dev/null
+++ b/unoxml/source/dom/domimplementation.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: domimplementation.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:21 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "domimplementation.hxx"
+
+namespace DOM
+{
+ CDOMImplementation* CDOMImplementation::aDOMImplementation = new CDOMImplementation();
+ CDOMImplementation* CDOMImplementation::get()
+ {
+ return CDOMImplementation::aDOMImplementation;
+ }
+
+ /**
+ Creates a DOM Document object of the specified type with its document element.
+ */
+ Reference <XDocument > SAL_CALL CDOMImplementation::createDocument(
+ const OUString& namespaceURI,
+ const OUString& qualifiedName,
+ const Reference< XDocumentType >& doctype)
+ throw (RuntimeException)
+ {
+ return Reference<XDocument>();
+ }
+
+ /**
+ Creates an empty DocumentType node.
+ */
+ Reference< XDocumentType > SAL_CALL CDOMImplementation::createDocumentType(
+ const OUString& qualifiedName, const OUString& publicId, const OUString& systemId)
+ throw (RuntimeException)
+ {
+ return Reference<XDocumentType>();
+ }
+ /**
+ Test if the DOM implementation implements a specific feature.
+ */
+ sal_Bool SAL_CALL CDOMImplementation::hasFeature(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return sal_False;
+ }
+}
diff --git a/unoxml/source/dom/domimplementation.hxx b/unoxml/source/dom/domimplementation.hxx
new file mode 100644
index 000000000000..b510f23e2548
--- /dev/null
+++ b/unoxml/source/dom/domimplementation.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * $RCSfile: domimplementation.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:22 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DOMIMPLEMENTATION_HXX
+#define _DOMIMPLEMENTATION_HXX
+
+#include <map>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/xml/dom/XDocumentType.hpp>
+#include <com/sun/star/xml/dom/XDOMImplementation.hpp>
+#include <com/sun/star/xml/dom/XDOMImplementation.hpp>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CDOMImplementation : public cppu::WeakImplHelper1< XDOMImplementation >
+ {
+
+ public:
+ static CDOMImplementation* aDOMImplementation;
+ static CDOMImplementation* get();
+
+ /**
+ Creates a DOM Document object of the specified type with its document element.
+ */
+ virtual Reference <XDocument > SAL_CALL createDocument(const OUString& namespaceURI, const OUString& qualifiedName, const Reference< XDocumentType >& doctype)
+ throw (RuntimeException);
+
+ /**
+ Creates an empty DocumentType node.
+ */
+ virtual Reference< XDocumentType > SAL_CALL createDocumentType(const OUString& qualifiedName, const OUString& publicId, const OUString& systemId)
+ throw (RuntimeException);
+
+ /**
+ Test if the DOM implementation implements a specific feature.
+ */
+ virtual sal_Bool SAL_CALL hasFeature(const OUString& feature, const OUString& ver)
+ throw (RuntimeException);
+ };
+}
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
new file mode 100644
index 000000000000..393ce2f54b36
--- /dev/null
+++ b/unoxml/source/dom/element.cxx
@@ -0,0 +1,419 @@
+/*************************************************************************
+ *
+ * $RCSfile: element.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:23 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "element.hxx"
+#include "attr.hxx"
+#include "elementlist.hxx"
+#include "attributesmap.hxx"
+
+namespace DOM
+{
+
+ CElement::CElement(const xmlNodePtr aNodePtr)
+ {
+ m_aNodeType = NodeType_ELEMENT_NODE;
+ init_node(aNodePtr);
+ }
+
+ /**
+ Retrieves an attribute value by name.
+ */
+ OUString CElement::getAttribute(const OUString& name)
+ throw (RuntimeException)
+ {
+ OUString aValue;
+ // search properties
+ if (m_aNodePtr != NULL)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ aValue = OUString((sal_Char*)xmlGetProp(m_aNodePtr, xName), strlen((char*)xName), RTL_TEXTENCODING_UTF8);
+ }
+ return aValue;
+ }
+
+ /**
+ Retrieves an attribute node by name.
+ */
+ Reference< XAttr > CElement::getAttributeNode(const OUString& name)
+ throw (RuntimeException)
+ {
+ Reference< XAttr > aAttr;
+ if (m_aNodePtr != NULL)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ xmlAttrPtr pAttr = xmlHasProp(m_aNodePtr, xName);
+ aAttr = Reference< XAttr >(static_cast< CAttr* >(CNode::get((xmlNodePtr)pAttr)));
+ }
+ return aAttr;
+ }
+
+ /**
+ Retrieves an Attr node by local name and namespace URI.
+ */
+ Reference< XAttr > CElement::getAttributeNodeNS(
+ const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException)
+ {
+ Reference< XAttr > aAttr;
+ if (m_aNodePtr != NULL)
+ {
+ OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8);
+ xmlChar *xNS = (xmlChar*)o2.getStr();
+ xmlAttrPtr pAttr = xmlHasNsProp(m_aNodePtr, xName, xNS);
+ aAttr = Reference< XAttr >(static_cast< CAttr* >(CNode::get((xmlNodePtr)pAttr)));
+ }
+ return aAttr;
+ }
+
+ /**
+ Retrieves an attribute value by local name and namespace URI.
+ */
+ OUString CElement::getAttributeNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException)
+ {
+ OUString aValue;
+ // search properties
+ if (m_aNodePtr != NULL)
+ {
+ OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8);
+ xmlChar *xNS = (xmlChar*)o2.getStr();
+ xmlChar *xValue = (xmlChar*)xmlGetNsProp(m_aNodePtr, xName, xNS);
+ aValue = OUString((sal_Char*)xValue, strlen((char*)xValue), RTL_TEXTENCODING_UTF8);
+ }
+ return aValue;
+ }
+
+ /**
+ Returns a NodeList of all descendant Elements with a given tag name,
+ in the order in which they are
+ encountered in a preorder traversal of this Element tree.
+ */
+ Reference< XNodeList > CElement::getElementsByTagName(const OUString& name)
+ throw (RuntimeException)
+ {
+ Reference< XNodeList > aList = Reference< XNodeList >(new CElementList(this, name));
+ return aList;
+ }
+
+ /**
+ Returns a NodeList of all the descendant Elements with a given local
+ name and namespace URI in the order in which they are encountered in
+ a preorder traversal of this Element tree.
+ */
+ Reference< XNodeList > CElement::getElementsByTagNameNS(const OUString& namespaceURI,
+ const OUString& localName)
+ throw (RuntimeException)
+ {
+ Reference< XNodeList > aList = Reference< XNodeList >(new CElementList(this, localName, namespaceURI));
+ return aList;
+ }
+
+ /**
+ The name of the element.
+ */
+ OUString CElement::getTagName()
+ throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aNodePtr != NULL)
+ {
+ aName = OUString((sal_Char*)m_aNodePtr->name, strlen((char*)m_aNodePtr->name), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+
+
+ /**
+ Returns true when an attribute with a given name is specified on this
+ element or has a default value, false otherwise.
+ */
+ sal_Bool CElement::hasAttribute(const OUString& name)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ return (m_aNodePtr != NULL && xmlHasProp(m_aNodePtr, xName) != NULL);
+ }
+
+ /**
+ Returns true when an attribute with a given local name and namespace
+ URI is specified on this element or has a default value, false otherwise.
+ */
+ sal_Bool CElement::hasAttributeNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8);
+ xmlChar *xNs = (xmlChar*)o2.getStr();
+ return (m_aNodePtr != NULL && xmlHasNsProp(m_aNodePtr, xName, xNs) != NULL);
+ }
+
+ /**
+ Removes an attribute by name.
+ */
+ void CElement::removeAttribute(const OUString& name)
+ throw (RuntimeException)
+ {
+ xmlChar *xName = (xmlChar*)OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr();
+ if (m_aNodePtr != NULL) {
+ xmlUnsetProp(m_aNodePtr, xName);
+ }
+ }
+
+ /**
+ Removes an attribute by local name and namespace URI.
+ */
+ void CElement::removeAttributeNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(localName, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8);
+ xmlChar *xURI = (xmlChar*)o2.getStr();
+ if (m_aNodePtr != NULL) {
+ // XXX
+ xmlNsPtr pNs = xmlSearchNsByHref(m_aNodePtr->doc, m_aNodePtr, xURI);
+ xmlUnsetNsProp(m_aNodePtr, pNs, xName);
+ }
+ }
+
+ /**
+ Removes the specified attribute node.
+ */
+ Reference< XAttr > CElement::removeAttributeNode(const Reference< XAttr >& oldAttr)
+ throw (RuntimeException)
+ {
+ Reference< XAttr > aAttr;
+ if(m_aNodePtr != NULL)
+ {
+ Reference< XUnoTunnel > tunnel(oldAttr, UNO_QUERY);
+ xmlAttrPtr pAttr = (xmlAttrPtr)tunnel->getSomething(Sequence< sal_Int8 >());
+ xmlRemoveProp(pAttr);
+ aAttr = Reference< XAttr >(static_cast< CAttr* >(CNode::get((xmlNodePtr)pAttr)));
+ }
+ return aAttr;
+ }
+
+ /**
+ Adds a new attribute node.
+ */
+ Reference< XAttr > CElement::_setAttributeNode(const Reference< XAttr >& newAttr, sal_Bool bNS)
+ throw (RuntimeException)
+ {
+ Reference< XAttr > aAttr;
+ if (m_aNodePtr != NULL)
+ {
+ // check whether the attrib belongs to this document
+ Reference< XDocument > newDoc(newAttr->getOwnerDocument(), UNO_QUERY);
+ Reference< XDocument > oldDoc(CNode::getOwnerDocument(), UNO_QUERY);
+ if (newDoc != oldDoc) {
+ throw RuntimeException();
+ }
+
+ // get the implementation
+ Reference< XUnoTunnel > tunnel(newAttr, UNO_QUERY);
+ xmlAttrPtr pAttr = (xmlAttrPtr)tunnel->getSomething(Sequence< sal_Int8 >());
+
+ // check whether the attribute is not in use by another element
+ xmlNsPtr pNs = NULL;
+ if (pAttr->parent != NULL)
+ if(strcmp((char*)pAttr->parent->name, "__private") == NULL
+ && pNs && pAttr->ns != NULL)
+ {
+ pNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, pAttr->ns->prefix);
+ if (pNs == NULL || strcmp((char*)pNs->href, (char*)pAttr->ns->href) !=0 )
+ pNs = xmlNewNs(m_aNodePtr, pAttr->ns->href, pAttr->ns->href);
+ else
+ throw RuntimeException();
+ }
+
+ xmlAttrPtr res = NULL;
+
+ if (bNS)
+ res = xmlNewNsProp(m_aNodePtr, pNs, pAttr->name, pAttr->children->content);
+ else
+ res = xmlNewProp(m_aNodePtr, pAttr->name, pAttr->children->content);
+
+ // free carrier node ...
+ if(pAttr->parent != NULL && strcmp((char*)pAttr->parent->name, "__private")== 0)
+ xmlFreeNode(pAttr->parent);
+ // ... remove the old attr from the node cache
+ CNode::remove((xmlNodePtr)pAttr);
+
+ // get the new attr node
+ aAttr = Reference< XAttr >(static_cast< CAttr* >(CNode::get((xmlNodePtr)res)));
+ }
+ return aAttr;
+ }
+
+ Reference< XAttr > CElement::setAttributeNode(const Reference< XAttr >& newAttr)
+ throw (RuntimeException)
+ {
+ return _setAttributeNode(newAttr, sal_False);
+ }
+
+ /**
+ Adds a new attribute.
+ */
+ Reference< XAttr > CElement::setAttributeNodeNS(const Reference< XAttr >& newAttr)
+ throw (RuntimeException)
+ {
+ return _setAttributeNode(newAttr, sal_True);
+ }
+
+ /**
+ Adds a new attribute.
+ */
+ void CElement::setAttribute(const OUString& name, const OUString& value)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ xmlChar *xName = (xmlChar*)o1.getStr();
+ OString o2 = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
+ xmlChar *xValue = (xmlChar*)o2.getStr();
+ if (m_aNodePtr != NULL)
+ {
+ xmlNewProp(m_aNodePtr, xName, xValue);
+ }
+ }
+
+ /**
+ Adds a new attribute.
+ */
+ void CElement::setAttributeNS(
+ const OUString& namespaceURI, const OUString& qualifiedName, const OUString& value)
+ throw (RuntimeException)
+ {
+ if (namespaceURI.getLength() == 0) throw RuntimeException();
+
+ OString o1, o2, o3, o4, o5;
+ xmlChar *xPrefix = NULL;
+ xmlChar *xLName = NULL;
+ o1 = OUStringToOString(qualifiedName, RTL_TEXTENCODING_UTF8);
+ xmlChar *xQName = (xmlChar*)o1.getStr();
+ sal_Int32 idx = qualifiedName.indexOf(':');
+ if (idx != -1)
+ {
+ o2 = OUStringToOString(
+ qualifiedName.copy(0,idx),
+ RTL_TEXTENCODING_UTF8);
+ xPrefix = (xmlChar*)o2.getStr();
+ o3 = OUStringToOString(
+ qualifiedName.copy(idx+1),
+ RTL_TEXTENCODING_UTF8);
+ xLName = (xmlChar*)o3.getStr();
+ } else {
+ xPrefix = (xmlChar*)"";
+ xLName = xQName;
+ }
+ o4 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8);
+ o5 = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
+ xmlChar *xURI= (xmlChar*)o4.getStr();
+ xmlChar *xValue = (xmlChar*)o5.getStr();
+ if (m_aNodePtr != NULL)
+ {
+ //find the right namespace
+ xmlNsPtr pNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, xPrefix);
+ // if no namespace found, create a new one
+ if (pNs == NULL)
+ pNs = xmlNewNs(m_aNodePtr, xURI, xPrefix);
+
+ if (strcmp((char*)pNs->href, (char*)xURI) == 0)
+ {
+ // found namespace matches
+ xmlNewNsProp(m_aNodePtr, pNs, xLName, xValue);
+ } else {
+ // ambigious ns prefix
+ throw RuntimeException();
+ }
+ }
+ }
+
+ Reference< XNamedNodeMap > SAL_CALL CElement::getAttributes()throw (RuntimeException)
+ {
+ Reference< XNamedNodeMap > aMap;
+ if (hasAttributes()) {
+ aMap = Reference< XNamedNodeMap >(new CAttributesMap(this));
+ }
+ return aMap;
+ }
+ OUString SAL_CALL CElement::getNodeName()throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aNodePtr != NULL)
+ {
+ const xmlChar* xName = m_aNodePtr->name;
+ aName = OUString((const sal_Char*)xName, strlen((const char*)xName), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+ OUString SAL_CALL CElement::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+}
diff --git a/unoxml/source/dom/element.hxx b/unoxml/source/dom/element.hxx
new file mode 100644
index 000000000000..70ff94447268
--- /dev/null
+++ b/unoxml/source/dom/element.hxx
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *
+ * $RCSfile: element.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ELEMENT_HXX
+#define _ELEMENT_HXX
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XNodeList.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+#include <com/sun/star/xml/dom/NodeType.hpp>
+#include <libxml/tree.h>
+#include "node.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CElement : public cppu::ImplInheritanceHelper1<CNode, XElement >
+ {
+ friend class CNode;
+ private:
+ Reference< XAttr > _setAttributeNode(const Reference< XAttr >& newAttr, sal_Bool bNS)
+ throw (RuntimeException);
+
+ protected:
+ CElement(const xmlNodePtr aNodePtr);
+
+ public:
+
+ /**
+ Retrieves an attribute value by name.
+ */
+ virtual OUString SAL_CALL getAttribute(const OUString& name)
+ throw (RuntimeException);
+
+ /**
+ Retrieves an attribute node by name.
+ */
+ virtual Reference< XAttr > SAL_CALL getAttributeNode(const OUString& name)
+ throw (RuntimeException);
+
+ /**
+ Retrieves an Attr node by local name and namespace URI.
+ */
+ virtual Reference< XAttr > SAL_CALL getAttributeNodeNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException);
+
+ /**
+ Retrieves an attribute value by local name and namespace URI.
+ */
+ virtual OUString SAL_CALL getAttributeNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException);
+
+ /**
+ Returns a NodeList of all descendant Elements with a given tag name,
+ in the order in which they are
+ encountered in a preorder traversal of this Element tree.
+ */
+ virtual Reference< XNodeList > SAL_CALL getElementsByTagName(const OUString& name)
+ throw (RuntimeException);
+
+ /**
+ Returns a NodeList of all the descendant Elements with a given local
+ name and namespace URI in the order in which they are encountered in
+ a preorder traversal of this Element tree.
+ */
+ virtual Reference< XNodeList > SAL_CALL getElementsByTagNameNS(const OUString& namespaceURI,
+ const OUString& localName)
+ throw (RuntimeException);
+
+ /**
+ The name of the element.
+ */
+ virtual OUString SAL_CALL getTagName()
+ throw (RuntimeException);
+
+ /**
+ Returns true when an attribute with a given name is specified on this
+ element or has a default value, false otherwise.
+ */
+ virtual sal_Bool SAL_CALL hasAttribute(const OUString& name)
+ throw (RuntimeException);
+
+ /**
+ Returns true when an attribute with a given local name and namespace
+ URI is specified on this element or has a default value, false otherwise.
+ */
+ virtual sal_Bool SAL_CALL hasAttributeNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException);
+
+ /**
+ Removes an attribute by name.
+ */
+ virtual void SAL_CALL removeAttribute(const OUString& name)
+ throw (RuntimeException);
+
+ /**
+ Removes the specified attribute node.
+ */
+ virtual Reference< XAttr > SAL_CALL removeAttributeNode(const Reference< XAttr >& oldAttr)
+ throw (RuntimeException);
+
+ /**
+ Removes an attribute by local name and namespace URI.
+ */
+ virtual void SAL_CALL removeAttributeNS(const OUString& namespaceURI, const OUString& localName)
+ throw (RuntimeException);
+
+ /**
+ Adds a new attribute.
+ */
+ virtual void SAL_CALL setAttribute(const OUString& name, const OUString& value)
+ throw (RuntimeException);
+
+ /**
+ Adds a new attribute node.
+ */
+ virtual Reference< XAttr > SAL_CALL setAttributeNode(const Reference< XAttr >& newAttr)
+ throw (RuntimeException);
+
+ /**
+ Adds a new attribute.
+ */
+ virtual Reference< XAttr > SAL_CALL setAttributeNodeNS(const Reference< XAttr >& newAttr)
+ throw (RuntimeException);
+
+ /**
+ Adds a new attribute.
+ */
+ virtual void SAL_CALL setAttributeNS(
+ const OUString& namespaceURI, const OUString& qualifiedName, const OUString& value)
+ throw (RuntimeException);
+
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException);
+
+ // resolve uno inheritance problems...
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+
+}
+
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/elementlist.cxx b/unoxml/source/dom/elementlist.cxx
new file mode 100644
index 000000000000..0424e031711d
--- /dev/null
+++ b/unoxml/source/dom/elementlist.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: elementlist.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:27 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "elementlist.hxx"
+
+namespace DOM
+{
+
+ CElementList::CElementList(const CElement* aElement, const OUString& aName)
+ : m_pElement(aElement)
+ , m_aName(aName)
+ , xURI(0)
+ {
+ OString o1 = OUStringToOString(aName, RTL_TEXTENCODING_UTF8);
+ xName = new xmlChar[o1.getLength()];
+ strcpy((char*)xName, o1.getStr());
+ }
+ CElementList::CElementList(const CElement* aElement, const OUString& aName, const OUString& aURI)
+ : m_pElement(aElement)
+ , m_aName(aName)
+ , m_aURI(aURI)
+ {
+ OString o1 = OUStringToOString(aName, RTL_TEXTENCODING_UTF8);
+ xName = new xmlChar[o1.getLength()];
+ strcpy((char*)xName, o1.getStr());
+ OString o2 = OUStringToOString(aURI, RTL_TEXTENCODING_UTF8);
+ xURI = new xmlChar[o2.getLength()];
+ strcpy((char*)xURI, o2.getStr());
+ }
+
+ void CElementList::buildlist(nodevector& v, xmlNodePtr pNode, sal_Bool start)
+ {
+ while (pNode != NULL)
+ {
+ if (strcmp((char*)pNode->name, (char*)xName)==0)
+ {
+ if (xURI == NULL)
+ v.push_back(pNode);
+ else
+ if (pNode->ns != NULL && strcmp((char*)pNode->ns->href, (char*)xURI) == 0)
+ v.push_back(pNode);
+ }
+ if (pNode->children != NULL) buildlist(v,pNode->children, sal_False);
+ if (!start) pNode = pNode->next;
+ else break;
+ }
+ }
+
+ /**
+ The number of nodes in the list.
+ */
+ sal_Int32 SAL_CALL CElementList::getLength() throw (RuntimeException)
+ {
+ // this has to be 'live'
+ // XXX work with listeners at some point
+ nodevector v;
+ buildlist(v, static_cast<const CNode*>(m_pElement)->m_aNodePtr);
+ return v.size();
+ }
+ /**
+ Returns the indexth item in the collection.
+ */
+ Reference< XNode > SAL_CALL CElementList::item(sal_Int32 index) throw (RuntimeException)
+ {
+ if (index < 0) throw RuntimeException();
+ nodevector v;
+ buildlist(v, static_cast<const CNode*>(m_pElement)->m_aNodePtr);
+ return Reference< XNode >(CNode::get(v[index]));
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/elementlist.hxx b/unoxml/source/dom/elementlist.hxx
new file mode 100644
index 000000000000..b78baf5063c1
--- /dev/null
+++ b/unoxml/source/dom/elementlist.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: elementlist.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ELEMENTLIST_HXX
+#define _ELEMENTLIST_HXX
+
+#include <vector>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XNodeList.hpp>
+#include "element.hxx"
+#include "document.hxx"
+#include "libxml/tree.h"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ typedef std::vector< xmlNodePtr > nodevector;
+
+ class CElementList : public cppu::WeakImplHelper1< XNodeList >
+ {
+ private:
+ const CElement* m_pElement;
+ const OUString m_aURI;
+ const OUString m_aName;
+ xmlChar *xName;
+ xmlChar *xURI;
+
+
+ void buildlist(nodevector& v, xmlNodePtr pNode, sal_Bool start=sal_True);
+
+ public:
+ CElementList(const CElement* aDoc, const OUString& aName);
+ CElementList(const CElement* aDoc, const OUString& aName, const OUString& aURI);
+ /**
+ The number of nodes in the list.
+ */
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
+ /**
+ Returns the indexth item in the collection.
+ */
+ virtual Reference< XNode > SAL_CALL item(sal_Int32 index) throw (RuntimeException);
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/entitiesmap.cxx b/unoxml/source/dom/entitiesmap.cxx
new file mode 100644
index 000000000000..d6c60cd80bdc
--- /dev/null
+++ b/unoxml/source/dom/entitiesmap.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * $RCSfile: entitiesmap.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "entitiesmap.hxx"
+
+namespace DOM
+{
+ CEntitiesMap::CEntitiesMap(const CDocumentType* aDocType)
+ : m_pDocType(aDocType)
+ {
+ }
+
+ /**
+ The number of nodes in this map.
+ */
+ sal_Int32 SAL_CALL CEntitiesMap::getLength() throw (RuntimeException)
+ {
+ return 0;
+ }
+
+ /**
+ Retrieves a node specified by local name
+ */
+ Reference< XNode > SAL_CALL CEntitiesMap::getNamedItem(const OUString& name) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Retrieves a node specified by local name and namespace URI.
+ */
+ Reference< XNode > SAL_CALL CEntitiesMap::getNamedItemNS(const OUString& namespaceURI,const OUString& localName) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Returns the indexth item in the map.
+ */
+ Reference< XNode > SAL_CALL CEntitiesMap::item(sal_Int32 index) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Removes a node specified by name.
+ */
+ Reference< XNode > SAL_CALL CEntitiesMap::removeNamedItem(const OUString& name) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ // Removes a node specified by local name and namespace URI.
+ */
+ Reference< XNode > SAL_CALL CEntitiesMap::removeNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ // Adds a node using its nodeName attribute.
+ */
+ Reference< XNode > SAL_CALL CEntitiesMap::setNamedItem(const Reference< XNode >& arg) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Adds a node using its namespaceURI and localName.
+ */
+ Reference< XNode > SAL_CALL CEntitiesMap::setNamedItemNS(const Reference< XNode >& arg) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/entitiesmap.hxx b/unoxml/source/dom/entitiesmap.hxx
new file mode 100644
index 000000000000..75e11e5bd52e
--- /dev/null
+++ b/unoxml/source/dom/entitiesmap.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: entitiesmap.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ENTITIESMAP_HXX
+#define _ENTITIESMAP_HXX
+
+#include <map>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+#include "document.hxx"
+#include "documenttype.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CEntitiesMap : public cppu::WeakImplHelper1< XNamedNodeMap >
+ {
+ private:
+ const CDocumentType* m_pDocType;
+ public:
+ CEntitiesMap(const CDocumentType* aDocType);
+
+ /**
+ The number of nodes in this map.
+ */
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
+
+ /**
+ Retrieves a node specified by local name
+ */
+ virtual Reference< XNode > SAL_CALL getNamedItem(const OUString& name) throw (RuntimeException);
+
+ /**
+ Retrieves a node specified by local name and namespace URI.
+ */
+ virtual Reference< XNode > SAL_CALL getNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException);
+
+ /**
+ Returns the indexth item in the map.
+ */
+ virtual Reference< XNode > SAL_CALL item(sal_Int32 index) throw (RuntimeException);
+
+ /**
+ Removes a node specified by name.
+ */
+ virtual Reference< XNode > SAL_CALL removeNamedItem(const OUString& name) throw (RuntimeException);
+
+ /**
+ // Removes a node specified by local name and namespace URI.
+ */
+ virtual Reference< XNode > SAL_CALL removeNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException);
+
+ /**
+ // Adds a node using its nodeName attribute.
+ */
+ virtual Reference< XNode > SAL_CALL setNamedItem(const Reference< XNode >& arg) throw (RuntimeException);
+
+ /**
+ Adds a node using its namespaceURI and localName.
+ */
+ virtual Reference< XNode > SAL_CALL setNamedItemNS(const Reference< XNode >& arg) throw (RuntimeException);
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/entity.cxx b/unoxml/source/dom/entity.cxx
new file mode 100644
index 000000000000..2881f9577680
--- /dev/null
+++ b/unoxml/source/dom/entity.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: entity.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:29 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "entity.hxx"
+
+namespace DOM
+{
+
+ CEntity::CEntity(const xmlEntityPtr aEntityPtr)
+ {
+ m_aNodeType = NodeType_ENTITY_NODE;
+ m_aEntityPtr = aEntityPtr;
+ init_node((xmlNodePtr)aEntityPtr);
+ }
+
+ /**
+ For unparsed entities, the name of the notation for the entity.
+ */
+ OUString SAL_CALL CEntity::getNotationName() throw (RuntimeException)
+ {
+ // XXX
+ return OUString();
+ }
+
+ /**
+ The public identifier associated with the entity, if specified.
+ */
+ OUString SAL_CALL CEntity::getPublicId() throw (RuntimeException)
+ {
+ OUString aID;
+ if(m_aEntityPtr != NULL)
+ {
+ aID = OUString((sal_Char*)m_aEntityPtr->ExternalID, strlen((char*)m_aEntityPtr->ExternalID), RTL_TEXTENCODING_UTF8);
+ }
+ return aID;
+ }
+
+ /**
+ The system identifier associated with the entity, if specified.
+ */
+ OUString SAL_CALL CEntity::getSystemId() throw (RuntimeException)
+ {
+ OUString aID;
+ if(m_aEntityPtr != NULL)
+ {
+ aID = OUString((sal_Char*)m_aEntityPtr->SystemID, strlen((char*)m_aEntityPtr->SystemID), RTL_TEXTENCODING_UTF8);
+ }
+ return aID;
+ }
+ OUString SAL_CALL CEntity::getNodeName()throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aNodePtr != NULL)
+ {
+ const xmlChar* xName = m_aNodePtr->name;
+ aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+ OUString SAL_CALL CEntity::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/entity.hxx b/unoxml/source/dom/entity.hxx
new file mode 100644
index 000000000000..a285c0ed6b75
--- /dev/null
+++ b/unoxml/source/dom/entity.hxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * $RCSfile: entity.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:30 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ENTITY_HXX
+#define _ENTITY_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XEntity.hpp>
+#include "node.hxx"
+#include <libxml/tree.h>
+#include <libxml/entities.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CEntity : public cppu::ImplInheritanceHelper1< CNode, XEntity >
+ {
+ friend class CNode;
+ private:
+ xmlEntityPtr m_aEntityPtr;
+
+ protected:
+ CEntity(const xmlEntityPtr aEntityPtr);
+
+ public:
+
+ /**
+ For unparsed entities, the name of the notation for the entity.
+ */
+ virtual OUString SAL_CALL getNotationName() throw (RuntimeException);
+
+ /**
+ The public identifier associated with the entity, if specified.
+ */
+ virtual OUString SAL_CALL getPublicId() throw (RuntimeException);
+
+ /**
+ The system identifier associated with the entity, if specified.
+ */
+ virtual OUString SAL_CALL getSystemId() throw (RuntimeException);
+
+ // ---- resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+
+ };
+}
+
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/entityreference.cxx b/unoxml/source/dom/entityreference.cxx
new file mode 100644
index 000000000000..aad7ef3b799e
--- /dev/null
+++ b/unoxml/source/dom/entityreference.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * $RCSfile: entityreference.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "entityreference.hxx"
+namespace DOM
+{
+ CEntityReference::CEntityReference(const xmlNodePtr aNodePtr)
+ {
+ m_aNodeType = NodeType_ENTITY_REFERENCE_NODE;
+ init_node(m_aNodePtr);
+ }
+ OUString SAL_CALL CEntityReference::getNodeName()throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aNodePtr != NULL)
+ {
+ const xmlChar* xName = m_aNodePtr->name;
+ aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+ OUString SAL_CALL CEntityReference::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+}
diff --git a/unoxml/source/dom/entityreference.hxx b/unoxml/source/dom/entityreference.hxx
new file mode 100644
index 000000000000..561eed88058f
--- /dev/null
+++ b/unoxml/source/dom/entityreference.hxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: entityreference.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ENTITYREFERENCE_HXX
+#define _ENTITYREFERENCE_HXX
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XEntityReference.hpp>
+#include "node.hxx"
+#include <libxml/tree.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CEntityReference : public cppu::ImplInheritanceHelper1< CNode, XEntityReference >
+ {
+ friend class CNode;
+ protected:
+ CEntityReference(const xmlNodePtr aNodePtr);
+
+ public:
+ // ---- resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+}
+#endif
diff --git a/unoxml/source/dom/makefile.mk b/unoxml/source/dom/makefile.mk
new file mode 100644
index 000000000000..5d568c32210a
--- /dev/null
+++ b/unoxml/source/dom/makefile.mk
@@ -0,0 +1,105 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: lo $ $Date: 2004-01-28 16:31:35 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=libxml2
+TARGET=domimpl
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+RSCUPDVER=$(RSCREVISION)(SV$(UPD)$(UPDMINOR))
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/attr.obj \
+ $(SLO)$/cdatasection.obj \
+ $(SLO)$/characterdata.obj \
+ $(SLO)$/comment.obj \
+ $(SLO)$/document.obj \
+ $(SLO)$/documentbuilder.obj \
+ $(SLO)$/documentfragment.obj \
+ $(SLO)$/documenttype.obj \
+ $(SLO)$/element.obj \
+ $(SLO)$/entity.obj \
+ $(SLO)$/entityreference.obj \
+ $(SLO)$/node.obj \
+ $(SLO)$/notation.obj \
+ $(SLO)$/processinginstruction.obj \
+ $(SLO)$/text.obj \
+ $(SLO)$/domimplementation.obj \
+ $(SLO)$/elementlist.obj \
+ $(SLO)$/childlist.obj \
+ $(SLO)$/notationsmap.obj \
+ $(SLO)$/entitiesmap.obj \
+ $(SLO)$/attributesmap.obj \
+ $(SLO)$/saxbuilder.obj
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
new file mode 100644
index 000000000000..b867effe3ef9
--- /dev/null
+++ b/unoxml/source/dom/node.cxx
@@ -0,0 +1,722 @@
+/*************************************************************************
+ *
+ * $RCSfile: node.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include "node.hxx"
+#include "element.hxx"
+#include "text.hxx"
+#include "cdatasection.hxx"
+#include "entityreference.hxx"
+#include "entity.hxx"
+#include "processinginstruction.hxx"
+#include "comment.hxx"
+#include "document.hxx"
+#include "documenttype.hxx"
+#include "documentfragment.hxx"
+#include "notation.hxx"
+#include "childlist.hxx"
+#include "attr.hxx"
+
+namespace DOM
+{
+ nodemap_t CNode::theNodeMap;
+
+ void CNode::remove(const xmlNodePtr aNode)
+ {
+ nodemap_t::iterator i = CNode::theNodeMap.find(aNode);
+ if (i != CNode::theNodeMap.end())
+ {
+ CNode *pNode = i->second;
+ CNode::theNodeMap.erase(i);
+ }
+ }
+
+
+ CNode* CNode::get(const xmlNodePtr aNode, sal_Bool bCreate)
+ {
+ CNode* pNode = 0;
+ if (aNode == NULL)
+ return 0;
+
+ //check whether there is already an instance for this node
+ nodemap_t::const_iterator i = CNode::theNodeMap.find(aNode);
+ if (i != CNode::theNodeMap.end())
+ {
+ pNode = i->second;
+ } else
+ {
+
+ // there is not yet an instance wrapping this node,
+ // create it and store it in the map
+ if (!bCreate) return NULL;
+
+ switch (aNode->type)
+ {
+ case XML_ELEMENT_NODE:
+ // m_aNodeType = NodeType::ELEMENT_NODE;
+ pNode = static_cast< CNode* >(new CElement(aNode));
+ break;
+ case XML_TEXT_NODE:
+ // m_aNodeType = NodeType::TEXT_NODE;
+ pNode = static_cast< CNode* >(new CText(aNode));
+ break;
+ case XML_CDATA_SECTION_NODE:
+ // m_aNodeType = NodeType::CDATA_SECTION_NODE;
+ pNode = static_cast< CNode* >(new CCDATASection(aNode));
+ break;
+ case XML_ENTITY_REF_NODE:
+ // m_aNodeType = NodeType::ENTITY_REFERENCE_NODE;
+ pNode = static_cast< CNode* >(new CEntityReference(aNode));
+ break;
+ case XML_ENTITY_NODE:
+ // m_aNodeType = NodeType::ENTITY_NODE;
+ pNode = static_cast< CNode* >(new CEntity((xmlEntityPtr)aNode));
+ break;
+ case XML_PI_NODE:
+ // m_aNodeType = NodeType::PROCESSING_INSTRUCTION_NODE;
+ pNode = static_cast< CNode* >(new CProcessingInstruction(aNode));
+ break;
+ case XML_COMMENT_NODE:
+ // m_aNodeType = NodeType::COMMENT_NODE;
+ pNode = static_cast< CNode* >(new CComment(aNode));
+ break;
+ case XML_DOCUMENT_NODE:
+ // m_aNodeType = NodeType::DOCUMENT_NODE;
+ pNode = static_cast< CNode* >(new CDocument((xmlDocPtr)aNode));
+ break;
+ case XML_DOCUMENT_TYPE_NODE:
+ case XML_DTD_NODE:
+ // m_aNodeType = NodeType::DOCUMENT_TYPE_NODE;
+ pNode = static_cast< CNode* >(new CDocumentType((xmlDtdPtr)aNode));
+ break;
+ case XML_DOCUMENT_FRAG_NODE:
+ // m_aNodeType = NodeType::DOCUMENT_FRAGMENT_NODE;
+ pNode = static_cast< CNode* >(new CDocumentFragment(aNode));
+ break;
+ case XML_NOTATION_NODE:
+ // m_aNodeType = NodeType::NOTATION_NODE;
+ pNode = static_cast< CNode* >(new CNotation((xmlNotationPtr)aNode));
+ break;
+ case XML_ATTRIBUTE_NODE:
+ // m_aNodeType = NodeType::NOTATION_NODE;
+ pNode = static_cast< CNode* >(new CAttr((xmlAttrPtr)aNode));
+ break;
+ // unsopported node types
+ case XML_HTML_DOCUMENT_NODE:
+ case XML_ELEMENT_DECL:
+ case XML_ATTRIBUTE_DECL:
+ case XML_ENTITY_DECL:
+ case XML_NAMESPACE_DECL:
+ default:
+ pNode = 0;
+ break;
+ }
+ }
+ if ( pNode != 0 )
+ {
+ if(CNode::theNodeMap.insert(nodemap_t::value_type(aNode, pNode)).second)
+ {
+ // insertion done, register node with document
+ xmlDocPtr doc = aNode->doc;
+ if( doc != NULL)
+ {
+ CDocument* pDoc = static_cast< CDocument* >(CNode::get((xmlNodePtr)doc));
+ pDoc->addnode(aNode);
+ } else
+ {
+ // if insertion failed, delete the new instance and return null
+ delete pNode;
+ pNode = 0;
+ }
+ }
+ }
+ OSL_ENSURE(pNode, "no node produced during CNode::get!");
+ return pNode;
+ }
+
+ CNode::CNode()
+ : m_aNodePtr(0)
+ {
+ }
+
+ void CNode::init_node(const xmlNodePtr aNode)
+ {
+ m_aNodePtr = aNode;
+
+ // keep containing document alive
+ // (if we are not that document ourselves)
+ if (m_aNodePtr->type != XML_DOCUMENT_NODE)
+ m_rDocument = getOwnerDocument();
+ }
+
+ CNode::~CNode()
+ {
+ //remove from list if this wrapper goes away
+ if (m_aNodePtr != 0)
+ CNode::remove(m_aNodePtr);
+ }
+
+ static void _nscleanup(const xmlNodePtr aNode, const xmlNodePtr aParent)
+ {
+ xmlNodePtr cur = aNode;
+
+ //handle attributes
+ if (cur != NULL && cur->type == XML_ELEMENT_NODE)
+ {
+ xmlAttrPtr curAttr = cur->properties;
+ while(curAttr != 0)
+ {
+ if (curAttr->ns != NULL)
+ {
+ xmlNsPtr ns = xmlSearchNs(cur->doc, aParent, curAttr->ns->prefix);
+ if (ns != NULL)
+ curAttr->ns = ns;
+ }
+ curAttr = curAttr->next;
+ }
+ }
+
+ while (cur != NULL)
+ {
+ _nscleanup(cur->children, cur);
+ if (cur->ns != NULL)
+ {
+ xmlNsPtr ns = xmlSearchNs(cur->doc, aParent, cur->ns->prefix);
+ if (ns != NULL && ns != cur->ns && strcmp((char*)ns->href, (char*)cur->ns->href)==0)
+ {
+ cur->ns = ns;
+ xmlNsPtr curDef = cur->nsDef;
+ xmlNsPtr *refp = &(cur->nsDef); // insert point
+ while (curDef != NULL)
+ {
+ ns = xmlSearchNs(cur->doc, aParent, curDef->prefix);
+ if (ns != NULL && ns != curDef && strcmp((char*)ns->href, (char*)curDef->href)==0)
+ {
+ *refp = curDef->next;
+ xmlFreeNs(curDef);
+ curDef = *refp;
+ } else {
+ refp = &(curDef->next);
+ curDef = curDef->next;
+ }
+ }
+ }
+ }
+ cur = cur->next;
+ }
+ }
+
+ /**
+ Adds the node newChild to the end of the list of children of this node.
+ */
+ Reference< XNode > CNode::appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ Reference< XNode> aNode;
+ if (m_aNodePtr != NULL) {
+ Reference< XUnoTunnel > tun(newChild, UNO_QUERY);
+ xmlNodePtr cur = (xmlNodePtr)(tun->getSomething(Sequence <sal_Int8>()));
+
+ // check whether this is an attribute node so we remove it's
+ // carrier node
+ xmlNodePtr res = NULL;
+ if (cur->type == XML_ATTRIBUTE_NODE)
+ {
+ if (m_aNodePtr->type != XML_ELEMENT_NODE || cur->parent == NULL
+ || strcmp((char*)cur->parent->name, "__private") != NULL)
+ throw RuntimeException();
+
+ xmlNsPtr pAttrNs = cur->ns;
+ xmlNsPtr pParentNs = xmlSearchNs(m_aNodePtr->doc, m_aNodePtr, pAttrNs->prefix);
+ if (pParentNs == NULL || strcmp((char*)pParentNs->href, (char*)pAttrNs->href) != 0)
+ pParentNs = xmlNewNs(m_aNodePtr, pAttrNs->href, pAttrNs->prefix);
+
+ res = (xmlNodePtr)xmlNewNsProp(
+ m_aNodePtr, pParentNs, cur->name, cur->children->content);
+ xmlFreeNode(cur->parent);
+ }
+ else
+ {
+ res = xmlAddChild(m_aNodePtr, cur);
+ }
+
+ // libxml can do optimizations, when appending nodes.
+ // if res != cur, something was optimized and the newchild-wrapper
+ // should be updated
+ if (cur != res)
+ CNode::remove(cur);
+
+ _nscleanup(res, m_aNodePtr);
+
+ aNode = Reference< XNode>(CNode::get(res));
+ }
+ //XXX check for errors
+ return aNode;
+ }
+
+ /**
+ Returns a duplicate of this node, i.e., serves as a generic copy
+ constructor for nodes.
+ */
+ Reference< XNode > CNode::cloneNode(sal_Bool bDeep)
+ throw (RuntimeException)
+ {
+ Reference< XNode> aNode;
+ if (m_aNodePtr != NULL)
+ {
+ aNode = Reference< XNode>(CNode::get(
+ xmlCopyNode (m_aNodePtr, static_cast< int >(bDeep))
+ ));
+ }
+ //XXX check for errors
+ return aNode;
+ }
+
+ /**
+ A NamedNodeMap containing the attributes of this node (if it is an Element)
+ or null otherwise.
+ */
+ Reference< XNamedNodeMap > CNode::getAttributes()
+ throw (RuntimeException)
+ {
+ // return empty reference
+ // only element node may override this impl
+ return Reference< XNamedNodeMap>();
+
+ // get all children that are attributes
+ /* --> CElement
+ Reference< NamedNodeMap > aNodeMap(new AttributeNamedNodeMap(m_aNodePtr), UNO_QUERY);
+ return aNodeMap;
+ */
+ }
+
+ /**
+ A NodeList that contains all children of this node.
+ */
+ Reference< XNodeList > CNode::getChildNodes()
+ throw (RuntimeException)
+ {
+ Reference< XNodeList > aNodeList;
+ if (m_aNodePtr != NULL)
+ {
+ aNodeList = Reference< XNodeList >(new CChildList(CNode::get(m_aNodePtr)));
+ }
+ // XXX check for errors?
+ return aNodeList;
+ }
+
+ /**
+ The first child of this node.
+ */
+ Reference< XNode > CNode::getFirstChild()
+ throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ if (m_aNodePtr != NULL) {
+ aNode = Reference< XNode >(CNode::get(m_aNodePtr->children));
+ }
+ return aNode;
+ }
+
+ /**
+ The last child of this node.
+ */
+ Reference< XNode > SAL_CALL CNode::getLastChild()
+ throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ if (m_aNodePtr != NULL) {
+ aNode = Reference< XNode >(CNode::get(xmlGetLastChild(m_aNodePtr)));
+ }
+ return aNode;
+ }
+
+ /**
+ Returns the local part of the qualified name of this node.
+ */
+ OUString SAL_CALL CNode::getLocalName()
+ throw (RuntimeException)
+ {
+ OUString aName;
+ /*
+ --> Element / Attribute
+ if(m_aNodePtr != NULL && (m_aNodeType == NodeType::ATTRIBUTE_NODE
+ || m_aNodeType == NodeType::ELEMENT_NODE))
+ {
+ aName = OUString(m_aNodePtr->name, RTL_TEXTENCODING_UTF8);
+ }
+ //XXX error checking
+ */
+ return aName;
+ }
+
+
+ /**
+ The namespace URI of this node, or null if it is unspecified.
+ */
+ OUString SAL_CALL CNode::getNamespaceURI()
+ throw (RuntimeException)
+ {
+ OUString aURI;
+ if (m_aNodePtr != NULL && m_aNodePtr->ns != NULL)
+ {
+ const xmlChar* xHref = m_aNodePtr->ns->href;
+ aURI = OUString((sal_Char*)xHref, strlen((char*)xHref), RTL_TEXTENCODING_UTF8);
+ }
+ return aURI;
+ }
+
+ /**
+ The node immediately following this node.
+ */
+ Reference< XNode > SAL_CALL CNode::getNextSibling()
+ throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ if(m_aNodePtr != NULL)
+ {
+ aNode = Reference< XNode >(CNode::get(m_aNodePtr->next));
+ }
+ return aNode;
+ }
+
+ /**
+ The name of this node, depending on its type; see the table above.
+ */
+ OUString SAL_CALL CNode::getNodeName()
+ throw (RuntimeException)
+ {
+ /*
+ Interface nodeName nodeValue attributes
+ --------------------------------------------------------------------------------------
+ Attr name of attribute value of attribute null
+ CDATASection "#cdata-section" content of the CDATA Section null
+ Comment "#comment" content of the comment null
+ Document "#document" null null
+ DocumentFragment "#document-fragment" null null
+ DocumentType document type name null null
+ Element tag name null NamedNodeMap
+ Entity entity name null null
+ EntityReference name of entity null null
+ referenced
+ Notation notation name null null
+ Processing\ target entire content excluding null
+ Instruction the target
+ Text "#text" content of the text node null
+ */
+ OUString aName;
+ return aName;
+ }
+
+ /**
+ A code representing the type of the underlying object, as defined above.
+ */
+ NodeType SAL_CALL CNode::getNodeType()
+ throw (RuntimeException)
+ {
+ return m_aNodeType;
+ }
+
+ /**
+ The value of this node, depending on its type; see the table above.
+ */
+ OUString SAL_CALL CNode::getNodeValue()
+ throw (RuntimeException)
+ {
+ OUString aValue;
+ return aValue;
+ }
+
+ /**
+ The Document object associated with this node.
+ */
+ Reference< XDocument > SAL_CALL CNode::getOwnerDocument()
+ throw (RuntimeException)
+ {
+ Reference<XDocument> aDoc;
+ if (m_aNodePtr != NULL)
+ {
+ aDoc = Reference< XDocument >(static_cast< CDocument* >(
+ CNode::get((xmlNodePtr)m_aNodePtr->doc)));
+ }
+ return aDoc;
+
+ }
+
+ /**
+ The parent of this node.
+ */
+ Reference< XNode > SAL_CALL CNode::getParentNode()
+ throw (RuntimeException)
+ {
+ Reference<XNode> aNode;
+ if (m_aNodePtr != NULL)
+ {
+ aNode = Reference< XNode >(CNode::get(m_aNodePtr->parent));
+ }
+ return aNode;
+ }
+
+ /**
+ The namespace prefix of this node, or null if it is unspecified.
+ */
+ OUString SAL_CALL CNode::getPrefix()
+ throw (RuntimeException)
+ {
+ OUString aPrefix;
+ if (m_aNodePtr != NULL && m_aNodePtr->ns != NULL)
+ {
+ const xmlChar* xPrefix = m_aNodePtr->ns->prefix;
+ aPrefix = OUString((sal_Char*)xPrefix, strlen((char*)xPrefix), RTL_TEXTENCODING_UTF8);
+ }
+ return aPrefix;
+
+ }
+
+ /**
+ The node immediately preceding this node.
+ */
+ Reference< XNode > SAL_CALL CNode::getPreviousSibling()
+ throw (RuntimeException)
+ {
+ Reference< XNode > aNode;
+ if (m_aNodePtr != NULL)
+ {
+ aNode = Reference< XNode >(CNode::get(m_aNodePtr->prev));
+ }
+ return aNode;
+ }
+
+ /**
+ Returns whether this node (if it is an element) has any attributes.
+ */
+ sal_Bool SAL_CALL CNode::hasAttributes()
+ throw (RuntimeException)
+ {
+ return (m_aNodePtr != NULL && m_aNodePtr->properties != NULL);
+ }
+
+ /**
+ Returns whether this node has any children.
+ */
+ sal_Bool SAL_CALL CNode::hasChildNodes()
+ throw (RuntimeException)
+ {
+ return (m_aNodePtr != NULL && m_aNodePtr->children != NULL);
+ }
+
+ /**
+ Inserts the node newChild before the existing child node refChild.
+ */
+ Reference< XNode > SAL_CALL CNode::insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ // XXX check node types
+
+ Reference< XUnoTunnel > tref(refChild, UNO_QUERY);
+ Reference< XUnoTunnel > tnew(newChild, UNO_QUERY);
+ xmlNodePtr pRefChild = (xmlNodePtr)tref->getSomething(Sequence< sal_Int8>());
+ xmlNodePtr pNewChild = (xmlNodePtr)tnew->getSomething(Sequence< sal_Int8>());
+ xmlNodePtr cur = m_aNodePtr->children;
+
+ //search cild before which to insert
+ while (cur != NULL)
+ {
+ if (cur == pRefChild) {
+ // insert before
+ pNewChild->next = cur;
+ pNewChild->prev = cur->prev;
+ cur->prev = pNewChild;
+ if( pNewChild->prev != NULL)
+ pNewChild->prev->next = pNewChild;
+ }
+ cur = cur->next;
+ }
+ return refChild;
+ }
+
+ /**
+ Tests whether the DOM implementation implements a specific feature and
+ that feature is supported by this node.
+ */
+ sal_Bool SAL_CALL CNode::isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ // XXX
+ return sal_False;
+ }
+
+ /**
+ Puts all Text nodes in the full depth of the sub-tree underneath this
+ Node, including attribute nodes, into a "normal" form where only structure
+ (e.g., elements, comments, processing instructions, CDATA sections, and
+ entity references) separates Text nodes, i.e., there are neither adjacent
+ Text nodes nor empty Text nodes.
+ */
+ void SAL_CALL CNode::normalize()
+ throw (RuntimeException)
+ {
+ //XXX combine adjacent text nodes and remove empty ones
+ }
+
+ /**
+ Removes the child node indicated by oldChild from the list of children,
+ and returns it.
+ */
+ Reference< XNode > SAL_CALL CNode::removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ Reference< XUnoTunnel > told(oldChild, UNO_QUERY);
+ xmlNodePtr old = (xmlNodePtr)told->getSomething(Sequence< sal_Int8>());
+ xmlNodePtr cur = m_aNodePtr->children;
+ //find old node in child list
+ while (cur != NULL)
+ {
+ if(cur == old)
+ {
+ // unlink node from list
+ if (cur->prev != NULL)
+ cur->prev->next = cur->next;
+ if (cur->next != NULL)
+ cur->next->prev = cur->prev;
+ cur->prev = NULL;
+ cur->next = NULL;
+ }
+ cur = cur->next;
+ }
+ return oldChild;
+ }
+
+ /**
+ Replaces the child node oldChild with newChild in the list of children,
+ and returns the oldChild node.
+ */
+ Reference< XNode > SAL_CALL CNode::replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ // XXX check node types
+
+ Reference< XUnoTunnel > tOld(oldChild, UNO_QUERY);
+ xmlNodePtr pOld = (xmlNodePtr)tOld->getSomething(Sequence< sal_Int8>());
+ Reference< XUnoTunnel > tNew(newChild, UNO_QUERY);
+ xmlNodePtr pNew = (xmlNodePtr)tNew->getSomething(Sequence< sal_Int8>());
+ xmlNodePtr cur = m_aNodePtr->children;
+ //find old node in child list
+ while (cur != NULL)
+ {
+ if(cur == pOld)
+ {
+ // exchange nodes
+ pNew->prev = pOld->prev;
+ if (pNew->prev != NULL)
+ pNew->prev->next = pNew;
+ pNew->next = pOld->next;
+ if (pNew->next != NULL)
+ pNew->next->prev = pNew;
+ pOld->next = NULL;
+ pOld->prev = NULL;
+ }
+ cur = cur->next;
+ }
+ return oldChild;
+ }
+
+ /**
+ The value of this node, depending on its type; see the table above.
+ */
+ void SAL_CALL CNode::setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ // use specific node implememntation
+ /*
+ xmlChar *pBuf = OUString2OString(nodeValue, RTL_TEXTENCODING_UTF8).getStr();
+ // XXX how to free the old content?
+ m_aNodePtr->content = pBuf;
+ */
+
+ }
+
+ /**
+ The namespace prefix of this node, or null if it is unspecified.
+ */
+ void SAL_CALL CNode::setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ OString o1 = OUStringToOString(prefix, RTL_TEXTENCODING_UTF8);
+ xmlChar *pBuf = (xmlChar*)o1.getStr();
+ // XXX copy buf?
+ // XXX free old string? (leak?)
+ if (m_aNodePtr != NULL && m_aNodePtr->ns != NULL)
+ {
+ m_aNodePtr->ns->prefix = pBuf;
+ }
+
+ }
+
+ sal_Int64 SAL_CALL CNode::getSomething(const Sequence< sal_Int8 >& id) throw (RuntimeException)
+ {
+ // XXX check ID
+ return (sal_Int64)m_aNodePtr;
+ }
+}
+
diff --git a/unoxml/source/dom/node.hxx b/unoxml/source/dom/node.hxx
new file mode 100644
index 000000000000..3425d0d962b1
--- /dev/null
+++ b/unoxml/source/dom/node.hxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * $RCSfile: node.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _NODE_HXX
+#define _NODE_HXX
+
+#include <map>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XNodeList.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+#include <com/sun/star/xml/dom/NodeType.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <libxml/tree.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CNode;
+ typedef std::map< const xmlNodePtr, CNode* > nodemap_t;
+
+
+ class CNode : public cppu::WeakImplHelper2< XNode, XUnoTunnel >
+ {
+ friend class CDocument;
+ friend class CElement;
+ friend class CAttributesMap;
+ friend class CChildList;
+ friend class CElementList;
+ friend class CEntitiesMap;
+ friend class CNotationsMap;
+ private:
+ static nodemap_t theNodeMap;
+
+ protected:
+ NodeType m_aNodeType;
+ xmlNodePtr m_aNodePtr;
+
+ Reference< XDocument > m_rDocument;
+
+ // for initialization by classes derived through ImplInheritanceHelper
+ CNode();
+ void init_node(const xmlNodePtr aNode);
+
+ public:
+
+ virtual ~CNode();
+
+ // get a representaion for a libxml node
+ static CNode* get(const xmlNodePtr aNode, sal_Bool bCreate = sal_True);
+ // remove a wrapper instance
+ static void remove(const xmlNodePtr aNode);
+
+ //static Sequence< sal_Int8 >
+
+ // ---- DOM interfaces
+
+ /**
+ Adds the node newChild to the end of the list of children of this node.
+ */
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException);
+
+ /**
+ Returns a duplicate of this node, i.e., serves as a generic copy
+ constructor for nodes.
+ */
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException);
+
+ /**
+ A NamedNodeMap containing the attributes of this node (if it is an Element)
+ or null otherwise.
+ */
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException);
+
+ /**
+ A NodeList that contains all children of this node.
+ */
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException);
+
+ /**
+ The first child of this node.
+ */
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException);
+
+ /**
+ The last child of this node.
+ */
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException);
+
+ /**
+ Returns the local part of the qualified name of this node.
+ */
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException);
+
+ /**
+ The namespace URI of this node, or null if it is unspecified.
+ */
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException);
+
+ /**
+ The node immediately following this node.
+ */
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException);
+
+ /**
+ The name of this node, depending on its type; see the table above.
+ -- virtual implemented by actual node types
+ */
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+
+ /**
+ A code representing the type of the underlying object, as defined above.
+ */
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException);
+
+ /**
+ The value of this node, depending on its type; see the table above.
+ -- virtual implemented by actual node types
+ */
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+
+ /**
+ The Document object associated with this node.
+ */
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException);
+
+ /**
+ The parent of this node.
+ */
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException);
+
+ /**
+ The namespace prefix of this node, or null if it is unspecified.
+ */
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException);
+
+ /**
+ The node immediately preceding this node.
+ */
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException);
+
+ /**
+ Returns whether this node (if it is an element) has any attributes.
+ */
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException);
+
+ /**
+ Returns whether this node has any children.
+ */
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException);
+
+ /**
+ Inserts the node newChild before the existing child node refChild.
+ */
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException);
+
+ /**
+ Tests whether the DOM implementation implements a specific feature and
+ that feature is supported by this node.
+ */
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException);
+
+ /**
+ Puts all Text nodes in the full depth of the sub-tree underneath this
+ Node, including attribute nodes, into a "normal" form where only structure
+ (e.g., elements, comments, processing instructions, CDATA sections, and
+ entity references) separates Text nodes, i.e., there are neither adjacent
+ Text nodes nor empty Text nodes.
+ */
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException);
+
+ /**
+ Removes the child node indicated by oldChild from the list of children,
+ and returns it.
+ */
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException);
+
+ /**
+ Replaces the child node oldChild with newChild in the list of children,
+ and returns the oldChild node.
+ */
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException);
+
+ /**
+ The value of this node, depending on its type; see the table above.
+ */
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException);
+
+ /**
+ The namespace prefix of this node, or null if it is unspecified.
+ */
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException);
+
+
+ // --- XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething(const Sequence< sal_Int8 >& id) throw (RuntimeException);
+
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/notation.cxx b/unoxml/source/dom/notation.cxx
new file mode 100644
index 000000000000..ac477447607a
--- /dev/null
+++ b/unoxml/source/dom/notation.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * $RCSfile: notation.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "notation.hxx"
+namespace DOM
+{
+ CNotation::CNotation(const xmlNotationPtr aNotationPtr)
+ {
+ m_aNodeType = NodeType_NOTATION_NODE;
+ m_aNotationPtr = aNotationPtr;
+ init_node((xmlNodePtr)aNotationPtr);
+ }
+
+ OUString SAL_CALL CNotation::getPublicId() throw (RuntimeException)
+ {
+ // XXX
+ return OUString();
+ }
+
+ /**
+ The system identifier of this notation.
+ */
+ OUString SAL_CALL CNotation::getSystemId() throw (RuntimeException)
+ {
+ // XXX
+ return OUString();
+ }
+
+
+ OUString SAL_CALL CNotation::getNodeName()throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aNodePtr != NULL)
+ {
+ const xmlChar* xName = m_aNodePtr->name;
+ aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+ OUString SAL_CALL CNotation::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+}
diff --git a/unoxml/source/dom/notation.hxx b/unoxml/source/dom/notation.hxx
new file mode 100644
index 000000000000..c85b58598c33
--- /dev/null
+++ b/unoxml/source/dom/notation.hxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * $RCSfile: notation.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _NOTATION_HXX
+#define _NOTATION_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNotation.hpp>
+#include "node.hxx"
+#include <libxml/tree.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CNotation : public cppu::ImplInheritanceHelper1< CNode, XNotation >
+ {
+ friend class CNode;
+ private:
+ xmlNotationPtr m_aNotationPtr;
+
+ protected:
+ CNotation(const xmlNotationPtr);
+
+ /**
+ The public identifier of this notation.
+ */
+ virtual OUString SAL_CALL getPublicId() throw (RuntimeException);
+
+ /**
+ The system identifier of this notation.
+ */
+ virtual OUString SAL_CALL getSystemId() throw (RuntimeException);
+
+ // ---- resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+
+ };
+}
+
+#endif \ No newline at end of file
diff --git a/unoxml/source/dom/notationsmap.cxx b/unoxml/source/dom/notationsmap.cxx
new file mode 100644
index 000000000000..e9456b90118d
--- /dev/null
+++ b/unoxml/source/dom/notationsmap.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * $RCSfile: notationsmap.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "notationsmap.hxx"
+
+namespace DOM
+{
+ CNotationsMap::CNotationsMap(const CDocumentType* aDocType)
+ : m_pDocType(aDocType)
+ {
+ }
+
+ /**
+ The number of nodes in this map.
+ */
+ sal_Int32 SAL_CALL CNotationsMap::getLength() throw (RuntimeException)
+ {
+ return 0;
+ }
+
+ /**
+ Retrieves a node specified by local name
+ */
+ Reference< XNode > SAL_CALL CNotationsMap::getNamedItem(const OUString& name) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Retrieves a node specified by local name and namespace URI.
+ */
+ Reference< XNode > SAL_CALL CNotationsMap::getNamedItemNS(const OUString& namespaceURI,const OUString& localName) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Returns the indexth item in the map.
+ */
+ Reference< XNode > SAL_CALL CNotationsMap::item(sal_Int32 index) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Removes a node specified by name.
+ */
+ Reference< XNode > SAL_CALL CNotationsMap::removeNamedItem(const OUString& name) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ // Removes a node specified by local name and namespace URI.
+ */
+ Reference< XNode > SAL_CALL CNotationsMap::removeNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ // Adds a node using its nodeName attribute.
+ */
+ Reference< XNode > SAL_CALL CNotationsMap::setNamedItem(const Reference< XNode >& arg) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+
+ /**
+ Adds a node using its namespaceURI and localName.
+ */
+ Reference< XNode > SAL_CALL CNotationsMap::setNamedItemNS(const Reference< XNode >& arg) throw (RuntimeException)
+ {
+ return Reference< XNode >();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/notationsmap.hxx b/unoxml/source/dom/notationsmap.hxx
new file mode 100644
index 000000000000..ff9e4aec5de1
--- /dev/null
+++ b/unoxml/source/dom/notationsmap.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: notationsmap.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _NOTATIONSMAP_HXX
+#define _NOTATIONSMAP_HXX
+
+#include <map>
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
+#include "document.hxx"
+#include "documenttype.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CNotationsMap : public cppu::WeakImplHelper1< XNamedNodeMap >
+ {
+ private:
+ const CDocumentType* m_pDocType;
+
+ public:
+ CNotationsMap(const CDocumentType* aDocType);
+
+ /**
+ The number of nodes in this map.
+ */
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
+
+ /**
+ Retrieves a node specified by local name
+ */
+ virtual Reference< XNode > SAL_CALL getNamedItem(const OUString& name) throw (RuntimeException);
+
+ /**
+ Retrieves a node specified by local name and namespace URI.
+ */
+ virtual Reference< XNode > SAL_CALL getNamedItemNS(const OUString& namespaceURI,const OUString& localName) throw (RuntimeException);
+
+ /**
+ Returns the indexth item in the map.
+ */
+ virtual Reference< XNode > SAL_CALL item(sal_Int32 index) throw (RuntimeException);
+
+ /**
+ Removes a node specified by name.
+ */
+ virtual Reference< XNode > SAL_CALL removeNamedItem(const OUString& name) throw (RuntimeException);
+
+ /**
+ // Removes a node specified by local name and namespace URI.
+ */
+ virtual Reference< XNode > SAL_CALL removeNamedItemNS(const OUString& namespaceURI, const OUString& localName) throw (RuntimeException);
+
+ /**
+ // Adds a node using its nodeName attribute.
+ */
+ virtual Reference< XNode > SAL_CALL setNamedItem(const Reference< XNode >& arg) throw (RuntimeException);
+
+ /**
+ Adds a node using its namespaceURI and localName.
+ */
+ virtual Reference< XNode > SAL_CALL setNamedItemNS(const Reference< XNode >& arg) throw (RuntimeException);
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/processinginstruction.cxx b/unoxml/source/dom/processinginstruction.cxx
new file mode 100644
index 000000000000..c04f790c2c97
--- /dev/null
+++ b/unoxml/source/dom/processinginstruction.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: processinginstruction.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "processinginstruction.hxx"
+
+namespace DOM
+{
+ CProcessingInstruction::CProcessingInstruction(const xmlNodePtr aNodePtr)
+ {
+ m_aNodeType = NodeType_PROCESSING_INSTRUCTION_NODE;
+ init_node(aNodePtr);
+ }
+
+
+ /**
+ The content of this processing instruction.
+ */
+ OUString SAL_CALL CProcessingInstruction::getData() throw (RuntimeException)
+ {
+ // XXX
+ return OUString();
+ }
+
+ /**
+ The target of this processing instruction.
+ */
+ OUString SAL_CALL CProcessingInstruction::getTarget() throw (RuntimeException)
+ {
+ // XXX
+ return OUString();
+ }
+
+
+ /**
+ The content of this processing instruction.
+ */
+ void SAL_CALL CProcessingInstruction::setData(const OUString& data) throw (RuntimeException)
+ {
+ // XXX
+ }
+
+
+ OUString SAL_CALL CProcessingInstruction::getNodeName()throw (RuntimeException)
+ {
+ OUString aName;
+ if (m_aNodePtr != NULL)
+ {
+ const xmlChar* xName = m_aNodePtr->name;
+ aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8);
+ }
+ return aName;
+ }
+ OUString SAL_CALL CProcessingInstruction::getNodeValue() throw (RuntimeException)
+ {
+ return OUString();
+ }
+}
diff --git a/unoxml/source/dom/processinginstruction.hxx b/unoxml/source/dom/processinginstruction.hxx
new file mode 100644
index 000000000000..1670bd46e2b2
--- /dev/null
+++ b/unoxml/source/dom/processinginstruction.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * $RCSfile: processinginstruction.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _PROCESSINGINSTRUCTION_HXX
+#define _PROCESSINGINSTRUCTION_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XProcessingInstruction.hpp>
+#include "node.hxx"
+#include <libxml/tree.h>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CProcessingInstruction : public cppu::ImplInheritanceHelper1< CNode, XProcessingInstruction >
+ {
+ friend class CNode;
+ protected:
+ CProcessingInstruction(const xmlNodePtr aNodePtr);
+
+ public:
+ /**
+ The content of this processing instruction.
+ */
+ virtual OUString SAL_CALL getData() throw (RuntimeException);
+
+ /**
+ The target of this processing instruction.
+ */
+ virtual OUString SAL_CALL getTarget() throw (RuntimeException);
+
+ /**
+ The content of this processing instruction.
+ */
+ virtual void SAL_CALL setData(const OUString& data) throw (RuntimeException);
+
+ // ---- resolve uno inheritance problems...
+ // overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
new file mode 100644
index 000000000000..8cc4f34649d9
--- /dev/null
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * $RCSfile: saxbuilder.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include "saxbuilder.hxx"
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+#include <libxml/tree.h>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/Sequence.h>
+
+namespace DOM
+{
+ Reference< XInterface > CSAXDocumentBuilder::_getInstance(const Reference< XMultiServiceFactory >& rSMgr)
+ {
+ return static_cast< XSAXDocumentBuilder* >(new CSAXDocumentBuilder(rSMgr));
+ }
+
+ const char* CSAXDocumentBuilder::aImplementationName = "com.sun.star.comp.xml.dom.SAXDocumentBuilder";
+ const char* CSAXDocumentBuilder::aSupportedServiceNames[] = {
+ "com.sun.star.xml.dom.SAXDocumentBuilder",
+ NULL
+ };
+
+ CSAXDocumentBuilder::CSAXDocumentBuilder(const Reference< XMultiServiceFactory >& mgr)
+ : m_aServiceManager(mgr)
+ , m_aState( SAXDocumentBuilderState_READY)
+ {}
+
+ OUString CSAXDocumentBuilder::_getImplementationName()
+ {
+ return OUString::createFromAscii(aImplementationName);
+ }
+ Sequence<OUString> CSAXDocumentBuilder::_getSupportedServiceNames()
+ {
+ Sequence<OUString> aSequence;
+ for (int i=0; aSupportedServiceNames[i]!=NULL; i++) {
+ aSequence.realloc(i+1);
+ aSequence[i]=(OUString::createFromAscii(aSupportedServiceNames[i]));
+ }
+ return aSequence;
+ }
+
+ Sequence< OUString > SAL_CALL CSAXDocumentBuilder::getSupportedServiceNames()
+ throw (RuntimeException)
+ {
+ return CSAXDocumentBuilder::_getSupportedServiceNames();
+ }
+
+ OUString SAL_CALL CSAXDocumentBuilder::getImplementationName()
+ throw (RuntimeException)
+ {
+ return CSAXDocumentBuilder::_getImplementationName();
+ }
+
+ sal_Bool SAL_CALL CSAXDocumentBuilder::supportsService(const OUString& aServiceName)
+ throw (RuntimeException)
+ {
+ Sequence< OUString > supported = CSAXDocumentBuilder::_getSupportedServiceNames();
+ for (sal_Int32 i=0; i<supported.getLength(); i++)
+ {
+ if (supported[i] == aServiceName) return sal_True;
+ }
+ return sal_False;
+ }
+
+
+ SAXDocumentBuilderState SAL_CALL CSAXDocumentBuilder::getState()
+ throw (RuntimeException)
+ {
+ return m_aState;
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::reset()
+ throw (RuntimeException)
+ {
+ m_aDocument = Reference< XDocument >();
+ m_aFragment = Reference< XDocumentFragment >();
+ while (!m_aNodeStack.empty()) m_aNodeStack.pop();
+ while (!m_aNSStack.empty()) m_aNSStack.pop();
+ m_aState = SAXDocumentBuilderState_READY;
+ }
+
+ Reference< XDocument > SAL_CALL CSAXDocumentBuilder::getDocument()
+ throw (RuntimeException)
+ {
+ if (m_aState != SAXDocumentBuilderState_DOCUMENT_FINISHED)
+ throw RuntimeException();
+
+ // some debugging...
+
+ Reference< XUnoTunnel > aTun(m_aDocument, UNO_QUERY);
+ xmlNodePtr pNode = (xmlNodePtr) aTun->getSomething(Sequence< sal_Int8 >());
+ if( pNode->type == XML_DOCUMENT_NODE )
+ {
+ xmlDocPtr pDoc = (xmlDocPtr)pNode;
+ FILE *f = fopen("c:\\xmlout.xml", "w");
+ xmlDocDump(f, pDoc);
+ fclose(f);
+ }
+
+ return m_aDocument;
+ }
+
+ Reference< XDocumentFragment > SAL_CALL CSAXDocumentBuilder::getDocumentFragment()
+ throw (RuntimeException)
+ {
+ if (m_aState != SAXDocumentBuilderState_FRAGMENT_FINISHED)
+ throw RuntimeException();
+ return m_aFragment;
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::startDocumentFragment(const Reference< XDocument >& ownerDoc)
+ throw (RuntimeException)
+ {
+ // start a new document fragment and push it onto the stack
+ // we have to be in a clean state to do this
+ if (!m_aState == SAXDocumentBuilderState_READY)
+ throw RuntimeException();
+
+ m_aDocument = ownerDoc;
+ Reference< XDocumentFragment > aFragment = m_aDocument->createDocumentFragment();
+ m_aNodeStack.push(Reference< XNode >(aFragment, UNO_QUERY));
+ m_aFragment = aFragment;
+ m_aState = SAXDocumentBuilderState_BUILDING_FRAGMENT;
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::endDocumentFragment()
+ throw (RuntimeException)
+ {
+ // there should only be the document left on the node stack
+ if (m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
+ throw RuntimeException();
+
+ Reference< XNode > aNode = m_aNodeStack.top();
+ if ( aNode->getNodeType() != NodeType_DOCUMENT_FRAGMENT_NODE)
+ throw RuntimeException();
+ m_aNodeStack.pop();
+ m_aState = SAXDocumentBuilderState_FRAGMENT_FINISHED;
+ }
+
+ // document handler
+
+ void SAL_CALL CSAXDocumentBuilder::startDocument() throw (SAXException)
+ {
+
+ fprintf(stderr, "startdocument\n");
+ // start a new document and push it onto the stack
+ // we have to be in a clean state to do this
+ if (!m_aState == SAXDocumentBuilderState_READY)
+ throw SAXException();
+
+ Reference< XDocumentBuilder > aBuilder(m_aServiceManager->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.dom.DocumentBuilder")), UNO_QUERY_THROW);
+ Reference< XDocument > aDocument = aBuilder->newDocument();
+ m_aNodeStack.push(Reference< XNode >(aDocument, UNO_QUERY));
+ m_aDocument = aDocument;
+ m_aState = SAXDocumentBuilderState_BUILDING_DOCUMENT;
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::endDocument() throw (SAXException)
+ {
+ fprintf(stderr, "enddocument\n");
+ // there should only be the document left on the node stack
+ if (!m_aState == SAXDocumentBuilderState_BUILDING_DOCUMENT)
+ throw SAXException();
+
+ Reference< XNode > aNode = m_aNodeStack.top();
+ if ( aNode->getNodeType() != NodeType_DOCUMENT_NODE)
+ throw SAXException();
+ m_aNodeStack.pop();
+ m_aState = SAXDocumentBuilderState_DOCUMENT_FINISHED;
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::startElement(const OUString& aName, const Reference< XAttributeList>& attribs)
+ throw (SAXException)
+ {
+ fprintf(stderr, "startElement <%s>\n", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+
+ if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
+ m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
+ {
+ fprintf(stderr, "illegal state in startElement()\n");
+ throw SAXException();
+ }
+
+ // start with mappings in effect for last level
+ NSMap aNSMap;
+ if (!m_aNSStack.empty())
+ aNSMap = NSMap(m_aNSStack.top());
+
+ // handle xmlns: attributes and add to mappings
+ OUString attr_qname;
+ OUString attr_value;
+ OUString newprefix;
+ AttrMap aAttrMap;
+ sal_Int32 idx=-1;
+ sal_Int16 nAttributes = attribs->getLength();
+ for (sal_Int16 i=0; i<nAttributes; i++)
+ {
+ attr_qname = attribs->getNameByIndex(i);
+ attr_value = attribs->getValueByIndex(i);
+ // new prefix mapping
+ if (attr_qname.indexOf(OUString::createFromAscii("xmlns:")) == 0)
+ {
+ newprefix = attr_qname.copy(attr_qname.indexOf(':')+1);
+ aNSMap.insert(NSMap::value_type(newprefix, attr_value));
+ fprintf(stderr, "new namespace mapping: %s -> %s\n",
+ OUStringToOString(newprefix, RTL_TEXTENCODING_UTF8).getStr(),
+ OUStringToOString(attr_value, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ else if (attr_qname == OUString::createFromAscii("xmlns"))
+ {
+ // new default prefix
+ fprintf(stderr, "new default NS: %s\n",
+ OUStringToOString(attr_value, RTL_TEXTENCODING_UTF8).getStr());
+ aNSMap.insert(NSMap::value_type(OUString(), attr_value));
+ }
+ else
+ {
+ aAttrMap.insert(AttrMap::value_type(attr_qname, attr_value));
+ }
+ }
+
+ // does the element have a prefix?
+ OUString aPrefix;
+ OUString aURI;
+ Reference< XElement > aElement;
+ idx = aName.indexOf(':');
+ if (idx != -1)
+ {
+ aPrefix = aName.copy(0, idx);
+ }
+ else
+ aPrefix = OUString();
+
+ NSMap::const_iterator result = aNSMap.find(aPrefix);
+ if ( result != aNSMap.end())
+ {
+ // found a URI for prefix
+ aElement = m_aDocument->createElementNS( result->second, aName); // qualified name
+ }
+ else
+ {
+ // no URI for prefix
+ aElement = m_aDocument->createElement(aName);
+ }
+ aElement = Reference< XElement > (
+ m_aNodeStack.top()->appendChild(Reference< XNode >(aElement, UNO_QUERY)),
+ UNO_QUERY);
+ m_aNodeStack.push(Reference< XNode >(aElement, UNO_QUERY));
+
+ // set non xmlns attributes
+ aPrefix = OUString();
+ aURI = OUString();
+ AttrMap::const_iterator a = aAttrMap.begin();
+ while (a != aAttrMap.end())
+ {
+ attr_qname = a->first;
+ attr_value = a->second;
+ idx = attr_qname.indexOf(':');
+ if(idx != -1)
+ {
+ aPrefix = attr_qname.copy(0, idx);
+ }
+ else
+ aPrefix = OUString();
+
+ fprintf(stderr, "set attribute: %s=\"%s\"\n",
+ OUStringToOString(attr_qname, RTL_TEXTENCODING_UTF8).getStr(),
+ OUStringToOString(attr_value, RTL_TEXTENCODING_UTF8).getStr());
+
+ result = aNSMap.find(aPrefix);
+ if (result != aNSMap.end())
+ {
+ // set attribute with namespace
+ aElement->setAttributeNS(result->second, attr_qname, attr_value);
+ } else {
+ // set attribute without namespace
+ aElement->setAttribute(attr_qname, attr_value);
+ }
+ a++;
+ }
+ m_aNSStack.push(aNSMap);
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::endElement(const OUString& aName)
+ throw (SAXException)
+ {
+ fprintf(stderr, "endElement </%s>\n", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+ // pop the current element from the stack
+ if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
+ m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
+ throw SAXException();
+
+ Reference< XNode > aNode(m_aNodeStack.top());
+ if (aNode->getNodeType() != NodeType_ELEMENT_NODE)
+ throw SAXException();
+
+ Reference< XElement > aElement(aNode, UNO_QUERY);
+ OUString aRefName;
+ OUString aPrefix = aElement->getPrefix();
+ if (aPrefix.getLength() > 0)
+ aRefName = aPrefix + OUString::createFromAscii(":") + aElement->getTagName();
+ else
+ aRefName = aElement->getTagName();
+ if (aRefName != aName) // consistency check
+ throw SAXException();
+
+ // pop it
+ m_aNodeStack.pop();
+ m_aNSStack.pop();
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::characters(const OUString& aChars)
+ throw (SAXException)
+ {
+ fprintf(stderr, "characters [%s]\n", OUStringToOString(aChars, RTL_TEXTENCODING_UTF8).getStr());
+ // append text node to the current top element
+ if (m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
+ m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
+ throw SAXException();
+
+ Reference< XText > aText = m_aDocument->createTextNode(aChars);
+ m_aNodeStack.top()->appendChild(Reference< XNode >(aText, UNO_QUERY));
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::ignorableWhitespace(const OUString& aSpaces)
+ throw (SAXException)
+ {
+ fprintf(stderr, "whitespace: [%s]\n", OUStringToOString(aSpaces, RTL_TEXTENCODING_UTF8).getStr());
+ // ignore ignorable whitespace
+ if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
+ m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
+ throw SAXException();
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::processingInstruction(const OUString& aTarget, const OUString& aData)
+ throw (SAXException)
+ {
+ fprintf(stderr, "processinginstruction: [target=%s, data=%s]\n", OUStringToOString(aTarget, RTL_TEXTENCODING_UTF8).getStr(),
+ OUStringToOString(aData, RTL_TEXTENCODING_UTF8).getStr());
+ // append PI node to the current top
+ if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
+ m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
+ throw SAXException();
+
+ Reference< XProcessingInstruction > aInstruction = m_aDocument->createProcessingInstruction(
+ aTarget, aData);
+ m_aNodeStack.top()->appendChild(Reference< XNode >(aInstruction, UNO_QUERY));
+ }
+
+ void SAL_CALL CSAXDocumentBuilder::setDocumentLocator(const Reference< XLocator >& aLocator)
+ throw (SAXException)
+ {
+ fprintf(stderr, "setdocumentlocator\n");
+ // set the document locator...
+ m_aLocator = aLocator;
+ }
+}
diff --git a/unoxml/source/dom/saxbuilder.hxx b/unoxml/source/dom/saxbuilder.hxx
new file mode 100644
index 000000000000..5cb62caf0bbb
--- /dev/null
+++ b/unoxml/source/dom/saxbuilder.hxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * $RCSfile: saxbuilder.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAXBUILDER_HXX
+#define _SAXBUILDER_HXX
+
+#include <stack>
+#include <map>
+
+#include <sal/types.h>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XSAXDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/SAXDocumentBuilderState.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/xml/dom/XDocumentFragment.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include "libxml/tree.h"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+using namespace com::sun::star::xml::sax;
+
+namespace DOM
+{
+
+ typedef std::stack< Reference< XNode > > NodeStack;
+ typedef std::map< OUString, OUString > NSMap;
+ typedef std::map< OUString, OUString > AttrMap;
+ typedef std::stack< NSMap > NSStack;
+
+ class CSAXDocumentBuilder
+ : public ::cppu::WeakImplHelper3< XDocumentHandler, XSAXDocumentBuilder, XServiceInfo >
+ {
+
+ private:
+ SAXDocumentBuilderState m_aState;
+ NodeStack m_aNodeStack;
+ NSStack m_aNSStack;
+
+ OUString resolvePrefix(const OUString& aPrefix);
+
+ Reference< XDocument > m_aDocument;
+ Reference< XDocumentFragment > m_aFragment;
+ Reference< XLocator > m_aLocator;
+ const Reference< XMultiServiceFactory > m_aServiceManager;
+
+ public:
+
+ // call for factory
+ static Reference< XInterface > getInstance(const Reference < XMultiServiceFactory >& xFactory);
+
+ // static helpers for service info and component management
+ static const char* aImplementationName;
+ static const char* aSupportedServiceNames[];
+ static OUString _getImplementationName();
+ static Sequence< OUString > _getSupportedServiceNames();
+ static Reference< XInterface > _getInstance(const Reference< XMultiServiceFactory >& rSMgr);
+
+ CSAXDocumentBuilder(const Reference< XMultiServiceFactory >& mgr);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
+ throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
+ throw (RuntimeException);
+
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument()
+ throw( com::sun::star::xml::sax::SAXException );
+ virtual void SAL_CALL endDocument()
+ throw( com::sun::star::xml::sax::SAXException );
+ virtual void SAL_CALL startElement( const OUString& aName,
+ const Reference< XAttributeList >& xAttribs )
+ throw( com::sun::star::xml::sax::SAXException );
+ virtual void SAL_CALL endElement( const OUString& aName )
+ throw( com::sun::star::xml::sax::SAXException );
+ virtual void SAL_CALL characters( const OUString& aChars )
+ throw( com::sun::star::xml::sax::SAXException );
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces )
+ throw( com::sun::star::xml::sax::SAXException );
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget,
+ const OUString& aData )
+ throw( com::sun::star::xml::sax::SAXException );
+ virtual void SAL_CALL setDocumentLocator( const Reference< XLocator >& xLocator )
+ throw( com::sun::star::xml::sax::SAXException );
+
+
+ // XSAXDocumentBuilder
+ virtual SAXDocumentBuilderState SAL_CALL getState()
+ throw (RuntimeException);
+ virtual void SAL_CALL reset()
+ throw (RuntimeException);
+ virtual Reference< XDocument > SAL_CALL getDocument()
+ throw (RuntimeException);
+ virtual Reference< XDocumentFragment > SAL_CALL getDocumentFragment()
+ throw (RuntimeException);
+ virtual void SAL_CALL startDocumentFragment(const Reference< XDocument >& ownerDoc)
+ throw (RuntimeException);
+ virtual void SAL_CALL endDocumentFragment()
+ throw (RuntimeException);
+
+
+ };
+}
+
+#endif
diff --git a/unoxml/source/dom/text.cxx b/unoxml/source/dom/text.cxx
new file mode 100644
index 000000000000..5a21594aa128
--- /dev/null
+++ b/unoxml/source/dom/text.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: text.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "text.hxx"
+namespace DOM
+{
+ CText::CText(const xmlNodePtr aNodePtr)
+ {
+ m_aNodeType = NodeType_TEXT_NODE;
+ init_characterdata(aNodePtr);
+ }
+
+
+ void CText::init_text(const xmlNodePtr aNodePtr)
+ {
+ init_characterdata(aNodePtr);
+ }
+
+ Reference< XText > SAL_CALL CText::splitText(sal_Int32 offset)
+ throw (RuntimeException)
+ {
+ return Reference< XText >(this);
+ }
+
+ OUString SAL_CALL CText::getNodeName()throw (RuntimeException)
+ {
+ return OUString::createFromAscii("#text");
+ }
+ OUString SAL_CALL CText::getNodeValue() throw (RuntimeException)
+ {
+ return getData();
+ }
+} \ No newline at end of file
diff --git a/unoxml/source/dom/text.hxx b/unoxml/source/dom/text.hxx
new file mode 100644
index 000000000000..50aee548fada
--- /dev/null
+++ b/unoxml/source/dom/text.hxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: text.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: lo $ $Date: 2004-01-28 16:31:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2004 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TEXT_HXX
+#define _TEXT_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/XText.hpp>
+#include <com/sun/star/xml/dom/XCharacterData.hpp>
+#include <libxml/tree.h>
+#include "characterdata.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::dom;
+
+namespace DOM
+{
+ class CText : public cppu::ImplInheritanceHelper1< CCharacterData, XText >
+ {
+ friend class CNode;
+
+ protected:
+ CText(){}
+ CText(const xmlNodePtr aNodePtr);
+ void init_text(const xmlNodePtr aNodePtr);
+ public:
+ // Breaks this node into two nodes at the specified offset, keeping
+ // both in the tree as siblings.
+ virtual Reference< XText > SAL_CALL splitText(sal_Int32 offset)
+ throw (RuntimeException);
+
+
+ // --- delegations for XCharacterData
+ virtual void SAL_CALL appendData(const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::appendData(arg);
+ }
+ virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ CCharacterData::deleteData(offset, count);
+ }
+ virtual OUString SAL_CALL getData() throw (RuntimeException)
+ {
+ return CCharacterData::getData();
+ }
+ virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException)
+ {
+ return CCharacterData::getLength();
+ }
+ virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::insertData(offset, arg);
+ }
+ virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
+ throw (RuntimeException)
+ {
+ CCharacterData::replaceData(offset, count, arg);
+ }
+ virtual void SAL_CALL setData(const OUString& data)
+ throw (RuntimeException)
+ {
+ CCharacterData::setData(data);
+ }
+ virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
+ throw (RuntimeException)
+ {
+ return CCharacterData::subStringData(offset, count);
+ }
+
+
+ // --- overrides for XNode base
+ virtual OUString SAL_CALL getNodeName()
+ throw (RuntimeException);
+ virtual OUString SAL_CALL getNodeValue()
+ throw (RuntimeException);
+
+ // --- resolve uno inheritance problems...
+ // --- delegation for XNde base.
+ virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
+ throw (RuntimeException)
+ {
+ return CNode::appendChild(newChild);
+ }
+ virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
+ throw (RuntimeException)
+ {
+ return CNode::cloneNode(deep);
+ }
+ virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::getAttributes();
+ }
+ virtual Reference< XNodeList > SAL_CALL getChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::getChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL getFirstChild()
+ throw (RuntimeException)
+ {
+ return CNode::getFirstChild();
+ }
+ virtual Reference< XNode > SAL_CALL getLastChild()
+ throw (RuntimeException)
+ {
+ return CNode::getLastChild();
+ }
+ virtual OUString SAL_CALL getLocalName()
+ throw (RuntimeException)
+ {
+ return CNode::getLocalName();
+ }
+ virtual OUString SAL_CALL getNamespaceURI()
+ throw (RuntimeException)
+ {
+ return CNode::getNamespaceURI();
+ }
+ virtual Reference< XNode > SAL_CALL getNextSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getNextSibling();
+ }
+ virtual NodeType SAL_CALL getNodeType()
+ throw (RuntimeException)
+ {
+ return CNode::getNodeType();
+ }
+ virtual Reference< XDocument > SAL_CALL getOwnerDocument()
+ throw (RuntimeException)
+ {
+ return CNode::getOwnerDocument();
+ }
+ virtual Reference< XNode > SAL_CALL getParentNode()
+ throw (RuntimeException)
+ {
+ return CNode::getParentNode();
+ }
+ virtual OUString SAL_CALL getPrefix()
+ throw (RuntimeException)
+ {
+ return CNode::getPrefix();
+ }
+ virtual Reference< XNode > SAL_CALL getPreviousSibling()
+ throw (RuntimeException)
+ {
+ return CNode::getPreviousSibling();
+ }
+ virtual sal_Bool SAL_CALL hasAttributes()
+ throw (RuntimeException)
+ {
+ return CNode::hasAttributes();
+ }
+ virtual sal_Bool SAL_CALL hasChildNodes()
+ throw (RuntimeException)
+ {
+ return CNode::hasChildNodes();
+ }
+ virtual Reference< XNode > SAL_CALL insertBefore(
+ const Reference< XNode >& newChild, const Reference< XNode >& refChild)
+ throw (RuntimeException)
+ {
+ return CNode::insertBefore(newChild, refChild);
+ }
+ virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
+ throw (RuntimeException)
+ {
+ return CNode::isSupported(feature, ver);
+ }
+ virtual void SAL_CALL normalize()
+ throw (RuntimeException)
+ {
+ CNode::normalize();
+ }
+ virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::removeChild(oldChild);
+ }
+ virtual Reference< XNode > SAL_CALL replaceChild(
+ const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
+ throw (RuntimeException)
+ {
+ return CNode::replaceChild(newChild, oldChild);
+ }
+ virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
+ throw (RuntimeException)
+ {
+ return CNode::setNodeValue(nodeValue);
+ }
+ virtual void SAL_CALL setPrefix(const OUString& prefix)
+ throw (RuntimeException)
+ {
+ return CNode::setPrefix(prefix);
+ }
+
+ };
+}
+#endif