XPath를 노드
의 XPath 용어
마디
요소, 속성, 텍스트, 공간, 처리 명령, 주석, 문서 (루트) 노드 : XPath에에서, 노드의 7 종류가있다. 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>
<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" (属性节点)
<author>J K. Rowling</author> (元素节点)
lang="en" (属性节点)
기본 값 (또는 원자 값, 원자 값)
기본 값은 아버지 나 자식 노드입니다.
기본 값의 예 :
J K. Rowling
"en"
"en"
항목 (항목)
프로젝트는 기본 값 또는 노드입니다.
노드 관계
부모 (부모)
각 요소와 속성은 부모가 있습니다.
다음 예에서, 책 요소는 부모 제목, 저자, 연도 및 가격 요소는 다음과 같습니다
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
아동 (어린이)
요소 노드는 0, 1 또는 그 이상의 아이를 가질 수 있습니다.
다음 예에서,,, 연식, 가격 요소는 책 요소의 모든 아이들은 저자 제목입니다 :
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
동포 (형제 자매)
동일한 부모 노드를 갖는다
다음 예에서, 제목, 저자, 연도 및 가격 요소 형제는 다음과 같습니다
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
조상 (조상)
다음은 노드의 부모, 부모의 부모 등.
다음의 예에서, 타이틀 엘리먼트의 조상 책 소자와 서점 요소이다 :
<bookstore>
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
자손 (후손)
그래서 노드, 서브 서브, 그리고 아이입니다.
다음 예에서, 서점의 자손은 책 제목, 저자, 연도 및 가격 요소입니다 :
<bookstore>
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>
<book>
<title>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>