You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2002/01/28 01:37:11 UTC
cvs commit: xml-xerces/java/samples/xni PSVIWriter.java
elena 02/01/27 16:37:11
Modified: java/samples/xni PSVIWriter.java
Log:
PSVI writer should check if characters include element default value
Revision Changes Path
1.5 +16 -10 xml-xerces/java/samples/xni/PSVIWriter.java
Index: PSVIWriter.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/xni/PSVIWriter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PSVIWriter.java 22 Jan 2002 16:42:25 -0000 1.4
+++ PSVIWriter.java 28 Jan 2002 00:37:10 -0000 1.5
@@ -106,7 +106,7 @@
* XML infoset and Post Schema Validation Infoset.
*
* @author Arun Yadav,Sun Miscrosystem.
- * @version $Id: PSVIWriter.java,v 1.4 2002/01/22 16:42:25 neilg Exp $
+ * @version $Id: PSVIWriter.java,v 1.5 2002/01/28 00:37:10 elena Exp $
*/
public class PSVIWriter
implements XMLComponent, XMLDocumentFilter {
@@ -597,12 +597,17 @@
// but XML applications are free to chunk characters into larger
// groups as necessary or desirable"
// XSV outputs each character separately.
+ ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
checkForChildren();
- printIndentTag("<character>");
- printElement("characterCode", text.toString());
- printElement("elementContentWhitespace", "false");
- printUnIndentTag("</character>");
+ if (elemPSVI != null) {
+ if (elemPSVI.schemaSpecified()){ // value was specified in the instance!
+ printIndentTag("<character>");
+ printElement("characterCode", text.toString());
+ printElement("elementContentWhitespace", "false");
+ printUnIndentTag("</character>");
+ }
+ }
if (fDocumentHandler != null) {
fDocumentHandler.characters(text,augs);
@@ -770,7 +775,7 @@
* default
*/
public void printPSVIStartElement(Augmentations augs) {
- ElementPSVI elemPSVI =(ElementPSVI)augs.getItem("ELEM_PSVI");
+ ElementPSVI elemPSVI =(ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
if (elemPSVI != null) {
// REVISIT: Should we store the values till end element call?
@@ -804,7 +809,7 @@
* default
*/
public void printPSVIEndElement(Augmentations augs) {
- ElementPSVI elemPSVI = (ElementPSVI)augs.getItem("ELEM_PSVI");
+ ElementPSVI elemPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
if (elemPSVI != null) {
@@ -847,13 +852,14 @@
}
printElement("psv:nil", String.valueOf(elemPSVI.isNil()));
printElement("psv:schemaNormalizedValue",elemPSVI.schemaNormalizedValue());
- printElement("psv:schemaSpecified",String.valueOf(elemPSVI.schemaSpecified()));
+ String specified = elemPSVI.schemaSpecified()?"infoset":"schema";
+ printElement("psv:schemaSpecified",specified);
}
}
public void printPSVIAttribute(Augmentations augs) {
- AttributePSVI attrPSVI =(AttributePSVI)augs.getItem("ATTR_PSVI");
+ AttributePSVI attrPSVI =(AttributePSVI)augs.getItem(Constants.ATTRIBUTE_PSVI);
if (attrPSVI !=null) {
short validation = attrPSVI.getValidationAttempted();
@@ -1018,7 +1024,7 @@
if (!attrElement)
printIndentTag("<attributes>");
- boolean psviAvailable = (attributes.getAugmentations(i).getItem("ATTR_PSVI")!=null);
+ boolean psviAvailable = (attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI)!=null);
// REVISIT: in XSV attributes that are defaulted from XML Schema
// still appear as an item from XML Infoset and has the same properties
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org