|
From: Andreas V. <a_...@us...> - 2004-04-12 10:49:19
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23392/src/org/cobricks/item Modified Files: Item.java Log Message: Index: Item.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/Item.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Item.java 11 Apr 2004 17:41:03 -0000 1.15 +++ Item.java 12 Apr 2004 10:35:28 -0000 1.16 @@ -569,8 +569,12 @@ } if (value instanceof String) { + // A String can contain any text; therefore it is possible that + // the String is not wellformed. So we have to wrap text that is + // not wellformed in a CDATA statement if (!((String) value).matches("(?s)<![CDATA[.+]]>") - && (ItemAttrs.checkWellFormedXML((String) value)).length() > 0) { + && (ItemAttrs.checkWellFormedXML("<test>" + (String) value + + "</test>").length()) > 0) { value = "<![CDATA[" + value + "]]>"; } xml.append(">" + value + "</" + attribute + ">\n"); @@ -653,19 +657,16 @@ xml.append(" </" + attribute + ">\n"); } else if (value instanceof Boolean) { xml.append(">" + ((Boolean) value).toString() + "</" - + attribute + ">\n"); + + attribute + ">\n"); } else if (value instanceof User) { - xml.append(" id=\"" - + new Integer(((User) value).getId()).toString() + "\">" - + value.toString() + "</" + attribute + ">\n"); + xml.append(" id=\"" + new Integer(( + (User) value).getId()).toString() + "\"/>\n"); } else if (value instanceof Category) { - xml.append(" id=\"" - + new Integer(((Category) value).getCategoryId()).toString() - + "\">" + value.toString() + "</" + attribute + ">\n"); + xml.append(" id=\"" + new Integer(( + (Category) value).getCategoryId()).toString() + "\"/>\n"); } else if (value instanceof Item) { - xml.append(" id=\"" - + new Integer(((Item) value).getLocalId()).toString() - + "\">" + value.toString() + "</" + attribute + ">\n"); + xml.append(" id=\"" + new Integer(( + (Item) value).getLocalId()).toString() + "\"/>\n"); } else if (value instanceof Timestamp) { //TBD: Check clearly internal and external representation of // date and date time |