处理基于XML的DSL [英] Processing XML based DSL

查看:167
本文介绍了处理基于XML的DSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SWI-Prolog作为通用XML处理器可以提供很多功能.

SWI-Prolog has plenty to offer as a generalized XML processor.

library(sgml)用于读取/写入XML结构格式,library(xpath)用于导航等等.但是,如果我尝试读取SVG,它是有效的XML,则会收到消息:

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

否.

有人对此有暗示吗?我还想重写最终修改的文件内容,同时保留独特的DTD.

Does anyone has an hint on this? I'd also want to rewrite the eventually modified file content preserving of course the distinctive DTD.

推荐答案

我找到了一个解决方案,将我用curl获得的DTD文件保存在本地,我可以请求SGML库使用它.

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)]),
...

正如我所说的,我以这种方式得到了svg11.dtd

As I said, I got svg11.dtd in this way

$ curl http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd > svg11.dtd

这篇关于处理基于XML的DSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆