XPath Düğümleri

XPath'te, yedi tür nod vardır: element, özellik, metin, ad alanı, işletim talimatı, yorum ve belge nodu (veya kök nod olarak da adlandırılır).

XPath terimleri

Nod (Node)

XPath'te, yedi tür nod vardır: element, özellik, metin, ad alanı, işletim talimatı, yorum ve belge (kök) nodu. XML belgesi nod ağacı olarak değerlendirilir. Ağacın kökü belge nodu veya kök nod olarak adlandırılır.

Aşağıdaki XML belgesini görün:

<?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>

Yukarıdaki XML belgesindeki nod örnekleri:

<bookstore> (belge nodu)
<author>J K. Rowling</author> (element nodu)
lang="en" (özellik nodu) 

Temel değer (veya atomik değer, Atomic value)

Temel değerler, veya atomik değerler, bir atası veya çocuğu olmayan nodlardır.

Temel değerlerin örneği:

J K. Rowling
"en"

Proje (Item)

Proje temel bir değer veya noddur.

Nod İlişkileri

Ata (Parent)

Her element ve özellik bir atasına sahiptir.

Aşağıdaki örnekte, book elementi title, author, year ve price elementlerinin atasıdır:

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

Çocuk (Children)

Element nodları sıfır, bir veya birden fazla çocuğa sahip olabilir.

Aşağıdaki örnekte, title, author, year ve price elementleri book elementinin çocuklarıdır:

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

Kardeş (Sibling)

Aynı anahtara sahip olan nodlar

Aşağıdaki örnekte, title, author, year ve price elementleri kardeşlerdir:

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

Ata (Ancestor)

Bir节点的父,父的父,等等。

Aşağıdaki örnekte, title elementinin ataları book ve bookstore elementleridir:

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

Soy (Descendant)

Bir节点的子,孙,等等。

Aşağıdaki örnekte, bookstore'nun soyu book, title, author, year ve price elementleridir:

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