我试图让 xincludes 在现有系统中工作,该系统在 xercesc 中使用 XercesDOMParser 来解析来自客户端的传入 xml。我正在使用 Apache Xercesc v3.0.1,从输入流中读取的传入 XML 是:
<?xml version="1.0" encoding="UTF-8"?>
<VisionServer xmlns:xi="http://www.w3.org/2001/XInclude">
<CompositeObject>
<xi:include href="testguioutput.xml" />
而 testguioutput.xml 包含
<?xml version="1.0" encoding="UTF-8"?>
<GUIOutput>
<Input>Input</Input>
<Title>IDC2_1</Title>
</GUIOutput>
现有代码使用围绕 XercesDOMParser 的包装器来解析传入的 XML,并且在使用 setDoNamespaces 和 setDoXInclude 为 true 之后,它正在尝试解析 XInclude,但我得到一个持久的“致命:包含失败并且没有找到后备元素in document '{0}'" 错误,无论我将 testguioutput.xml 放在目录结构的哪个位置。
我在visualstudio 2008下工作,我的工作目录是默认的,并且用完了/project/debug,但是无论目标文件是在/project/还是/project/debug/中,包含都会失败。