jcabi-xml icon indicating copy to clipboard operation
jcabi-xml copied to clipboard

Valid XML not passed validation

Open senleft opened this issue 9 years ago • 11 comments

Please see full stacktrace at http://pastebin.com/zK7HkMK8

Patterns.XML not matches specified XML (attached as planets.txt due github file extension restriction) as valid XML. planets.txt

senleft avatar Sep 25 '16 12:09 senleft

@yegor256 please do something about this issue

dmarkov avatar Sep 29 '16 09:09 dmarkov

@amihaiemil it's yours, please help

dmarkov avatar Nov 22 '16 07:11 dmarkov

@senleft can you give me the planets.xsl? I am running a test with planets.xml file you attached and I'm getting the following error:

image

Which makes me thing the whole xml passes patterns validation but it doesn't find the xsl and so it fails.

amihaiemil avatar Nov 22 '16 07:11 amihaiemil

@senleft I figured why I got the exception above it's not lack of xsl. I also did try to instantiate an XmlDocument with the exact contents of planets.xml you attached and it worked

image

And that XmlDocument constructor calls DomParser:

image

which runs that regex pattern. So as it is now, I'd say I did not reproduce it? Are you absolutely sure the xml was valid at the moment when you tried? :D

amihaiemil avatar Nov 22 '16 08:11 amihaiemil

@amihaiemil Yes, I'm absolutely sure about it. I will try to reproduce it and attach the full project source.

senleft avatar Nov 22 '16 08:11 senleft

@senleft sure, thanks. I will wait for that since I'm out of leads for the moment :)

amihaiemil avatar Nov 22 '16 08:11 amihaiemil

@dmarkov assign someone else; no more time for this :(

amihaiemil avatar Nov 25 '16 20:11 amihaiemil

@senleft I reproduced the problem (it's indeed a regex problem), but got no more time for this. Someone else should take it up soon. In the meantime, please don't turn off notifications from this post as in the end, you should be the one to close it. Thanks!

amihaiemil avatar Nov 25 '16 20:11 amihaiemil

@dmarkov assign someone else; no more time for this :(

@amihaiemil 30 points was deducted from your rating

dmarkov avatar Nov 28 '16 08:11 dmarkov

@dmarkov assign someone else; no more time for this :(

@amihaiemil someone else will help in this task, no problem at all

dmarkov avatar Nov 28 '16 08:11 dmarkov

I'm getting the same issue here, I have absolutely valid XML and the pattern returns this exception: java.lang.IllegalArgumentException: Doesn't look like XML: 'content of my valid xml file'

The issue seems to be in this string transformation: txt.replaceAll("\s", "") before pattern check. For any reason it is not only removing lines returns, but also whitespaces, so from <?xml version="1.0" encoding="utf-8"?> it makes <?xmlversion="1.0"encoding="utf-8"?>.

This is my Java Runtime: openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

eglobetrotter avatar Jan 12 '19 22:01 eglobetrotter