Search code examples
javaxmldomxml-parsingcarriage-return

recognition of character 
 in java DOM


In my XML file, I have 
, i.e. carriage return, in some text nodes. How do I recognize a text that contains such character? I'm using the plain java DOM interface.


Solution

  • Got it. It seems it is comparable to '\r'. Hence, for example,

    String text = //xml text that contains 
    for (int i = 0; i < text.length(); i++)
        if (text.charAt(i) == '\r')
            // code...