[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[xml] Problem in Default Namespace handling defined in DTD



Hi ,

For the xml file attached the corresponding DTD contains the namespace declaration as a default attribute of the element svg. However when I parse the xml file using Sax Api’s for the second svg element I do not get the default nspace as part of the start element Ns callback, for the firstvelement I get nspace attribute….On debugging I found the problem occurred when the namespace has been pushed on the stack if the name space occurs a second time the namespace attribute counter is updated, maybe this is the expected behaviour, if so there is no problem, however if it is not so then the namespace attribute counter nbNs needs to be incremented. I am attaching the patch for the problem.

 

Regards

Ashwin

 

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG April 1999" 
  "D:/LIBXML_BUILD/TTCN/xmltest/libxml2-2.6.28/test/SVG/svg.dtd">
<svg width="4in" height="3in">
		<svg style="left: 25%; top: 25%" width="50%" height="50%">
		</svg>
</svg>
<!ENTITY % namespace
  "xmlns CDATA #FIXED 'http://www.w3.org/Graphics/SVG/svg.dtd'">

<!ELEMENT svg (defs?,title?,desc?,(use|image|text|path|g|switch|svg|a)*) >
<!ATTLIST svg 
  %namespace;
  width CDATA #REQUIRED
  height CDATA #REQUIRED
  allow-zoom-and-pan (true | false) "true" >
*** Copy of parserorg.c	2008-02-25 04:42:46.000000000 -0800
--- parsernsfix.c	2008-02-25 04:45:26.000000000 -0800
*************** failed:     
*** 8158,8163 ****
--- 8158,8167 ----
  			           defaults->values[4 * i + 2]) > 0)
  			    nbNs++;
  		    }
+ 		    else
+ 	        {
+ 	            nbNs++;
+ 	        }
  		} else if (aprefix == ctxt->str_xmlns) {
  		    /*
  		     * check that it's not a defined namespace
*************** failed:     
*** 8173,8178 ****
--- 8177,8186 ----
  			           defaults->values[4 * i + 2]) > 0)
  			    nbNs++;
  		    }
+ 		    else
+                 {
+                     nbNs++;
+                 }
  		} else {
  		    /*
  		     * check that it's not a defined attribute


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]