i have a strange problem because i write my own node with a JAXP (Java API for XML Processing) and i need to add and delete something from my xml-file. I wrote two function and both work perfectly but now i have implemented the two function in my node. And if i add something i get problems with the unicode because if i use a "ä" i got a "Ã¤" in my xml-file. But outside from KNIME it works perfectly. Do you have any idea about that?
did you set the encoding="..." in your XML header ?
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><package xmlns="http://drools.org/drools-5.2" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" name="org.bosch.fuelsurveywarnsystem" xs:schemaLocation="http://drools.org/drools-5.2 drools.org/drools-5.2.xsd">
it works... i can read all elements correctly.... only if i add a new element i get a "Ã¤" instead of a "ä".... and if i use the exactly same function outside KNIME it works correctly...
Is there a setting in KNIME to change the settings?
It looks like your output is not UTF-8 but ISO-8859-xx. Usually you have to tell the writer that output the XML tree to a file which encoding to use. The default depends on the operating system and environment settings, therefore I suggest to always explicitly set the encoding.
The encoding property in the XML header is only used when reading a file afaik.
i set the encoding....
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.transform(new DOMSource(document), new StreamResult(new FileOutputStream(XMLFILENAME)));
and thor if i call the function outside from a KNIME node i haven`t this problem...