[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.0/kdelibs/khtml/xml
From: Harri Porten <porten () kde ! org>
Date: 2008-01-19 18:41:01
Message-ID: 1200768061.569741.32075.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 763553 by porten:
Basic cloneNode() implementation for Document and DocumentType.
M +24 -8 dom_docimpl.cpp
--- branches/KDE/4.0/kdelibs/khtml/xml/dom_docimpl.cpp #763552:763553
@@ -1826,14 +1826,27 @@
return false;
}
-NodeImpl *DocumentImpl::cloneNode ( bool /*deep*/ )
+NodeImpl *DocumentImpl::cloneNode ( bool deep )
{
- // Spec says cloning Document nodes is "implementation dependent"
- // so we do not support it...
- return 0;
+#if 0
+ NodeImpl *dtn = m_doctype->cloneNode(deep);
+ DocumentTypeImpl *dt = static_cast<DocumentTypeImpl*>(dtn);
+#endif
+
+ int exceptioncode;
+ DocumentImpl *clone = m_implementation->createDocument("",
+ "",
+ 0, exceptioncode);
+ assert( exceptioncode == 0 );
+
+ // ### attributes, styles, ...
+
+ if (deep)
+ cloneChildNodes(clone);
+
+ return clone;
}
-
typedef const char* (*NameLookupFunction)(unsigned short id);
typedef int (*IdLookupFunction)(const char *tagStr, int len);
@@ -2901,9 +2914,12 @@
NodeImpl *DocumentTypeImpl::cloneNode ( bool /*deep*/ )
{
- // Spec says cloning Document nodes is "implementation dependent"
- // so we do not support it...
- return 0;
+ DocumentTypeImpl *clone = new DocumentTypeImpl(implementation(),
+ 0,
+ name(), publicId(),
+ systemId());
+ // ### copy entities etc.
+ return clone;
}
NamedNodeMapImpl * DocumentTypeImpl::entities() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic