org.apache.commons.feedparser.tools
Class XMLCleanser

java.lang.Object
  extended by org.apache.commons.feedparser.tools.XMLCleanser

public class XMLCleanser
extends Object

Class that can cleanse a string so that nothing can be present to break an XML parser. This is a VERY non-portable class as it is meant to work just with Xalan/Xerces and may remove more text and replace things that are non-XML centric.

Version:
$Id: XMLCleanser.java 159211 2005-03-27 23:24:21Z burton $
Author:
Kevin A. Burton

Constructor Summary
XMLCleanser()
           
 
Method Summary
static String cleanse(byte[] content, String encoding)
          Copy based on a byte array.
static String cleanse(String content)
           
static byte[] cleanseToByteArray(byte[] content)
          Copy based on a byte array.
static char[] cleanseToCharArray(byte[] content)
           
static boolean isXMLCharacter(char c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLCleanser

public XMLCleanser()
Method Detail

cleanse

public static String cleanse(String content)

cleanse

public static String cleanse(byte[] content,
                             String encoding)
                      throws Exception
Copy based on a byte array.

Throws:
Exception

cleanseToCharArray

public static char[] cleanseToCharArray(byte[] content)

cleanseToByteArray

public static byte[] cleanseToByteArray(byte[] content)
Copy based on a byte array.


isXMLCharacter

public static boolean isXMLCharacter(char c)


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.