請問一下,fn:doc("depts.xml")/depts/deptno中的fn:doc要如何解釋?
請問一下,fn:doc("depts.xml")/depts/deptno中的fn:doc要如何解釋?我不懂這個的意思
可以幫一下忙嗎?
謝謝... [b] [url=http://bbs.ecstart.com/redirect.php?goto=findpost&pid=95311&ptid=33629]3#[/url] [i]william761222[/i] [/b]
這是 xQuery 的函式 .
簡單的說就是它會傳回 depts.xml 檔內容 然後 /depts/deptno 就是抓取到 這個節點下 .
1.
fn:doc($uri as xs:string?) as document-node()?
[url]http://www.w3.org/TR/xpath-functions/#func-doc[/url]
2.
[url]http://www.w3.org/TR/xquery-semantics/#sec_fn_doc_collection[/url] 嗯!
感謝你
我還有一個問題想請教你...
例如以下的範例:
for $d in fn:doc("depts.xml")/depts/deptno
let $e := fn:doc("emps.xml")/emps/emp[deptno = $d]
where fn:count($e) >= 10
order by fn:avg($e/salary) descending
return $d
/emps/emp[deptno = $d]
這路徑後面接的這個[deptno = $d]是什麼意思?
還有 := 和=的差別?
另一個範例:
for $b in doc("auction.xml")//person
where $b/@id='person()'
return $b/name/text()
我想知道text()和@id='person()'分別代表的是什麼意思?
麻煩你幫我解答
謝謝! [quote]嗯!
感謝你
我還有一個問題想請教你...
例如以下的範例:
for $d in fn:doc("depts.xml")/depts/deptno
let $e := fn:doc("emps.xml")/emps/emp[deptno = $d]
where fn:count($e) >= 10
order by fn:avg($e/ ...
[size=2][color=#999999]william761222 發表於 2009-5-21 16:49[/color] [url=http://bbs.ecstart.com/redirect.php?goto=findpost&pid=95508&ptid=33629][img]http://bbs.ecstart.com/images/common/back.gif[/img][/url][/size][/quote]
1. 這是XPATH 的語法, 意思是它要抓取這個節點下的 deptno ELEMENT 的內容 .
2.
text() <<== 沒看過? 我猜應該是你的LANGUAGE 上的語法 .
@id << 就是 ELEMENT 上的 ATTRIBUTE .
person() << 指的是 第 N 個 ELEMENT 的 ITEM
例如 :
<test>
<item id='1'>1</item>
<item id='2'>2</item>
</test>
/test/item[@id = '2'] ==> 2
/test/item[position()='1'] ==> 1 您好
關於這個fn的問題
我還不是很了解
我想知道有fn和沒fn的差別在哪裡?
那他的作用是什麼? .....
fn 是告訴你它是 function 而已..
實際使用是要跟 xpath 或是 xquery 等一起使用....
你可以多參考範例..或是參考使用手冊..
語法的東西只要願意都查的到 .
我想 google 應該比我利害... 問 google 吧 ^^ .
頁:
[1]