Thursday, 29 August 2013

How to add a character in xml from the internet

How to add a character in xml from the internet

I'm creating a rss feed using Sax. The xml is from the internet. The
problem is that the date looks like "1407"
Example:
<example name="DAvid" id="1" test1="1407" test2="0811">
What I need is to insert the simbol "-" between the 14 and the 07. How
could I do that?
The parse here:
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xReader = saxP.getXMLReader();
itemHoroscopeXMLHandler = new ItemHoroscopeXMLHandler();
xr.setContentHandler(itemHoroscopeXMLHandler);
Reader reader = new InputStreamReader(new
URL("http://example.xml").openStream(),
Charset.forName("ISO-8859-1"));
InputSource is = new InputSource (reader);
xReader.parse(is);

No comments:

Post a Comment