sandygao 2002/09/25 06:23:17
Modified: java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
Log:
A bug: we didn't send characters to the document handler if
schema-normalize-value feature is on, but the text doesn't need to be
normalized (WS= preserve, or complex content).
Fixed now.
Revision Changes Path
1.109 +15 -18
xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Index: XMLSchemaValidator.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- XMLSchemaValidator.java 25 Sep 2002 02:50:37 -0000 1.108
+++ XMLSchemaValidator.java 25 Sep 2002 13:23:17 -0000 1.109
@@ -732,23 +732,18 @@
*/
public void characters(XMLString text, Augmentations augs) throws XNIException {
- handleCharacters(text);
+ text = handleCharacters(text);
// call handlers
if (fDocumentHandler != null) {
- if (fNormalizeData) {
- if (fUnionType) {
- // for union types we can't normalize data
- // thus we only need to send augs information if any;
- // the normalized data for union will be send
- // after normalization is performed (at the endElement())
- if (augs != null)
- fDocumentHandler.characters(fEmptyXMLStr, augs);
- }
- else {
- // otherwise pass the normalized string as the text
- fDocumentHandler.characters(fNormalizedStr, augs);
- }
- } else {
+ if (fNormalizeData && fUnionType) {
+ // for union types we can't normalize data
+ // thus we only need to send augs information if any;
+ // the normalized data for union will be send
+ // after normalization is performed (at the endElement())
+ if (augs != null)
+ fDocumentHandler.characters(fEmptyXMLStr, augs);
+ }
+ else {
fDocumentHandler.characters(text, augs);
}
}
@@ -1511,10 +1506,11 @@
} // handleEndDocument()
// handle character contents
- void handleCharacters(XMLString text) {
+ // returns the normalized string if possible, otherwise the original string
+ XMLString handleCharacters(XMLString text) {
if (fSkipValidationDepth >= 0)
- return;
+ return text;
// Note: data in EntityRef and CDATA is normalized as well
// if whitespace == -1 skip normalization, because it is a complexType
@@ -1544,6 +1540,7 @@
// we saw first chunk of characters
fFirstChunk = false;
+ return text;
} // handleCharacters(XMLString)
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]