You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2002/05/07 12:47:49 UTC
cvs commit: xml-xerces/java/samples/xni DocumentTracer.java Writer.java
andyc 02/05/07 03:47:48
Modified: java/docs releases.xml
java/samples/sax Writer.java
java/samples/xni DocumentTracer.java Writer.java
Log:
Updated xni.DocumentTracer to print augmentation information.
Revision Changes Path
1.122 +10 -2 xml-xerces/java/docs/releases.xml
Index: releases.xml
===================================================================
RCS file: /home/cvs/xml-xerces/java/docs/releases.xml,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- releases.xml 4 May 2002 05:30:10 -0000 1.121
+++ releases.xml 7 May 2002 10:47:48 -0000 1.122
@@ -1,5 +1,5 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- $Id: releases.xml,v 1.121 2002/05/04 05:30:10 andyc Exp $ -->
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- $Id: releases.xml,v 1.122 2002/05/07 10:47:48 andyc Exp $ -->
<!DOCTYPE releases SYSTEM 'dtd/releases.dtd'>
<releases>
<release version="TBD">
@@ -7,6 +7,14 @@
This release fixes a number of bugs, and adds some functionality.
</desc>
<changes>
+ <update>
+ <note>
+ Updated xni.DocumentTracer sample to print augmentations for events.
+ This makes it easier to debug configurations that augment the document's
+ infoset.
+ </note>
+ <submitter name='Andy Clark'/>
+ </update>
<update>
<note>
Removed dependence on SAX attribute interfaces from XMLAttributesImpl
1.7 +3 -1 xml-xerces/java/samples/sax/Writer.java
Index: Writer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/sax/Writer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Writer.java 29 Jan 2002 01:15:06 -0000 1.6
+++ Writer.java 7 May 2002 10:47:48 -0000 1.7
@@ -84,7 +84,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: Writer.java,v 1.6 2002/01/29 01:15:06 lehors Exp $
+ * @version $Id: Writer.java,v 1.7 2002/05/07 10:47:48 andyc Exp $
*/
public class Writer
extends DefaultHandler
@@ -483,6 +483,7 @@
catch (Exception ex) {
parser = null;
System.err.println("error: Unable to instantiate parser ("+parserName+")");
+ e.printStackTrace(System.err);
}
}
continue;
@@ -522,6 +523,7 @@
}
catch (Exception e) {
System.err.println("error: Unable to instantiate parser ("+DEFAULT_PARSER_NAME+")");
+ e.printStackTrace(System.err);
continue;
}
}
1.15 +232 -18 xml-xerces/java/samples/xni/DocumentTracer.java
Index: DocumentTracer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/xni/DocumentTracer.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- DocumentTracer.java 2 May 2002 16:17:24 -0000 1.14
+++ DocumentTracer.java 7 May 2002 10:47:48 -0000 1.15
@@ -89,7 +89,7 @@
* @author Andy Clark, IBM
* @author Arnaud Le Hors, IBM
*
- * @version $Id: DocumentTracer.java,v 1.14 2002/05/02 16:17:24 elena Exp $
+ * @version $Id: DocumentTracer.java,v 1.15 2002/05/07 10:47:48 andyc Exp $
*/
public class DocumentTracer
extends XMLDocumentParser
@@ -247,6 +247,10 @@
fOut.print(',');
fOut.print("encoding=");
printQuotedString(encoding);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -267,6 +271,10 @@
fOut.print(',');
fOut.print("standalone=");
printQuotedString(standalone);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
} // xmlDecl(String,String,String,String)
@@ -286,6 +294,10 @@
fOut.print("systemId=");
printQuotedString(systemId);
fOut.println(')');
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.flush();
} // doctypeDecl(String,String,String)
@@ -301,6 +313,10 @@
fOut.print(',');
fOut.print("uri=");
printQuotedString(uri);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -313,6 +329,10 @@
printIndent();
fOut.print("startElement(");
printElement(element, attributes);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -326,6 +346,10 @@
printIndent();
fOut.print("emptyElement(");
printElement(element, attributes);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -338,12 +362,17 @@
fOut.print("characters(");
fOut.print("text=");
printQuotedString(text.ch, text.offset, text.length);
+ /***
if (augs != null) {
ElementPSVI element = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
- fOut.print(" schemaNormalized=");
+ fOut.print(",schemaNormalized=");
printQuotedString(element.getSchemaNormalizedValue());
}
-
+ /***/
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -358,6 +387,10 @@
fOut.print("ignorableWhitespace(");
fOut.print("text=");
printQuotedString(text.ch, text.offset, text.length);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -383,6 +416,10 @@
fOut.print("uri=");
printQuotedString(element.uri);
fOut.print('}');
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -395,6 +432,10 @@
fOut.print("endPrefixMapping(");
fOut.print("prefix=");
printQuotedString(prefix);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -404,7 +445,11 @@
public void startCDATA(Augmentations augs) throws XNIException {
printIndent();
- fOut.println("startCDATA()");
+ fOut.print("startCDATA(");
+ if (augs != null) {
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
fIndent++;
@@ -415,7 +460,12 @@
fIndent--;
printIndent();
- fOut.println("endCDATA()");
+ fOut.print("endCDATA(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // endCDATA()
@@ -436,6 +486,10 @@
fOut.print(',');
fOut.print("encoding=");
printQuotedString(encoding);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -452,6 +506,10 @@
fOut.print(',');
fOut.print("encoding=");
printQuotedString(encoding);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -464,6 +522,10 @@
fOut.print("comment(");
fOut.print("text=");
printQuotedString(text.ch, text.offset, text.length);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -480,6 +542,10 @@
fOut.print(',');
fOut.print("data=");
printQuotedString(data.ch, data.offset, data.length);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -493,6 +559,10 @@
fOut.print("endGeneralEntity(");
fOut.print("name=");
printQuotedString(name);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -503,7 +573,12 @@
fIndent--;
printIndent();
- fOut.println("endDocument()");
+ fOut.print("endDocument(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // endDocument();
@@ -542,6 +617,10 @@
fOut.print(locator.getColumnNumber());
fOut.print('}');
}
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -552,7 +631,12 @@
public void startExternalSubset(Augmentations augs) throws XNIException {
printIndent();
- fOut.println("startExternalSubset()");
+ fOut.print("startExternalSubset(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
fIndent++;
@@ -563,7 +647,12 @@
fIndent--;
printIndent();
- fOut.println("endExternalSubset()");
+ fOut.print("endExternalSubset(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // endExternalSubset(Augmentations)
@@ -575,6 +664,10 @@
fOut.print("ignoredCharacters(");
fOut.print("text=");
printQuotedString(text.ch, text.offset, text.length);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -596,6 +689,10 @@
fOut.print(',');
fOut.print("encoding=");
printQuotedString(encoding);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -610,6 +707,10 @@
fOut.print("endParameterEntity(");
fOut.print("name=");
printQuotedString(name);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -626,6 +727,10 @@
fOut.print(',');
fOut.print("contentModel=");
printQuotedString(contentModel);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -638,6 +743,10 @@
fOut.print("startAttlist(");
fOut.print("elementName=");
printQuotedString(elementName);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -697,6 +806,10 @@
printQuotedString(nonNormalizedDefaultValue.ch, nonNormalizedDefaultValue.offset,
nonNormalizedDefaultValue.length);
}
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -707,7 +820,12 @@
fIndent--;
printIndent();
- fOut.println("endAttlist()");
+ fOut.print("endAttlist(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // endAttlist()
@@ -729,6 +847,10 @@
fOut.print("nonNormalizedText=");
printQuotedString(nonNormalizedText.ch, nonNormalizedText.offset,
nonNormalizedText.length);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -751,6 +873,10 @@
fOut.print(',');
fOut.print("baseSystemId=");
printQuotedString(identifier.getBaseSystemId());
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -776,6 +902,10 @@
fOut.print(',');
fOut.print("notation=");
printQuotedString(notation);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -798,6 +928,10 @@
fOut.print(',');
fOut.print("baseSystemId=");
printQuotedString(identifier.getBaseSystemId());
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -823,6 +957,10 @@
fOut.print("??? ("+type+')');
}
}
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -834,7 +972,12 @@
fIndent--;
printIndent();
- fOut.println("endConditional()");
+ fOut.print("endConditional(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // endConditional()
@@ -844,7 +987,12 @@
fIndent--;
printIndent();
- fOut.println("endDTD()");
+ fOut.print("endDTD(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // endDTD()
@@ -861,6 +1009,10 @@
fOut.print("startContentModel(");
fOut.print("elementName=");
printQuotedString(elementName);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
fIndent++;
@@ -871,7 +1023,12 @@
public void any(Augmentations augs) throws XNIException {
printIndent();
- fOut.println("any()");
+ fOut.print("any(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // any()
@@ -880,7 +1037,12 @@
public void empty(Augmentations augs) throws XNIException {
printIndent();
- fOut.println("empty()");
+ fOut.print("empty(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // empty()
@@ -889,7 +1051,12 @@
public void startGroup(Augmentations augs) throws XNIException {
printIndent();
- fOut.println("startGroup()");
+ fOut.print("startGroup(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
fIndent++;
@@ -899,7 +1066,12 @@
public void pcdata(Augmentations augs) throws XNIException {
printIndent();
- fOut.println("pcdata()");
+ fOut.print("pcdata(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // pcdata()
@@ -912,6 +1084,10 @@
fOut.print("element(");
fOut.print("elementName=");
printQuotedString(elementName);
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -937,6 +1113,10 @@
fOut.print("??? ("+separator+')');
}
}
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -966,6 +1146,10 @@
fOut.print("??? ("+occurrence+')');
}
}
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.println(')');
fOut.flush();
@@ -976,7 +1160,12 @@
fIndent--;
printIndent();
- fOut.println("endGroup()");
+ fOut.print("endGroup(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // childrenEndGroup()
@@ -986,7 +1175,12 @@
fIndent--;
printIndent();
- fOut.println("endContentModel()");
+ fOut.print("endContentModel(");
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
+ fOut.println(')');
fOut.flush();
} // endContentModel()
@@ -1051,6 +1245,7 @@
String attrType = attributes.getType(i);
String attrValue = attributes.getValue(i);
String attrNonNormalizedValue = attributes.getNonNormalizedValue(i);
+ Augmentations augs = attributes.getAugmentations(i);
fOut.print("name=");
fOut.print('{');
fOut.print("prefix=");
@@ -1077,6 +1272,10 @@
if (attributes.isSpecified(i) == false ) {
fOut.print("(default)");
}
+ if (augs != null) {
+ fOut.print(',');
+ printAugmentations(augs);
+ }
fOut.print('}');
}
fOut.print('}');
@@ -1084,6 +1283,20 @@
} // printElement(QName,XMLAttributes)
+ /** Prints augmentations. */
+ protected void printAugmentations(Augmentations augs) {
+ fOut.print("augs={");
+ java.util.Enumeration keys = augs.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String)keys.nextElement();
+ Object value = augs.getItem(key);
+ fOut.print(key);
+ fOut.print('#');
+ fOut.print(String.valueOf(value));
+ }
+ fOut.print('}');
+ } // printAugmentations(Augmentations)
+
/** Print quoted string. */
protected void printQuotedString(String s) {
@@ -1299,7 +1512,8 @@
}
catch (XMLConfigurationException e) {
if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
- e.printStackTrace();
+ //e.printStackTrace();
+ System.err.println("warning: Parser does not recognize feature ("+NOTIFY_CHAR_REFS_FEATURE_ID+")");
}
else {
System.err.println("warning: Parser does not support feature ("+NOTIFY_CHAR_REFS_FEATURE_ID+")");
1.11 +3 -1 xml-xerces/java/samples/xni/Writer.java
Index: Writer.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/xni/Writer.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Writer.java 29 Jan 2002 01:15:06 -0000 1.10
+++ Writer.java 7 May 2002 10:47:48 -0000 1.11
@@ -84,7 +84,7 @@
*
* @author Andy Clark, IBM
*
- * @version $Id: Writer.java,v 1.10 2002/01/29 01:15:06 lehors Exp $
+ * @version $Id: Writer.java,v 1.11 2002/05/07 10:47:48 andyc Exp $
*/
public class Writer
extends XMLDocumentParser
@@ -555,6 +555,7 @@
catch (Exception e) {
parserConfig = null;
System.err.println("error: Unable to instantiate parser configuration ("+parserName+")");
+ e.printStackTrace(System.err);
}
continue;
}
@@ -602,6 +603,7 @@
}
catch (Exception e) {
System.err.println("error: Unable to instantiate parser configuration ("+DEFAULT_PARSER_CONFIG+")");
+ e.printStackTrace(System.err);
continue;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org