xml escape fix?
authorzapata <zapata>
Sun, 25 May 2003 02:55:50 +0000 (02:55 +0000)
committerzapata <zapata>
Sun, 25 May 2003 02:55:50 +0000 (02:55 +0000)
source/mir/producer/EntityModifyingProducerNode.java
source/mir/rss/RSS091Reader.java
source/mir/rss/RSSTest.java
source/mir/util/HTMLRoutines.java

index 766565a..295a63a 100755 (executable)
@@ -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)
index 2ca3686..635e933 100755 (executable)
@@ -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);
index 1dd5323..02c327c 100755 (executable)
@@ -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");
 
index 988d650..39e5b22 100755 (executable)
  * 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 = { "&amp;", "&lt;", "&gt;", "&quot;", "&apos;" };
+//#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 = { "&amp;", "&lt;", "&gt;", "&quot;", "&apos;",
+        "&#0000", "&#0001", "&#0003", "&#0004", "&#0005", "&#0006", "&#0007", "&#0008", "&#0000", "&#000B",
+        "&#000C", "&#000E", "&#000F", "&#0010", "&#0011", "&#0012", "&#0013", "&#0014", "&#0015", "&#0016",
+        "&#0017", "&#0018", "&#0019", "&#001A", "&#001B", "&#001C", "&#001D", "&#001E"};
+
 
     return StringRoutines.replaceStringCharacters(aText, CHARACTERS_TO_ESCAPE, ESCAPE_CODES);
   }