XQuery 용어

XQuery에서는 일곱 가지 노드가 있습니다: 요소, 속성, 텍스트, 이름 공간, 처리 지시, 주석, 그리고 문서 노드 (또는 루트 노드).

XQuery 용어

노드

XQuery에서는 일곱 가지 노드가 있습니다: 요소, 속성, 텍스트, 이름 공간, 처리 지시, 주석, 그리고 문서 (루트) 노드. XML 문서는 노드 트리로 대응됩니다. 트리의 루트는 문서 노드 또는 루트 노드라고 합니다.

아래의 XML 문서를 보세요:

<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
  <title lang="en">Harry Potter</title>
  <author>J K. Rowling</author> 
  <year>2005</year>
  <price>29.99</price>
</book>
</bookstore>

위의 XML 문서에서의 노드 예제:

<bookstore>  (문서 노드)
<author>J K. Rowling</author>  (요소 노드)
lang="en"  (속성 노드)

기본 값 (또는 원자 값, Atomic value)

기본 값은 부모가 없거나 자식이 없는 노드입니다.

기본 값의 예제:

J K. Rowling
"en"

项目

项目是基本值或者节点。

"en"

항목(Item)

항목은 기본 값이나 노드입니다.

노드 관계

<book>
  <title>Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>

부모(Parent)

요소 및 속성은 부모가 하나만 있을 수 있습니다.

아래의 예제에서 title, author, year 및 price 요소는 book 요소의 자식입니다:

<book>
  <title>Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>

형제(Sibling)

같은 부모를 가진 노드.

아래의 예제에서 title, author, year 및 price 요소는 형제입니다:

<book>
  <title>Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>

조상(Ancestor)

어떤 노드의 부모, 부모의 부모 등.

아래의 예제에서 title 요소의 조상은 book 요소와 bookstore 요소입니다:

<bookstore>
<book>
  <title>Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>
</bookstore>

자식(Descendant)

어떤 노드의 자식, 자식의 자식 등.

아래의 예제에서 bookstore의 자식은 book, title, author, year 및 price 요소입니다:

<bookstore>
<book>
  <title>Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>
</bookstore>