Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid XML not passed validation #125

Open
senleft opened this issue Sep 25, 2016 · 11 comments
Open

Valid XML not passed validation #125

senleft opened this issue Sep 25, 2016 · 11 comments

Comments

@senleft
Copy link

senleft commented Sep 25, 2016

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

@dmarkov
Copy link

dmarkov commented Sep 29, 2016

@yegor256 please do something about this issue

@dmarkov
Copy link

dmarkov commented Nov 22, 2016

@amihaiemil it's yours, please help

@amihaiemil
Copy link
Member

@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
Copy link
Member

@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

@senleft
Copy link
Author

senleft commented Nov 22, 2016

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

@amihaiemil
Copy link
Member

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

@amihaiemil
Copy link
Member

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

@amihaiemil
Copy link
Member

amihaiemil commented Nov 25, 2016

@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!

@dmarkov
Copy link

dmarkov commented Nov 28, 2016

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

@amihaiemil 30 points was deducted from your rating

@dmarkov
Copy link

dmarkov commented Nov 28, 2016

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

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

@eglobetrotter
Copy link

eglobetrotter commented Jan 12, 2019

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants