Code Monkey home page Code Monkey logo

Comments (7)

cmarchand avatar cmarchand commented on September 13, 2024

awful.zip
This is not restricted to gaulois-pipe, and can be reproduced with xmlresolver and Saxon together ;

Configuration config = Configuration.newConfiguration();
config.setURIResolver(new Resolver(new Catalog("src/test/resources/awfulDtd/awful-catalog.xml")));
Processor proc = new Processor(config);
DocumentBuilder builder = proc.newDocumentBuilder();
builder.build(new File("src/test/resources/awfulDtd/inputFile.xml"));

Produces :

2018-05-17 14:08:38,807 TRACE [main] org.xmlresolver.Catalog     - Default properties: XMLResolver.properties;CatalogManager.properties
2018-05-17 14:08:38,809 DEBUG [main] org.xmlresolver.Catalog     - Loaded xmlresolver.properties from classpath: jar:file:/home/ext-cmarchand/.m2/repository/org/xmlresolver/xmlresolver/0.12.4/xmlresolver-0.12.4.jar!/xmlresolver.properties
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.369 sec <<< FAILURE!
testCatalog(fr.efl.chaine.xslt.CatalogTest)  Time elapsed: 0.32 sec  <<< ERROR!
net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/home/ext-cmarchand/devel/github/gaulois-pipe/gaulois-pipe/src/test/resources/awfulDtd/inputFile.xml: /fakepath/awful.dtd (Aucun fichier ou dossier de ce type)

from gaulois-pipe.

etourdot avatar etourdot commented on September 13, 2024

Maybe you should try with class ResolvingXMLReader (according to saxon doc: https://www.saxonica.com/html/documentation/sourcedocs/xml-catalogs.html):

ResolvingXMLReader resolvingXMLReader = new ResolvingXMLReader(new Resolver(new Catalog("src/test/resources/awfulDtd/awful-catalog.xml")));
resolvingXMLReader.parse("src/test/resources/awfulDtd/inputFile.xml");

from gaulois-pipe.

cmarchand avatar cmarchand commented on September 13, 2024

@etourdot : the problem is I use xmlresolver from Norman Walsh, and these classes come from Apache xml-common-resolver (hum, also written by Norman Walsh), and I do not want to add another dependency for resolver.
Setting resolver as a EntityResolver on XMLReader should work, but doesn't. @ndw should have a look at it.

from gaulois-pipe.

etourdot avatar etourdot commented on September 13, 2024

Why adding another dependency ?
ResolvingXMLReader is included in xml-common-resolver : https://xerces.apache.org/xml-commons/components/apidocs/resolver/org/apache/xml/resolver/tools/ResolvingXMLReader.html
Description is: "This class implements a SAX XMLReader that performs entity resolution using the CatalogResolver."
Btw, it's quoted in the ยง "How to use XML Resolver" in website xmlresolver

from gaulois-pipe.

cmarchand avatar cmarchand commented on September 13, 2024

Because I do not have xml-commons-resolver as dependency in gaulois-pipe.
Because I use another resolver, which is much reliable ; xmlresolver.org

Best,
Christophe

from gaulois-pipe.

etourdot avatar etourdot commented on September 13, 2024

I misspoke, ResolvingXMLReader is also included in xmlresolver:
https://github.com/ndw/xmlresolver/blob/master/src/main/java/org/xmlresolver/tools/ResolvingXMLReader.java

from gaulois-pipe.

cmarchand avatar cmarchand commented on September 13, 2024

Problem is solved by setting an EntityResolver (i.e. an instance of org.xmlresolver.Resolver) in the XMLReader that's used to parse source File.

That solves partially the problem, only for files that go through pipe. But it doesn't solve the problem for files load by fn:document(...) or fn:doc(...). Still some work to do.

from gaulois-pipe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.