Package ch.tocco.nice2.util.xml
Class XmlCharSet
java.lang.Object
ch.tocco.nice2.util.xml.XmlCharSet
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontains(char c) Returnstrueif the given character is a valid xml character as defined in http://www.w3.org/TR/xml11/#charsets.static InputStreamConsumes the given input stream and returns a new stream which has no invalid xml entities left.static InputStreamfilterInvalidXmlEntities(Reader reader) Consumes the given reader and returns a new input stream which has no invalid xml entities.static StringReturns a new string without characters considered invalid xml characters.static StringRemoves invalid xml entities from the string.static InputStreamtoValidXml(InputStream xml) Consumes the given stream and returns a new one where invalid characters and invalid xml entities have been removed.static InputStreamtoValidXml(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) Returnstrueif 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
-