Package ch.tocco.nice2.util.xml
Class XmlCharSet
java.lang.Object
ch.tocco.nice2.util.xml.XmlCharSet
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
contains
(char c) Returnstrue
if the given character is a valid xml character as defined in http://www.w3.org/TR/xml11/#charsets.static InputStream
Consumes the given input stream and returns a new stream which has no invalid xml entities left.static InputStream
filterInvalidXmlEntities
(Reader reader) Consumes the given reader and returns a new input stream which has no invalid xml entities.static String
Returns a new string without characters considered invalid xml characters.static String
Removes invalid xml entities from the string.static InputStream
toValidXml
(InputStream xml) Consumes the given stream and returns a new one where invalid characters and invalid xml entities have been removed.static InputStream
toValidXml
(Reader xml) Consumes the given reader and returns a new one where invalid characters and invalid xml entities have been removed.
-
Method Details
-
contains
public static boolean contains(char c) Returnstrue
if the given character is a valid xml character as defined in http://www.w3.org/TR/xml11/#charsets. -
removeInvalidChars
Returns a new string without characters considered invalid xml characters. -
removeInvalidXmlEntities
Removes invalid xml entities from the string. These are xml encoded chars, which are invalid for xml, for example the char '' would be encoded to '' or ''. -
filterInvalidXmlEntities
Consumes the given reader and returns a new input stream which has no invalid xml entities.- Throws:
IOException
-
filterInvalidXmlEntities
Consumes the given input stream and returns a new stream which has no invalid xml entities left. The input stream is converted to characters using UTF-8 charset.- Throws:
IOException
-
toValidXml
Consumes the given stream and returns a new one where invalid characters and invalid xml entities have been removed. The input stream is converted to characters using UTF-8 charset.- Throws:
IOException
-
toValidXml
Consumes the given reader and returns a new one where invalid characters and invalid xml entities have been removed.- Throws:
IOException
-