Processing XML based DSL

微笑、不失礼 提交于 2019-12-08 05:38:46

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!