[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/kdom
From: Rob Buis <rwlbuis () xs4all ! nl>
Date: 2004-04-30 20:41:20
Message-ID: 20040430204120.672569A7E () office ! kde ! org
[Download RAW message or body]
CVS commit by buis:
- Adding a malformed prefix test, this fixes prefix07.svg.
- Allow to build EntityReferences with cloned children from Entity.
M +1 -0 DOMImplementation.h 1.16
M +5 -0 EntityReference.cc 1.22
M +11 -6 Helper.cc 1.11
M +2 -0 Helper.h 1.22
M +2 -2 parser/libxml/LibXMLParser.cc 1.31
--- kdenonbeta/kdom/EntityReference.cc #1.21:1.22
@@ -28,4 +28,5 @@
#include "DocumentType.h"
#include "NamedNodeMap.h"
+#include "DOMImplementation.h"
using namespace KDOM;
@@ -57,5 +58,9 @@ EntityReference::EntityReference(Documen
Entity &e = static_cast<Entity &>(n);
for(Node *child = &e.firstChild(); *child != Node::null; child = \
&child->nextSibling()) + {
+ DOMImplementation::self()->setParsingMode(true);
appendChild(child->cloneNode(true));
+ DOMImplementation::self()->setParsingMode(false);
+ }
}
}
--- kdenonbeta/kdom/DOMImplementation.h #1.15:1.16
@@ -68,4 +68,5 @@ namespace KDOM
friend class NamedNodeMap;
friend class DocumentBuilder;
+ friend class EntityReference;
bool parsingMode() const;
--- kdenonbeta/kdom/Helper.h #1.21:1.22
@@ -50,4 +50,6 @@ namespace KDOM
static int CheckMalformedQualifiedName(const DOMString \
&qualifiedName);
+ static bool IsMalformedPrefix(const DOMString &prefix);
+
// All functions prefixed with 'Validate' never throw exceptions.
static bool ValidatePrefix(const DOMString &name);
--- kdenonbeta/kdom/Helper.cc #1.10:1.11
@@ -88,8 +88,7 @@ void Helper::CheckPrefix(const DOMString
// from "http://www.w3.org/XML/1998/namespace" [Namespaces]. or
// - if this node is an attribute and the specified prefix is "xmlns" and \
the namespaceURI of this node is different from \
"http://www.w3.org/2000/xmlns/"
- DOMString qName = prefix + ":" + name;
- if(namespaceURI.isNull() || name == "xmlns" ||
- (prefix[0] == 'x' && prefix[1] == 'm' && prefix[2] == 'l' && namespaceURI \
!= "http://www.w3.org/XML/1998/namespace") ||
- (prefix[0] == 'x' && prefix[1] == 'm' && prefix[2] == 'l' && prefix[3] == \
'n' && prefix[4] == 's' && namespaceURI != "http://www.w3.org/2000/xmlns/")) + \
if(IsMalformedPrefix(prefix) || namespaceURI.isNull() || name == "xmlns" || + \
(prefix[0] == 'x' && prefix[1] == 'm' && prefix[2] == 'l' && namespaceURI != \
"http://www.w3.org/XML/1998/namespace"))// || +// (prefix[0] == 'x' && \
prefix[1] == 'm' && prefix[2] == 'l' && prefix[3] == 'n' && prefix[4] == 's' && \
namespaceURI != "http://www.w3.org/2000/xmlns/")) throw new \
DOMException(NAMESPACE_ERR); }
@@ -142,4 +141,10 @@ int Helper::CheckMalformedQualifiedName(
}
+bool Helper::IsMalformedPrefix(const DOMString &prefix)
+{
+ // TODO : find out definition of malformed prefix
+ return prefix.string().endsWith(":");
+}
+
bool Helper::ValidatePrefix(const DOMString &name)
{
@@ -160,5 +165,5 @@ bool Helper::ValidateAttributeName(const
return false; // first char isn't valid
- for(unsigned int i = 0; i < name.length(); ++i)
+ for(unsigned int i = 1; i < name.length(); ++i)
{
ch = unicode[i];
--- kdenonbeta/kdom/parser/libxml/LibXMLParser.cc #1.30:1.31
@@ -135,7 +135,7 @@ void sax_start_element_ns(void *closure,
for(int i = 0;i < nb_namespaces * 2;i++)
{
- DOMString qName("xmlns:");
+ DOMString qName("xmlns");
if(namespaces[i])
- qName += CONV_STRING(namespaces[i]);
+ qName = qName + ":" + CONV_STRING(namespaces[i]);
i++;
docBuilder->startAttributeNS(CONV_STRING(namespaces[i]), \
qName, CONV_STRING(namespaces[i]));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic