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

Validation fails with FileNotFoundException when a .rng file contains a link to another xml file. #249

Open
eduardnegru opened this issue Nov 20, 2019 · 0 comments

Comments

@eduardnegru
Copy link

My workspace looks like this:

/home/workspace/ contains java classes (including main) and data.xml
/home/workspace/schemas/ contains schema.rng and schema2.rng

I have the following Java code that validates a .rng file against a .xml file.

public boolean validate() {
       InputSource xmlFileInputSource = new InputSource(new FileInputStream("data.xml"));
       ValidationDriver validationDriver = new ValidationDriver();
       InputSource xmlSchemaInputSource = new InputSource(new FileInputStream("./schemas/schema.rng"));
       validationDriver.loadSchema(xmlSchemaInputSource);
       return validationDriver.validate(xmlFileInputSource);
}

schema.rng contains a link to another rng file.

<include href="schema2.rng" />

Instead of searching for schema2.rng file in the folder of schema.rng, Jing searches the file schema2.rng in the folder the program is run and thus results in FileNotFoundException in /home/workspace/. The search path should be /home/workspace/schemas, where schema.rng file is located.

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

2 participants