![ConTeXt 解析 xml 文件](https://linux22.com/image/293000/ConTeXt%20%E8%A7%A3%E6%9E%90%20xml%20%E6%96%87%E4%BB%B6.png)
当我尝试解析从 OmniOutliner 导出的 .xml 文件时,我遇到了一些问题。当我解析以下行时
<context:item>It's a form of advocacy: I'm happy with the various tools that I've found, and I want to introduce people to them. If Mac users are in the least inclined towards typesetting, XML, or &tex;, then they should give &context; a look; neither &latex; nor XSL-FO is the last word in its respective space. Conversely, &context; users should take a look at the Mac: it runs familiar and powerful UNIX-based tools very well, but also has a first rate GUI and applications like OmniOutliner Pro that combine power with real elegance in design.</context:item>
我得到了这个 .pdf
这应该是原始 pdf 中的内容。
您会发现 LaTex 单词不是用正确的字体转换的,而是被框起来的。TeX 和 ConTeXt 单词则不是这样。甚至字体也不同。
为了解析文件我给出了以下命令:
texexec --pdf main.xml
答案1
我不清楚问题到底是什么。如果我直接用 ConTeXt 处理你给出的代码片段,则无法识别任何实体。因此,在没有合适的 MWE 的情况下,我只能编造“一些”有用的内容。
\startbuffer[test]
<?xml version='1.0' standalone='yes?>
<document>
<itemize>
<item>
It's a form of advocacy: I'm happy with the various tools that I've
found, and I want to introduce people to them. If Mac users are in
the least inclined towards typesetting, XML, or &tex;, then they
should give &context; a look; neither &latex; nor XSL-FO is the last
word in its respective space. Conversely, &context; users should
take a look at the Mac: it runs familiar and powerful UNIX-based
tools very well, but also has a first rate GUI and applications like
OmniOutliner Pro that combine power with real elegance in design.
</item>
</itemize>
</document>
\stopbuffer
\startxmlsetups xml:setup
\xmlsetsetup{\xmldocument}{*}{-}
\xmlsetsetup{\xmldocument}{document|itemize|item}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:setup}
\xmltexentity {tex} {\TEX{}}
\xmltexentity {latex} {\LATEX{}}
\xmltexentity {context} {\CONTEXT{}}
\startxmlsetups xml:document
\startdocument
\xmlflush{#1}
\stopdocument
\stopxmlsetups
\startxmlsetups xml:itemize
\startitemize
\xmlflush{#1}
\stopitemize
\stopxmlsetups
\startxmlsetups xml:item
\startitem
\xmlflush{#1}
\stopitem
\stopxmlsetups
\xmlprocessbuffer{test}{test}{}