Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

em linha

Home Códigos de fonte E-Livros Downloads Contatar-nos Sobre nós

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


Sintaxe de XPath

Previous Next





Sintaxe de XPath

A língua do trajeto de XML usa uma notação declarativa melhor que processual. Cada expressão tornou-se por esta notação descreve os tipos de nós ao fósforo baseado no relacionamento hierárquico entre os nós. Por exemplo, autor da expressão do “os meios livro/” encontram o elemento do autor contido no elemento do livro.




Exemplo de XML
Um original de XML é dado abaixo.

<?xml version="1.0" encoding="ISO-8859-1"?><bookstore><book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book><book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book></bookstore>




Selecionando nós

Para selecionar expressões do trajeto dos usos de XPath dos nós. O nó é selecionado seguindo um trajeto. As expressões as mais úteis do trajeto são: -


Expression Description
nodename Selects all child nodes of the node
/ Selects from the root node
// Selects nodes in the document from the current node that match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes

Exemplo
Tabela dada abaixo nós alistamos algumas expressões do trajeto e o resultado das expressões:

Path Expression Result
bookstore Selects all the child nodes of the bookstore element
/bookstore Selects the root element bookstore

Note: If the path starts with a slash ( / ) it always represents an absolute path to an element!

bookstore/book Selects all book elements that are children of bookstore
//book Selects all book elements no matter where they are in the document
bookstore//book Selects all book elements that are descendant of the bookstore element, no matter where they are under the bookstore element
//@lang Selects all attributes that are named lang



Predicados

Os predicados são usados encontrar um nó específico que contenha um valor. Os predicados são encaixados sempre nos suportes quadrados.


Exemplo

Tabela dada abaixo nós alistamos algumas expressões do trajeto com predicados e o resultado das expressões:


Path Expression Result
/bookstore/book[1]

Selects the first book element that is the child of the bookstore element

/bookstore/book[last()]

Selects the last book element that is the child of the bookstore element

/bookstore/book[last()-1]

Selects the last but one book element that is the child of the bookstore element

/bookstore/book[position()<3]

Selects the first two book elements that are children of the bookstore element

//title[@lang]

Selects all the title elements that have an attribute named lang

//title[@lang='eng']

Selects all the title elements that have an attribute named lang with a value of 'eng'

/bookstore/book[price>35.00]

Selects all the book elements of the bookstore element that have a price element with a value greater than 35.00

/bookstore/book[price>35.00]/title

Selects all the title elements of the book elements of the bookstore element that have a price element with a value greater than 35.00




Como nós que selecionamos nós desconhecidos?
Os Wildcards podem ser usados selecionar elementos desconhecidos de XML.

Wildcard Description
* Matches any element node
@* Matches any attribute node
node() Matches any node of any kind

Exemplo
Tabela dada abaixo nós alistamos algumas expressões do trajeto e o resultado das expressões:

Path Expression Result
/bookstore/* Selects all the child nodes of the bookstore element
//* Selects all elements in the document
//title[@*] Selects all title elements which have any attribute




Previous Next

Keywords: A sintaxe de XPath, sintaxe da pergunta do xpath, sintaxe do xsl, rede do vb do xpath, sintaxe do xslt, xpath líquido do asp, xpath começa com, sintaxe do xquery, sintaxe líquida do vb, caso insensitive, sintaxe líquida do xpath do asp, referência do xpath, tutorial do xpath, exemplos do xpath, sintaxe do xml, namespace do xpath, expressões do xpath, c# do xpath, namespaces do xpath, xml do xpath, sintaxe do cdata, xpath funciona, xpath do selectsinglenode, exemplo do xpath, sintaxe do c#, xpath do xsl, pergunta do xpath, sintaxe do DTD, atributo do xpath, xpath contem, xslt do xpath, xmlns do xpath, xpath do xquery, expressão do xpath, xpath do Javascript, sorte do xpath, sintaxe do stylesheet, selectnodes do xpath, atributos do xpath, nome do xpath, perguntas do xpath, xpath dom4j, sintaxe do xhtml, HTML do xpath, cdata do xpath, sintaxe do xsd, predicados do xpath, xpath w3c, sintaxe do css, sintaxe do HTML, contagem do xpath, texto do xpath, linha central do xpath, xpath do xmldocument, sintaxe do uri, xpath ou, xpath xalan, sintaxe do Javascript, original do xpath, xpath do jdom, Perl do xpath, posição do xpath, predicado do xpath, substring do xpath, amostra do xpath, xpath sql, sintaxe do namespace, sintaxe dos exemplos, sintaxe do Perl, xpath do msxml


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.