XPath
| 패러다임 | 질의어 |
|---|---|
| 개발자 | W3C |
| 발표일 | 1998년 |
| 최근 버전 | 3.1 |
| 최근 버전 출시일 | 2017년 3월 21일 |
| 웹사이트 | www |
| 영향을 받은 언어 | |
| XSLT, XPointer | |
| 영향을 준 언어 | |
| XML 스키마, XForms | |

XPath(XML Path Language)는 W3C의 표준으로 확장 생성 언어 문서의 구조를 통해 경로 위에 지정한 구문을 사용하여 항목을 배치하고 처리하는 방법을 기술하는 언어이다. XML 표현보다 더 쉽고 약어로 되어 있으며, XSL 변환(XSLT)과 XML 지시자 언어(XPointer)에 쓰이는 언어이다. XPath는 XML 문서의 노드를 정의하기 위하여 경로식을 사용하며, 수학 함수와 기타 확장 가능한 표현들이 있다.
예
XML 예제 문서
<?xml version="1.0" encoding="utf-8"?>
<wikimedia>
<projects>
<project name="Wikipedia" launch="2001-01-05">
<editions>
<edition language="English">en.wikipedia.org</edition>
<edition language="German">de.wikipedia.org</edition>
<edition language="French">fr.wikipedia.org</edition>
<edition language="Polish">pl.wikipedia.org</edition>
</editions>
</project>
<project name="Wiktionary" launch="2002-12-12">
<editions>
<edition language="English">en.wiktionary.org</edition>
<edition language="French">fr.wiktionary.org</edition>
<edition language="Vietnamese">vi.wiktionary.org</edition>
<edition language="Turkish">tr.wiktionary.org</edition>
</editions>
</project>
</projects>
</wikimedia>
아래의 XPath 식은
/wikimedia/projects/project/@name
모든 project 요소의 name 속성을 선택하고, 아래의 XPath 식은
/wikimedia/projects/project/editions/edition[@language="English"]/text()
모든 영문 Wikimedia 프로젝트의 주소(language 속성이 English인 모든 edition 요소의 문자열)를 선택하고, 아래의 XPath 식은
/wikimedia/projects/project[@name="Wikipedia"]/editions/edition/text()
모든 위키백과의 주소(Wikipedia의 이름 특성을 가진 project 요소 아래에 존재하는 모든 edition 요소의 문자열)를 선택한다.
같이 보기
외부 링크
- (영어) XPath 1.0 specification
- (영어) XPath 2.0 specification
- (영어) XPath 3.0 specification
- (영어) XPath 3.1 specification
| 이 글은 프로그래밍 언어에 관한 토막글입니다. 여러분의 지식으로 알차게 문서를 완성해 갑시다. |
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.