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

DomParser gives up before it tries parsing #134

Open
jmd-usgs opened this issue May 25, 2017 · 2 comments
Open

DomParser gives up before it tries parsing #134

jmd-usgs opened this issue May 25, 2017 · 2 comments

Comments

@jmd-usgs
Copy link

jmd-usgs commented May 25, 2017

I am getting

java.lang.IllegalArgumentException: Doesn't look like XML: '[snip]...\OLD_001_QRev.xml'
at com.jcabi.xml.DomParser.(DomParser.java:90)
at com.jcabi.xml.XMLDocument.(XMLDocument.java:155) ...

I am using jcabi-xml-0.18.1.jar

The XML file parses fine elsewhere. I believe DomParser is giving up before it actually tries to parse the file.

Right now, I think the DomParser code is doing something like:

if (pattern doesn't match) {
    throw "Doesn't look like XML"
}
parse()

Could it be changed to something like:

try {
    parse()
} catch (Exception e) {
    if (pattern doesn't match) {
        throw "Doesn't look like XML"
    } else {
        rethrow e
    }
}

I am attaching the XML file that caused the problem (added .txt extension so it would upload).

OLD_002_QRev.xml.txt

@0crat
Copy link

0crat commented May 25, 2017

@yegor256 please, pay attention to this issue

@yegor256
Copy link
Member

@jmd-usgs I think that you're giving it your file name instead of its content. Try this:

new XMLDocument(new File("OLD_002_QRev.xml.txt"));

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

No branches or pull requests

3 participants