From 5d0fd25e87d7e01e9eb032d7242a8c74cc51be2c Mon Sep 17 00:00:00 2001 From: zapata Date: Sun, 25 May 2003 02:55:50 +0000 Subject: [PATCH] xml escape fix? --- .../mir/producer/EntityModifyingProducerNode.java | 4 ---- source/mir/rss/RSS091Reader.java | 2 ++ source/mir/rss/RSSTest.java | 2 +- source/mir/util/HTMLRoutines.java | 26 ++++++++++++++-------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/source/mir/producer/EntityModifyingProducerNode.java b/source/mir/producer/EntityModifyingProducerNode.java index 766565a0..295a63a9 100755 --- a/source/mir/producer/EntityModifyingProducerNode.java +++ b/source/mir/producer/EntityModifyingProducerNode.java @@ -84,10 +84,6 @@ public class EntityModifyingProducerNode implements ProducerNode { Object value = ParameterExpander.evaluateExpression(aValueMap, valueExpression); - aLogger.debug(" setting " + entityField + " to " + valueExpression+ " ("+ value + ")"); - -// if (value==null) -// entity.setValueForProperty(entityField, ""); if (value instanceof String) entity.setValueForProperty(entityField, (String) value); else if (value instanceof EntityAdapter) diff --git a/source/mir/rss/RSS091Reader.java b/source/mir/rss/RSS091Reader.java index 2ca36860..635e9330 100755 --- a/source/mir/rss/RSS091Reader.java +++ b/source/mir/rss/RSS091Reader.java @@ -177,6 +177,7 @@ public class RSS091Reader { public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc { String tag = aTag.getLocalName(); + System.out.println(tag); if (tag.equals("item")) return new RSS091ItemSectionHandler(); @@ -218,6 +219,7 @@ public class RSS091Reader { public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc { String tag = aTag.getLocalName(); + System.out.println(tag); if (mappedItemProperties.containsKey(tag)) { currentTag=(String) mappedChannelProperties.get(tag); diff --git a/source/mir/rss/RSSTest.java b/source/mir/rss/RSSTest.java index 1dd53231..02c327c8 100755 --- a/source/mir/rss/RSSTest.java +++ b/source/mir/rss/RSSTest.java @@ -39,7 +39,7 @@ public class RSSTest { RSSReader reader = new RSSReader(); RSS091Reader reader2 = new RSS091Reader(); try { - RSSData wvl = reader.parseUrl("http://euskalherria.indymedia.org/g8.1-0.rdf"); + RSSData wvl = reader.parseUrl("http://switzerland.mir.dnsalias.net/rss/g8.1-0.rdf"); RSSData fr = reader2.parseUrl("http://paris.indymedia.org/backendg8.php3"); // RSSData be = reader.parseUrl("http://belgium.indymedia.org/features.rdf"); diff --git a/source/mir/util/HTMLRoutines.java b/source/mir/util/HTMLRoutines.java index 988d6501..39e5b22a 100755 --- a/source/mir/util/HTMLRoutines.java +++ b/source/mir/util/HTMLRoutines.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ @@ -64,8 +64,16 @@ public class HTMLRoutines { } public static String encodeXML(String aText) { - final char[] CHARACTERS_TO_ESCAPE = { '&', '<', '>', '"', '\'' }; - final String[] ESCAPE_CODES = { "&", "<", ">", """, "'" }; +//#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + final char[] CHARACTERS_TO_ESCAPE = { '&', '<', '>', '"', '\'', + '\u0000', '\u0001', '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', '\u0008', '\u0000', '\u000B', + '\u000C', '\u000E', '\u000F', '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', + '\u0017', '\u0018', '\u0019', '\u001A', '\u001B', '\u001C', '\u001D', '\u001E'}; + final String[] ESCAPE_CODES = { "&", "<", ">", """, "'", + "�", "", "", "", "", "", "", "", "�", "�B", + "�C", "�E", "�F", " ", " ", " ", " ", "", "", "", + "", "", "", "A", "B", "C", "D", "E"}; + return StringRoutines.replaceStringCharacters(aText, CHARACTERS_TO_ESCAPE, ESCAPE_CODES); } -- 2.11.0