Author: mrglavas
Date: Mon Feb 27 17:36:10 2006
New Revision: 381533
URL: http://svn.apache.org/viewcvs?rev=381533&view=rev
Log:
Some minor performance improvements. Avoid creating temporary
String objects when appending character data to a StringBuffer.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java?rev=381533&r1=381532&r2=381533&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java Mon Feb
27 17:36:10 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -147,12 +147,12 @@
// note that this will only be called within appinfo/documentation
void comment(XMLString text) {
- fAnnotationBuffer.append("<!--").append(text.toString()).append("-->");
+ fAnnotationBuffer.append("<!--").append(text.ch, text.offset,
text.length).append("-->");
}
// note that this will only be called within appinfo/documentation
- void processingInstruction(String target, String data) {
- fAnnotationBuffer.append("<?").append(target).append("
").append(data).append("?>");
+ void processingInstruction(String target, XMLString data) {
+ fAnnotationBuffer.append("<?").append(target).append("
").append(data.ch, data.offset, data.length).append("?>");
}
// note that this will only be called within appinfo/documentation
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java?rev=381533&r1=381532&r2=381533&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
(original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
Mon Feb 27 17:36:10 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -165,8 +165,8 @@
*/
public void processingInstruction(String target, XMLString data,
Augmentations augs)
throws XNIException {
- if(fAnnotationDepth > -1) {
- schemaDOM.processingInstruction(target, data.toString());
+ if (fAnnotationDepth > -1) {
+ schemaDOM.processingInstruction(target, data);
}
}
Modified: xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java
URL:
http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java?rev=381533&r1=381532&r2=381533&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java
(original)
+++ xerces/java/trunk/src/org/apache/xerces/parsers/AbstractDOMParser.java Mon
Feb 27 17:36:10 2006
@@ -580,7 +580,7 @@
if (fInDTD) {
if (fInternalSubset != null && !fInDTDExternalSubset) {
fInternalSubset.append ("<!-- ");
- fInternalSubset.append (text.toString ());
+ fInternalSubset.append (text.ch, text.offset, text.length);
fInternalSubset.append (" -->");
}
return;
@@ -655,7 +655,7 @@
fInternalSubset.append ("<?");
fInternalSubset.append (target);
fInternalSubset.append (' ');
- fInternalSubset.append (data.toString ());
+ fInternalSubset.append (data.ch, data.offset, data.length);
fInternalSubset.append ("?>");
}
@@ -1141,7 +1141,6 @@
return;
}
- String value = text.toString ();
Node child = fCurrentNode.getLastChild ();
if (child != null && child.getNodeType () == Node.TEXT_NODE) {
// collect all the data into the string buffer.
@@ -1154,11 +1153,11 @@
}
fFirstChunk = false;
}
- fStringBuffer.append (value);
+ fStringBuffer.append (text.ch, text.offset, text.length);
}
else {
fFirstChunk = true;
- Text textNode = fDocument.createTextNode (value);
+ Text textNode = fDocument.createTextNode (text.toString());
fCurrentNode.appendChild (textNode);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]