xmlet / XsdParser

A Parser that parses a XSD file into a Java Structure.
MIT License
80 stars 34 forks source link

XsdParserJar::parseJarFile fails for valid schema compared to XsdParser #32

Closed msbukal closed 3 years ago

msbukal commented 3 years ago

Hi,

My schema fails parsing with "The top level element of a XSD file should be the xsd:schema node" at XsdParserJar::parseJarFile.

I know my schema is valid because it successfully runs when I use the XsdParser with a local path. When I changed it to use the XsdParserJar with the files packaged within the .jar it fails. I removed all comments and text above the root xsd:schema node in all the .xsd files, but it still fails.

I notice the XsdParser checks all its children in XsdParser::getSchemaNode and returns the first schema node, but in the XsdParserJar::getSchemaNode only the first child node is returned.

I think this difference is caused by only fixing the issue reported here: https://github.com/xmlet/XsdParser/issues/7 for the XsdParser.

Would it be possible to fix this for the XsdParserJar too?

Thanks! Milena

lcduarte commented 3 years ago

Hello,

Yeah, that is most likely the problem, I haven't being paying attention to the Jar version. Can you provide me with the example that doesn't work so I can test it out? Alternatively you can create a pull request with the fix and I'll check it out and create a new release.

Thanks

msbukal commented 3 years ago

I'm using the HL7 CDA schema, and I added the schema files under src/main/resources with

sourceSets {
        ...
        resources {
            ...
            srcDirs('src/main/resources')
        }
    }
}

in my build.gradle, which puts them at the root of the jar.

lcduarte commented 3 years ago

Hello,

I've pushed you suggestion, try it out and if it solves your problem I'll perform a new release.

msbukal commented 3 years ago

Yes it fixed the issue! Thank you.

lcduarte commented 3 years ago

Great!

I'll try to release the new version today. I'm having some troubles since the deployment server is giving me timeout, I'll update you when its done.

lcduarte commented 3 years ago

Guess it was too early in the day, its working now :) I've deployed the new version, (1.1.3), with the fix.

Thanks for using the library, if you find any more issues let me know!