The xml file that I got from user may contain the newline character or may not.
So to be usable xml format I have the solution to do by using regex
example:
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd">
<tag1>/* .. more .. */</tag1> /*newline*/
</Document>
Can anyone tell me how can I do with regex to recognize the xml string there is the newline character at the end of closing </tag>
this approach allow me to more control the xml format and display message back to user.something like your xml file contain newline at the end of closing tag
Are you looking for something like this?
See it here on Regexr
I am not sure if it is useful, but this is what its doing:
It searches for a closing tag
</[^<]*>, followed by\r?\nor\r\n?where the?means the character before is optional.