Author: mrglavas
Date: Mon Jul 12 12:48:55 2010
New Revision: 963268
URL: http://svn.apache.org/viewvc?rev=963268&view=rev
Log:
Eliminate unnecessary creation of XNI QNames in the construction of synthetic
annotations.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java?rev=963268&r1=963267&r2=963268&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOM.java
Mon Jul 12 12:48:55 2010
@@ -213,12 +213,20 @@ public class SchemaDOM extends DefaultDo
}
void endAnnotationElement(QName elemName) {
- fAnnotationBuffer.append("</").append(elemName.rawname).append(">");
+ endAnnotationElement(elemName.rawname);
+ }
+
+ void endAnnotationElement(String elemRawName) {
+ fAnnotationBuffer.append("</").append(elemRawName).append(">");
}
void endSyntheticAnnotationElement(QName elemName, boolean complete) {
+ endSyntheticAnnotationElement(elemName.rawname, complete);
+ }
+
+ void endSyntheticAnnotationElement(String elemRawName, boolean complete) {
if(complete) {
-
fAnnotationBuffer.append("\n</").append(elemName.rawname).append(">");
+ fAnnotationBuffer.append("\n</").append(elemRawName).append(">");
// note that this is always called after endElement on
<annotation>'s
// child and before endElement on annotation.
// hence, we must make this the child of the current
@@ -229,7 +237,7 @@ public class SchemaDOM extends DefaultDo
// these things
fAnnotationBuffer = null;
} else //capturing character calls
-
fAnnotationBuffer.append("</").append(elemName.rawname).append(">");
+ fAnnotationBuffer.append("</").append(elemRawName).append(">");
}
void startAnnotationCDATA() {
@@ -338,8 +346,12 @@ public class SchemaDOM extends DefaultDo
// commence the serialization of an annotation
void startAnnotation(QName elemName, XMLAttributes attributes,
NamespaceContext namespaceContext) {
+ startAnnotation(elemName.rawname, attributes, namespaceContext);
+ }
+ void startAnnotation(String elemRawName, XMLAttributes attributes,
+ NamespaceContext namespaceContext) {
if(fAnnotationBuffer == null) fAnnotationBuffer = new
StringBuffer(256);
- fAnnotationBuffer.append("<").append(elemName.rawname).append(" ");
+ fAnnotationBuffer.append("<").append(elemRawName).append(" ");
// attributes are a bit of a pain. To get this right, we have to keep
track
// of the namespaces we've seen declared, then examine the namespace
context
@@ -380,7 +392,10 @@ public class SchemaDOM extends DefaultDo
fAnnotationBuffer.append(">\n");
}
void startAnnotationElement(QName elemName, XMLAttributes attributes) {
- fAnnotationBuffer.append("<").append(elemName.rawname);
+ startAnnotationElement(elemName.rawname, attributes);
+ }
+ void startAnnotationElement(String elemRawName, XMLAttributes attributes) {
+ fAnnotationBuffer.append("<").append(elemRawName);
for(int i=0; i<attributes.getLength(); i++) {
String aValue = attributes.getValue(i);
fAnnotationBuffer.append("
").append(attributes.getQName(i)).append("=\"").append(processAttValue(aValue)).append("\"");
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java?rev=963268&r1=963267&r2=963268&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/opti/SchemaDOMParser.java
Mon Jul 12 12:48:55 2010
@@ -341,13 +341,13 @@ public class SchemaDOMParser extends Def
attributes.removeAllAttributes();
String schemaPrefix =
fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
- QName annQName = new QName(schemaPrefix,
SchemaSymbols.ELT_ANNOTATION, schemaPrefix + (schemaPrefix.length() ==
0?"":":") + SchemaSymbols.ELT_ANNOTATION, SchemaSymbols.URI_SCHEMAFORSCHEMA);
- schemaDOM.startAnnotation(annQName, attributes, fNamespaceContext);
- QName elemQName = new QName(schemaPrefix,
SchemaSymbols.ELT_DOCUMENTATION, schemaPrefix + (schemaPrefix.length() ==
0?"":":") + SchemaSymbols.ELT_DOCUMENTATION, SchemaSymbols.URI_SCHEMAFORSCHEMA);
- schemaDOM.startAnnotationElement(elemQName, attributes);
+ final String annRawName = (schemaPrefix.length() == 0) ?
SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' +
SchemaSymbols.ELT_ANNOTATION);
+ schemaDOM.startAnnotation(annRawName, attributes,
fNamespaceContext);
+ final String elemRawName = (schemaPrefix.length() == 0) ?
SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' +
SchemaSymbols.ELT_DOCUMENTATION);
+ schemaDOM.startAnnotationElement(elemRawName, attributes);
schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
- schemaDOM.endSyntheticAnnotationElement(elemQName, false);
- schemaDOM.endSyntheticAnnotationElement(annQName, true);
+ schemaDOM.endSyntheticAnnotationElement(elemRawName, false);
+ schemaDOM.endSyntheticAnnotationElement(annRawName, true);
schemaDOM.endElement();
@@ -426,13 +426,13 @@ public class SchemaDOMParser extends Def
boolean sawann = fSawAnnotation.pop();
if (value && !sawann) {
String schemaPrefix =
fNamespaceContext.getPrefix(SchemaSymbols.URI_SCHEMAFORSCHEMA);
- QName annQName = new QName(schemaPrefix,
SchemaSymbols.ELT_ANNOTATION, schemaPrefix + (schemaPrefix.length() ==
0?"":":") + SchemaSymbols.ELT_ANNOTATION, SchemaSymbols.URI_SCHEMAFORSCHEMA);
- schemaDOM.startAnnotation(annQName, fEmptyAttr,
fNamespaceContext);
- QName elemQName = new QName(schemaPrefix,
SchemaSymbols.ELT_DOCUMENTATION, schemaPrefix + (schemaPrefix.length() ==
0?"":":") + SchemaSymbols.ELT_DOCUMENTATION, SchemaSymbols.URI_SCHEMAFORSCHEMA);
- schemaDOM.startAnnotationElement(elemQName,
fEmptyAttr);
+ final String annRawName = (schemaPrefix.length() == 0)
? SchemaSymbols.ELT_ANNOTATION : (schemaPrefix + ':' +
SchemaSymbols.ELT_ANNOTATION);
+ schemaDOM.startAnnotation(annRawName, fEmptyAttr,
fNamespaceContext);
+ final String elemRawName = (schemaPrefix.length() ==
0) ? SchemaSymbols.ELT_DOCUMENTATION : (schemaPrefix + ':' +
SchemaSymbols.ELT_DOCUMENTATION);
+ schemaDOM.startAnnotationElement(elemRawName,
fEmptyAttr);
schemaDOM.charactersRaw("SYNTHETIC_ANNOTATION");
- schemaDOM.endSyntheticAnnotationElement(elemQName,
false);
- schemaDOM.endSyntheticAnnotationElement(annQName,
true);
+ schemaDOM.endSyntheticAnnotationElement(elemRawName,
false);
+ schemaDOM.endSyntheticAnnotationElement(annRawName,
true);
}
}
schemaDOM.endElement();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]