SlideShare una empresa de Scribd logo
1 de 27
XPath - XML Path Language  XML http://yht4ever.blogspot.com [email_address] B070066 - NIIT Quang Trung 08/2007
Contents Exercises Node-set Operators and Functions Location Paths Nodes Introduction
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Nodes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Simple XML document  1 <?xml version =  &quot;1.0&quot; ?> 2 3 <!-- simple.xml --> 4 <!-- Simple XML document  --> 5 6 <book title =  “C++ How to Program&quot;   edition =  &quot;3&quot; > 7 8   <sample> 9   <![CDATA[ 10   11   // C++ comment 12   if ( this->getX() < 5 && value[ 0 ] != 3 ) 13   cerr << this->displayError(); 14   ]]> 15   </sample> 16   17   C++ How to Program by Deitel &amp; Deitel 18 </book> Root node Comment nodes Attribute nodes Element nodes Text nodes
XPath tree for simple.xml Attribute Title C++ How to Program Element book Comment Fig. 11.1 : simple.xml Comment Simple XML document Attribute edition 3 Root Text C++ How to Program by Deitel & Deitel Element sample Text // C++ comment  if (this -> getX() < 5 && value[ 0 ] != 3 )    cerr << this->displayError();
XML document with processing-instruction and namespace nodes 1 <?xml version =  &quot;1.0&quot; ?> 2 3 <!-- Fig. 11.3 : simple2.xml  --> 4 <!-- Processing instructions and namespacess  --> 5 6 <html xmlns =  &quot;http://www.w3.org/TR/REC-html40&quot; > 7 8   <head> 9   <title> Processing Instruction and Namespace Nodes </title> 10   </head> 11 12   <?deitelprocessor example =  &quot;fig11_03.xml&quot; ?> 13 14   <body> 15 16   <deitel:book deitel:edition =  &quot;1&quot;   17   xmlns:deitel =  &quot;http://www.deitel.com/xmlhtp1&quot; > 18   <deitel:title> XML How to Program </deitel:title> 19   </deitel:book> 20 21   </body> 22 23 </html> Root node Comment nodes Namespace nodes Processing instruction node Element nodes Text nodes Attribute nodes
Tree diagram of an XML document with a processing-instruction node Continued on next slide ... Root Comment Fig. 11.3 : simple2.xml Comment Processing instructions and namespaces Element html Namespace http://www.w3.org/TR/REC-html40 Element head Text Processing instructions and Namespcae Nodes Element title
Tree diagram of an XML document with a processing-instruction node Continued from previous slide Processing Instruction deitelprocessor example =  &quot; fig11_03.xml &quot; Element body Element book Attribute edition 1 Namespace http://www.deitel.com/xmlhtp1 Element title Text XML How to Program
XPath node types
XPath node types (cont.)
Location Paths ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Axes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
XPath axes
Node Tests ,[object Object],[object Object],[object Object],[object Object]
Some XPath node tests
Location Paths Using Axes and Node Tests ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Some location-path abbreviations
Node-set Operators and Functions ,[object Object],[object Object],[object Object],[object Object]
Node-set operators
Some node-set functions
Node-set Operators and Functions (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1 <?xml version =  &quot;1.0&quot; ?> 2 3 <!-- Fig. 11.13 : stocks.xml --> 4 <!-- Stock list  --> 5 6 <stocks> 7 8   <stock symbol =  &quot;INTC&quot; > 9   <name> Intel Corporation </name> 10   </stock> 11 12   <stock symbol =  &quot;CSCO&quot; > 13   <name> Cisco Systems, Inc. </name> 14   </stock> 15 16   <stock symbol =  &quot;DELL&quot; > 17   <name> Dell Computer Corporation </name> 18   </stock> 19 20   <stock symbol =  &quot;MSFT&quot; > 21   <name> Microsoft Corporation </name> 22   </stock> 23 24   <stock symbol =  &quot;SUNW&quot; > 25   <name> Sun Microsystems, Inc. </name> 26   </stock> 27 28   <stock symbol =   &quot;CMGI&quot; > 29   <name> CMGI, Inc. </name> 30   </stock> 31 32 </stocks>
1 <?xml version =  &quot;1.0&quot; ?> 2 3 <!-- Fig. 11.14 : stocks.xsl --> 4 <!-- string function usage  --> 5 6 <xsl:stylesheet version =  &quot;1.0&quot; 7   xmlns:xsl =  &quot;http://www.w3.org/1999/XSL/Transform&quot; > 8 9   <xsl:template match =  &quot;/stocks&quot; > 10   <html> 11   <body> 12   <ul> 13 14   <xsl:for-each select =  &quot;stock&quot; > 15 16   <xsl:if test =  17   &quot;starts-with(@symbol, 'C')&quot; > 18 19   <li> 20   <xsl:value-of select =  21   &quot;concat(@symbol,' - ', name)&quot; /> 22   </li> 23   </xsl:if> 24 25   </xsl:for-each> 26   </ul> 27   </body> 28   </html> 29   </xsl:template> 30 </xsl:stylesheet> XPath string functions
Reference ,[object Object],[object Object],[object Object]
Q&A ,[object Object],[object Object]
http://yht4ever.blogspot.com Thank You !

Más contenido relacionado

La actualidad más candente

Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Noa Harel
 
Client side scripting using Javascript
Client side scripting using JavascriptClient side scripting using Javascript
Client side scripting using JavascriptBansari Shah
 
Linux command ppt
Linux command pptLinux command ppt
Linux command pptkalyanineve
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5IT Geeks
 
NETWORK FILE SYSTEM
NETWORK FILE SYSTEMNETWORK FILE SYSTEM
NETWORK FILE SYSTEMRoshan Kumar
 
4 internet programming
4 internet programming4 internet programming
4 internet programmingsoner_kavlak
 
Network Monitoring Basics
Network Monitoring BasicsNetwork Monitoring Basics
Network Monitoring BasicsRob Dunn
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS Dave Kelly
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linuxVicent Selfa
 
2-dars. HTML hujjat strukturasi.pptx
2-dars. HTML hujjat strukturasi.pptx2-dars. HTML hujjat strukturasi.pptx
2-dars. HTML hujjat strukturasi.pptxMuhriddin Fayziyev
 

La actualidad más candente (20)

Beautiful soup
Beautiful soupBeautiful soup
Beautiful soup
 
Java script array
Java script arrayJava script array
Java script array
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Client side scripting using Javascript
Client side scripting using JavascriptClient side scripting using Javascript
Client side scripting using Javascript
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Client side scripting
Client side scriptingClient side scripting
Client side scripting
 
NETWORK FILE SYSTEM
NETWORK FILE SYSTEMNETWORK FILE SYSTEM
NETWORK FILE SYSTEM
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
4 internet programming
4 internet programming4 internet programming
4 internet programming
 
HTML5 & CSS3
HTML5 & CSS3 HTML5 & CSS3
HTML5 & CSS3
 
Network Monitoring Basics
Network Monitoring BasicsNetwork Monitoring Basics
Network Monitoring Basics
 
(Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS (Fast) Introduction to HTML & CSS
(Fast) Introduction to HTML & CSS
 
Kali linux commands
Kali linux commandsKali linux commands
Kali linux commands
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linux
 
Ftp server
Ftp serverFtp server
Ftp server
 
2-dars. HTML hujjat strukturasi.pptx
2-dars. HTML hujjat strukturasi.pptx2-dars. HTML hujjat strukturasi.pptx
2-dars. HTML hujjat strukturasi.pptx
 
Xml
XmlXml
Xml
 
Css tables
Css tablesCss tables
Css tables
 

Destacado

Destacado (20)

XML
XMLXML
XML
 
XMPP - Introduction And LAS Implementation (Presentation)
XMPP - Introduction And LAS  Implementation (Presentation)XMPP - Introduction And LAS  Implementation (Presentation)
XMPP - Introduction And LAS Implementation (Presentation)
 
Introduction
IntroductionIntroduction
Introduction
 
IEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easy
IEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easyIEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easy
IEEE 2014 JAVA DATA MINING PROJECTS Xs path navigation on xml schemas made easy
 
eXtensible Markup Language
eXtensible Markup LanguageeXtensible Markup Language
eXtensible Markup Language
 
Xs path navigation on xml schemas made easy
Xs path navigation on xml schemas made easy Xs path navigation on xml schemas made easy
Xs path navigation on xml schemas made easy
 
XML and XPath details
XML and XPath detailsXML and XPath details
XML and XPath details
 
Introduction to XPath
Introduction to XPathIntroduction to XPath
Introduction to XPath
 
Understanding XML DOM
Understanding XML DOMUnderstanding XML DOM
Understanding XML DOM
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
XSLT
XSLTXSLT
XSLT
 
Overview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FOOverview of XSL, XPath and XSL-FO
Overview of XSL, XPath and XSL-FO
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Xml dom
Xml domXml dom
Xml dom
 
Web Scraping for Code-ophobes
Web Scraping for Code-ophobesWeb Scraping for Code-ophobes
Web Scraping for Code-ophobes
 
XSLT
XSLTXSLT
XSLT
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
SEO Hacks & Apps
SEO Hacks & AppsSEO Hacks & Apps
SEO Hacks & Apps
 
Querying XML: XPath and XQuery
Querying XML: XPath and XQueryQuerying XML: XPath and XQuery
Querying XML: XPath and XQuery
 

Similar a XPath - XML Path Language

Similar a XPath - XML Path Language (20)

Processing XML with Java
Processing XML with JavaProcessing XML with Java
Processing XML with Java
 
6 311 W
6 311 W6 311 W
6 311 W
 
test
testtest
test
 
6 311 W
6 311 W6 311 W
6 311 W
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
 
Struts2
Struts2Struts2
Struts2
 
Sax Dom Tutorial
Sax Dom TutorialSax Dom Tutorial
Sax Dom Tutorial
 
Csphtp1 18
Csphtp1 18Csphtp1 18
Csphtp1 18
 
Xml
XmlXml
Xml
 
Relax NG, a Schema Language for XML
Relax NG, a Schema Language for XMLRelax NG, a Schema Language for XML
Relax NG, a Schema Language for XML
 
Lotusphere 2006 AD212 Introduction to DXL
Lotusphere 2006 AD212 Introduction to DXLLotusphere 2006 AD212 Introduction to DXL
Lotusphere 2006 AD212 Introduction to DXL
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
Xml and Co.
Xml and Co.Xml and Co.
Xml and Co.
 
Wso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1stWso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1st
 
AdvancedXPath
AdvancedXPathAdvancedXPath
AdvancedXPath
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
Unit 5 xml (1)
Unit 5   xml (1)Unit 5   xml (1)
Unit 5 xml (1)
 
Xml session
Xml sessionXml session
Xml session
 

Más de yht4ever

Applications of SOA and Web Services in Grid Computing
Applications of SOA and Web Services in Grid ComputingApplications of SOA and Web Services in Grid Computing
Applications of SOA and Web Services in Grid Computingyht4ever
 
ERD - Database Design
ERD - Database DesignERD - Database Design
ERD - Database Designyht4ever
 
Web Page Authoring 1
Web Page Authoring 1Web Page Authoring 1
Web Page Authoring 1yht4ever
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTMLyht4ever
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTMLyht4ever
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Modelyht4ever
 
Rendering XML Document
Rendering XML DocumentRendering XML Document
Rendering XML Documentyht4ever
 
Rendering XML Documents
Rendering XML DocumentsRendering XML Documents
Rendering XML Documentsyht4ever
 
XML Schema
XML SchemaXML Schema
XML Schemayht4ever
 
Document Type Definition
Document Type DefinitionDocument Type Definition
Document Type Definitionyht4ever
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XMLyht4ever
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Javayht4ever
 

Más de yht4ever (12)

Applications of SOA and Web Services in Grid Computing
Applications of SOA and Web Services in Grid ComputingApplications of SOA and Web Services in Grid Computing
Applications of SOA and Web Services in Grid Computing
 
ERD - Database Design
ERD - Database DesignERD - Database Design
ERD - Database Design
 
Web Page Authoring 1
Web Page Authoring 1Web Page Authoring 1
Web Page Authoring 1
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Rendering XML Document
Rendering XML DocumentRendering XML Document
Rendering XML Document
 
Rendering XML Documents
Rendering XML DocumentsRendering XML Documents
Rendering XML Documents
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Document Type Definition
Document Type DefinitionDocument Type Definition
Document Type Definition
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
GUI Programming In Java
GUI Programming In JavaGUI Programming In Java
GUI Programming In Java
 

Último

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

XPath - XML Path Language

  • 1. XPath - XML Path Language XML http://yht4ever.blogspot.com [email_address] B070066 - NIIT Quang Trung 08/2007
  • 2. Contents Exercises Node-set Operators and Functions Location Paths Nodes Introduction
  • 3.
  • 4.
  • 5. Simple XML document 1 <?xml version = &quot;1.0&quot; ?> 2 3 <!-- simple.xml --> 4 <!-- Simple XML document --> 5 6 <book title = “C++ How to Program&quot; edition = &quot;3&quot; > 7 8 <sample> 9 <![CDATA[ 10 11 // C++ comment 12 if ( this->getX() < 5 && value[ 0 ] != 3 ) 13 cerr << this->displayError(); 14 ]]> 15 </sample> 16 17 C++ How to Program by Deitel &amp; Deitel 18 </book> Root node Comment nodes Attribute nodes Element nodes Text nodes
  • 6. XPath tree for simple.xml Attribute Title C++ How to Program Element book Comment Fig. 11.1 : simple.xml Comment Simple XML document Attribute edition 3 Root Text C++ How to Program by Deitel & Deitel Element sample Text // C++ comment if (this -> getX() < 5 && value[ 0 ] != 3 ) cerr << this->displayError();
  • 7. XML document with processing-instruction and namespace nodes 1 <?xml version = &quot;1.0&quot; ?> 2 3 <!-- Fig. 11.3 : simple2.xml --> 4 <!-- Processing instructions and namespacess --> 5 6 <html xmlns = &quot;http://www.w3.org/TR/REC-html40&quot; > 7 8 <head> 9 <title> Processing Instruction and Namespace Nodes </title> 10 </head> 11 12 <?deitelprocessor example = &quot;fig11_03.xml&quot; ?> 13 14 <body> 15 16 <deitel:book deitel:edition = &quot;1&quot; 17 xmlns:deitel = &quot;http://www.deitel.com/xmlhtp1&quot; > 18 <deitel:title> XML How to Program </deitel:title> 19 </deitel:book> 20 21 </body> 22 23 </html> Root node Comment nodes Namespace nodes Processing instruction node Element nodes Text nodes Attribute nodes
  • 8. Tree diagram of an XML document with a processing-instruction node Continued on next slide ... Root Comment Fig. 11.3 : simple2.xml Comment Processing instructions and namespaces Element html Namespace http://www.w3.org/TR/REC-html40 Element head Text Processing instructions and Namespcae Nodes Element title
  • 9. Tree diagram of an XML document with a processing-instruction node Continued from previous slide Processing Instruction deitelprocessor example = &quot; fig11_03.xml &quot; Element body Element book Attribute edition 1 Namespace http://www.deitel.com/xmlhtp1 Element title Text XML How to Program
  • 11. XPath node types (cont.)
  • 12.
  • 13.
  • 15.
  • 17.
  • 19.
  • 22.
  • 23. 1 <?xml version = &quot;1.0&quot; ?> 2 3 <!-- Fig. 11.13 : stocks.xml --> 4 <!-- Stock list --> 5 6 <stocks> 7 8 <stock symbol = &quot;INTC&quot; > 9 <name> Intel Corporation </name> 10 </stock> 11 12 <stock symbol = &quot;CSCO&quot; > 13 <name> Cisco Systems, Inc. </name> 14 </stock> 15 16 <stock symbol = &quot;DELL&quot; > 17 <name> Dell Computer Corporation </name> 18 </stock> 19 20 <stock symbol = &quot;MSFT&quot; > 21 <name> Microsoft Corporation </name> 22 </stock> 23 24 <stock symbol = &quot;SUNW&quot; > 25 <name> Sun Microsystems, Inc. </name> 26 </stock> 27 28 <stock symbol = &quot;CMGI&quot; > 29 <name> CMGI, Inc. </name> 30 </stock> 31 32 </stocks>
  • 24. 1 <?xml version = &quot;1.0&quot; ?> 2 3 <!-- Fig. 11.14 : stocks.xsl --> 4 <!-- string function usage --> 5 6 <xsl:stylesheet version = &quot;1.0&quot; 7 xmlns:xsl = &quot;http://www.w3.org/1999/XSL/Transform&quot; > 8 9 <xsl:template match = &quot;/stocks&quot; > 10 <html> 11 <body> 12 <ul> 13 14 <xsl:for-each select = &quot;stock&quot; > 15 16 <xsl:if test = 17 &quot;starts-with(@symbol, 'C')&quot; > 18 19 <li> 20 <xsl:value-of select = 21 &quot;concat(@symbol,' - ', name)&quot; /> 22 </li> 23 </xsl:if> 24 25 </xsl:for-each> 26 </ul> 27 </body> 28 </html> 29 </xsl:template> 30 </xsl:stylesheet> XPath string functions
  • 25.
  • 26.