deweese 2003/11/15 16:37:00
Modified: sources/org/apache/batik/dom/svg SVGOMStyleElement.java
sources/org/apache/batik/dom/util SAXDocumentFactory.java
Log:
1) The style element will no longer generate multiple xml:space
attributes.
2) The SAXDocumentFactor will now generally generate just one
CDATA node for each CDATA section in an XML Document.
Revision Changes Path
1.17 +3 -5
xml-batik/sources/org/apache/batik/dom/svg/SVGOMStyleElement.java
Index: SVGOMStyleElement.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/dom/svg/SVGOMStyleElement.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SVGOMStyleElement.java 9 Aug 2003 16:58:41 -0000 1.16
+++ SVGOMStyleElement.java 16 Nov 2003 00:37:00 -0000 1.17
@@ -83,10 +83,8 @@
protected final static AttributeInitializer attributeInitializer;
static {
attributeInitializer = new AttributeInitializer(1);
- attributeInitializer.addAttribute(null,
- null,
- "xml:space",
- "preserve");
+ attributeInitializer.addAttribute(XMLSupport.XML_NAMESPACE_URI,
+ "xml", "space", "preserve");
}
/**
1.20 +20 -14
xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java
Index: SAXDocumentFactory.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/dom/util/SAXDocumentFactory.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- SAXDocumentFactory.java 9 Aug 2003 16:58:45 -0000 1.19
+++ SAXDocumentFactory.java 16 Nov 2003 00:37:00 -0000 1.20
@@ -123,7 +123,7 @@
/**
* Whether the parser currently parses a CDATA section.
*/
- protected boolean inCDATA;
+ protected StringBuffer cdataBuffer;
/**
* Whether the parser currently parses a DTD.
@@ -478,7 +478,7 @@
namespaces.put("xmlns", XMLSupport.XMLNS_NAMESPACE_URI);
namespaces.put("", null);
- inCDATA = false;
+ cdataBuffer = null;
inDTD = false;
currentNode = null;
@@ -610,15 +610,15 @@
*/
public void characters(char ch[], int start, int length)
throws SAXException {
- String data = new String(ch, start, length);
- if (currentNode == null) {
- if (inCDATA) preInfo.add(new CDataInfo(data));
- else preInfo.add(new TextInfo(data));
- } else {
- Node n = (inCDATA)
- ? document.createCDATASection(data)
- : document.createTextNode(data);
- currentNode.appendChild(n);
+ if (cdataBuffer != null)
+ cdataBuffer.append(ch, start, length);
+ else {
+ String data = new String(ch, start, length);
+ if (currentNode == null) {
+ preInfo.add(new TextInfo(data));
+ } else {
+ currentNode.appendChild(document.createTextNode(data));
+ }
}
}
@@ -674,7 +674,7 @@
* org.xml.sax.ext.LexicalHandler#startCDATA()}.
*/
public void startCDATA() throws SAXException {
- inCDATA = true;
+ cdataBuffer = new StringBuffer();
}
/**
@@ -682,7 +682,13 @@
* org.xml.sax.ext.LexicalHandler#endCDATA()}.
*/
public void endCDATA() throws SAXException {
- inCDATA = false;
+ String data = cdataBuffer.toString();
+ if (currentNode == null) {
+ preInfo.add(new CDataInfo(data));
+ } else {
+ currentNode.appendChild(document.createCDATASection(data));
+ }
+ cdataBuffer = null;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]