diff --git a/src/dom/svgreader.cpp b/src/dom/svgreader.cpp
index 1ec85bcca924381b32a5d986449e88b265d1962c..ea4392f50fb494f0b1c0745956421690677dab03 100644 (file)
--- a/src/dom/svgreader.cpp
+++ b/src/dom/svgreader.cpp
#include <stdarg.h>
-#define SVG_NAMESPACE "http://www.w3.org/2000/svg"
namespace org
{
//# P A R S I N G
//#########################################################################
+
+
/**
* Get the character at the position and record the fact
*/
//printf("namespaceURI:%s\n", namespaceURI.c_str());
DOMString tagName = sourceElem->getTagName();
printf("tag name:%s\n", tagName.c_str());
-
- ElementImplPtr newElement = NULL;
- if (namespaceURI != SVG_NAMESPACE)
- {
- newElement = new SVGSVGElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- else //## SVG!!
+ ElementPtr newElement = doc->createElementNS(namespaceURI, tagName);
+ if (!newElement)
{
+ return false;
+ }
+ NamedNodeMap &attrs = sourceElem->getAttributes();
+ for (unsigned int i=0 ; i<attrs.getLength() ; i++)
+ {
+ NodePtr n = attrs.item(i);
+ newElement->setAttribute(n->getNodeName(), n->getNodeValue());//should be exception here
+ }
+ parent->appendChild(newElement);
- //####################################################
- //## ATTRIBUTES
- //####################################################
- DOMString style = sourceElem->getAttribute("style");
- if (style.size() > 0)
- {
- css::CssReader parser;
- style.insert(0, "{");
- style.append("}");
- //printf("CSS:%s\n", style.c_str());
- if (!parser.parse(style))
- {
- error("parsing style attribute");
- }
- else
- {
- //printf("##parsed!\n");
- }
- }
-
- DOMString transform = sourceElem->getAttribute("transform");
- if (transform.size() > 0)
- {
- if (!parseTransform(transform))
- {
- error("parsing transform attribute");
- }
- else
- {
- //printf("##parsed!\n");
- }
- }
-
- //####################################################
- //## ELEMENT - SPECIFIC
- //####################################################
- if (tagName == "svg")
- {
- newElement = new SVGSVGElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- else if (tagName == "title")
- {
- newElement = new SVGTitleElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- else if (tagName == "desc")
- {
- newElement = new SVGDescElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- else if (tagName == "defs")
- {
- newElement = new SVGDefsElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- else if (tagName == "style")
- {
- newElement = new SVGStyleElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- else if (tagName == "g")
- {
- newElement = new SVGGElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- else if (tagName == "path")
- {
- newElement = new SVGPathElementImpl();
- newElement->assign(*sourceElem);
- parent->appendChild(newElement);
- }
- }
NodeList children = sourceElem->getChildNodes();
int nodeCount = children.getLength();