You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2001/11/21 13:51:13 UTC

DO NOT REPLY [Bug 4996] New: - Setting an attribute values with a pound sign (pound sterling and not #) produces a code in the xml file whereas in a comment does not

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4996>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4996

Setting an attribute values with a pound sign (pound sterling and not #) produces a code in the xml file whereas in a comment does not

           Summary: Setting an attribute values with a pound sign (pound
                    sterling and not #) produces a code in the xml file
                    whereas in a comment does not
           Product: Xerces-J
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: rmatthews@expressive-systems.org


For version 1.4.4 (also in 1.3.3)

the follwoing code produces the following results (relevant lines are marked)

private void writeElements(Collection collection, Node root, Document doc) {
	Enumeration e = collection.elements();
	while (e.hasMoreElements()) {
		NakedInterface elementObject = (NakedInterface) e.nextElement();
		if (elementObject != null) {
			Element attribute = doc.createElement("element");
			attribute.setAttribute("type", elementObject.getClass().getName());
			NakedInterface attObject = ((NakedInterface) elementObject);
			attribute.setAttribute("oid", String.valueOf(((SimpleOid)
attObject.getOid()).getSerialNo()));
	->		String value ="�200";;
	->		attribute.setAttribute("value", value);
	->		root.appendChild(doc.createComment(value));
	->		root.appendChild(attribute);
		}
	}
}

output to a file gives

<?xml version="1.0"?>
<!DOCTYPE expressive-object SYSTEM "eot.dtd">
<!--Collection: 5 InvoiceItems-->
<expressive-object type="org.nakedobjects.toolkit.object.Collection" oid="190">
<!--�200-->
<element type="org.nakedobjects.test.enterprise1.InvoiceItem" oid="193"
value="&#xa3;200"/>
<!--�200-->
<element type="org.nakedobjects.test.enterprise1.InvoiceItem" oid="194"
value="&#xa3;200"/>
<!--�200-->
<element type="org.nakedobjects.test.enterprise1.InvoiceItem" oid="197"
value="&#xa3;200"/>
<!--�200-->
<element type="org.nakedobjects.test.enterprise1.InvoiceItem" oid="198"
value="&#xa3;200"/>
<!--�200-->
<element type="org.nakedobjects.test.enterprise1.InvoiceItem" oid="104"
value="&#xa3;200"/>
</expressive-object>


Note that each comment has a pound sign - which causes a parse failure when
later parsing this file - whereas the attributes get encoded.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org