问题
SWI-Prolog has plenty to offer as a generalized XML processor.
library(sgml)
for read/write XML structured formats, library(xpath)
for navigation and more... but if I attempt to read a SVG, that it is valid XML, I get the message:
ERROR: SGML2PL(xml): ...my_file...svg:2: file "...myfile.path.../http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" does not exist
false.
Does anyone has an hint on this? I'd also want to rewrite the eventually modified file content preserving of course the distinctive DTD.
回答1:
I found a solution, saving locally the DTD file I got with curl, I can request to SGML library to use it.
...
new_dtd(svg, DTD),
path(Dir, 'svg11.dtd', DtdFile),
load_dtd(DTD, DtdFile),
path(Dir, 'html_labels.svg', SvgFile),
load_structure(SvgFile, [Svg], svg:[dtd(DTD), dialect(xmlns), xml_no_ns(quiet)]),
...
As I said, I got svg11.dtd
in this way
$ curl http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd > svg11.dtd
来源:https://stackoverflow.com/questions/10448424/processing-xml-based-dsl