这适用于 Java 中使用的 XQuery。我的代码正在处理其他 XML 文件,但这次它没有返回所需的数据。错误代码如下。它有什么问题?谢谢。
String queryString =
"declare variable $docName as xs:string external;" + sep +
" for $TRACK in doc($docName)/playlist/tracklist/track " +
" return " +
" <track><title>{$TRACK/title/text()}</title>" +
" <location>{$TRACK/location/text()}</location></track>";
这是目标 XML:
<?xml version="1.0"?>
-<playlist xmlns="http://xspf.org/ns/0/" version="1">
-<trackList>-<track><location>http://radiotool.com/242.mp3</location><title>New York</title></track>
-<track><location>http://radiotool.com/243.mp3</location> <title>Chicago Repeater</title></track>
</trackList></playlist>