Friday, 26 December 2014

How do I parse XML with german umlauts in ! names !?



I try to parse XML in java by



DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new ByteArrayInputStream(msg.getBytes("UTF-8")));


Everything seems to be ok, also



<data>äöü</data>


is parsed correctly (esp. concerning the german umlauts).


But when I try to parse



<däta>xxx</däta>


the parser throws an exception, names with umlauts in it seem to not work.


What to do?


No comments:

Post a Comment