【发布时间】:2015-05-22 11:17:59
【问题描述】:
我正在尝试使用 XQuery 读取 xml 文件。 在 google 中尝试了很多,我发现所有相关的是 doc() 函数。但这对我不起作用。 我将我的 xml 文件和 Xquery 保存在 eclipse 中的同一文件夹下。但是 Xquery 给出错误:第 13 行,第 6 列:{err}XP0004:无效的静态类型:untypedDocument?
My Xquery:
declare function xf:LookupXML($dvm1 as element(ns0:dvm),
$DVMName as element(*),
$SourceColumn as element(*))
as element(*) {
doc('CityCode.xml')
};
declare variable $dvm1 as element(ns0:dvm) external;
declare variable $DVMName as element(*) external;
declare variable $SourceColumn as element(*) external;
xf:LookupXML($dvm1,
$DVMName,
$SourceColumn)
My xml file:- Name- CityCode.xml
<?xml version="1.0" encoding="UTF-8"?>
<tns:dvm name="" xmlns:tns="http://www.example.org/SuburbCode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/SuburbCode SuburbCode.xsd ">
<tns:columns>
<tns:column name="City"/>
<tns:column name="Code"/>
</tns:columns>
<tns:rows>
<tns:row>
<tns:cell>Mumbai</tns:cell>
<tns:cell>BOM</tns:cell>
</tns:row>
<tns:row>
<tns:cell>Delhi</tns:cell>
<tns:cell>DLH</tns:cell>
</tns:row>
<tns:row>
<tns:cell>Banglore</tns:cell>
<tns:cell>BLR</tns:cell>
</tns:row>
</tns:rows>
</tns:dvm>
If anyone knows please provide solution.
【问题讨论】: