SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Developing Applications Using JAXP


Pre-assessment Questions
    1. ______________ allow integration of applications developed in different
       languages and running on different platforms.
       a. JSP applications
       b. Web services
       c. Servlet applications
       d. XML applications

    2. ______________ is responsible for providing the software components that are
       published as Web services.
       a. Service registry
       b. Service client
       c. Service provider
       d. Service broker



 ©NIIT                   XML and Web Services               Lesson 1B / Slide 1 of 23
Developing Applications Using JAXP


Pre-assessment Questions (Contd.)
    3. Web services are published to ______________.
       a. Service registry
       b. Service broker
       c. Service client
       d. Service provider

    4. ___________ protocol enables communication between the Web services and
       its clients.
       a. SOAP
       b. WSDL
       c. UDDI
       d. XML




 ©NIIT                  XML and Web Services            Lesson 1B / Slide 2 of 23
Developing Applications Using JAXP


Pre-assessment Questions (Contd.)

    5. ___________ standard describes a Web service that is published in a service
       registry.
       a. SOAP
       b. WSDL
       c. UDDI
       d. XML




 ©NIIT                   XML and Web Services              Lesson 1B / Slide 3 of 23
Developing Applications Using JAXP


Solutions to Pre-assessment
Questions (Contd.)

    1.   b. Web services
    2.   c. Service provider
    3.   a. Service registry
    4.   a. SOAP
    5.   b. WSDL




 ©NIIT                     XML and Web Services   Lesson 1B / Slide 4 of 23
Developing Applications Using JAXP


Objectives
    In this lesson, you will learn about:


         •   Document-Oriented JAXP APIs
         •   Creating applications using SAX, DOM, and XSLT API




 ©NIIT                    XML and Web Services             Lesson 1B / Slide 5 of 23
Developing Applications Using JAXP


JAXP APIs

    •    JAXP is a collection of APIs that you can use in your Java applications to
         process and translate XML documents. JAXP consists of three APIs:


          •   Simple API for XML (SAX): Allows you to use a SAX parser to process the
              XML documents serially.
          •   Document Object Model (DOM): Allows you to use a DOM parser to
              process the XML documents in an object-oriented manner.
          •   XML Stylesheet Language for Transformation (XSLT): Allows you to
              transform XML documents in other formats, such as HyperText Markup
              Language (HTML).




 ©NIIT                      XML and Web Services                Lesson 1B / Slide 6 of 23
Developing Applications Using JAXP


Using SAX API
    •    The working of SAX includes:


          •   SAX uses various classes and interfaces that are defined in the SAX API to
              process XML document in the form of a stream of data.
          •   The SAX parser also notifies your application each time it recognizes any
              syntax constructs in the XML document. The following figure shows the
              working of the SAX:




 ©NIIT                      XML and Web Services               Lesson 1B / Slide 7 of 23
Developing Applications Using JAXP


Using SAX API (Contd.)
    •    SAX API Packages are:

          •   org.xml.sax
          •   org.xml.sax.ext
          •   org.xml.sax.helpers
          •   javax.xml.parsers


    •    The steps to parse an XML document are:


          •   Import the required packages
          •   Extend the DefaultHandler Interface
          •   Parse the XML Document
          •   Override the call back methods



 ©NIIT                     XML and Web Services     Lesson 1B / Slide 8 of 23
Developing Applications Using JAXP


Demonstration-Parsing XML
  Document Using SAX API
    •    Problem Statement


         •   ABC Books has implemented a Web service that allows them to
             perform online trading of books. Information of books is
             exchanged between the organization and their clients as XML
             documents. Larry Williams, manager of ABC Books, needs to
             process these XML documents before sending them to the
             clients. Larry instructs Don Allen, the software engineer to
             develop a Java application that will process the XML documents.
             Don Allen decides to process the XML documents using SAX API.




 ©NIIT                 XML and Web Services           Lesson 1B / Slide 9 of 23
Developing Applications Using JAXP


Demonstration-Parsing XML
  Document Using SAX API(Contd.)
    •    Solution

         1.   Create an XML document that needs to be parsed.
         2.   Develop the Java class to parse the XML document and display
              its contents.
         3.   Compile and run the application.




 ©NIIT                  XML and Web Services         Lesson 1B / Slide 10 of 23
Developing Applications Using JAXP

Using DOM API
    •    The working of DOM includes:


         •   DOM uses various classes and interfaces that are defined in the DOM
             API to process XML document in the form a tree structure, known as
             DOM tree.
         •   DOM tree consists of nodes, where each node represents a component
             of the XML document. Different types of nodes supported by DOM API
             are:


             •    Element node
             •    Text node
             •    Attribute node




 ©NIIT                  XML and Web Services            Lesson 1B / Slide 11 of 23
Developing Applications Using JAXP

Using DOM API (Contd.)
    •    The following figure shows the working of DOM API:




 ©NIIT                   XML and Web Services            Lesson 1B / Slide 12 of 23
Developing Applications Using JAXP

Using DOM API (Contd.)
    •    DOM API Packages are:

         •   org.w3c.dom
         •   javax.xml.parsers


    •    The steps to parse and display XML document using DOM are:


         •   Import the DOM API related classes
         •   Parse the XML document
         •   Identify the various types of DOM nodes




 ©NIIT                  XML and Web Services            Lesson 1B / Slide 13 of 23
Developing Applications Using JAXP

Demonstration-Parsing XML
  Document Using DOM API
    •    Problem Statement


         •   New Tech Books has implemented a Web service that allows
             online trading of books. Information of books is exchanged
             between the organization and their clients as XML documents.
             Ronald Billing, manager of New Tech Books instructs Jerry
             Smith, the software engineer to develop a Java application that
             can parse the XML documents and display the elements of the
             XML document and their contents. Jerry Smith decides to parse
             the XML documents using DOM API.




 ©NIIT                 XML and Web Services          Lesson 1B / Slide 14 of 23
Developing Applications Using JAXP

Demonstration-Parsing XML
  Document Using DOM API (Contd.)
    •    Solution

         1.   Write Java code that imports the various DOM related classes. In
              addition, the code should also identify the various types of
              nodes present in the XML file.
         2.   Compile and run the DOM application.




 ©NIIT                  XML and Web Services          Lesson 1B / Slide 15 of 23
Developing Applications Using JAXP

Using XSLT API

    •    Working of XSLT: To transform an XML document into other format such as
         HTML. XSLT API needs three components:


         •   An instance of the TransformerFactory
         •   An instance of the Transformer
         •   The predefined transformation instructions




 ©NIIT                  XML and Web Services              Lesson 1B / Slide 16 of 23
Developing Applications Using JAXP

Using XSLT API (Contd.)
    •    The following figure shows the working of the XSLT API:




 ©NIIT                   XML and Web Services             Lesson 1B / Slide 17 of 23
Developing Applications Using JAXP

Using XSLT API (Contd.)
    •    The various packages of XSLT API are:

         •   javax.xml.transform
         •   javax.xml.transform.dom
         •   javax.xml.transform.sax
         •   javax.xml.transform.stream


    •    The steps to transforming an XML document are:


         •   Create a Stylesheet
         •   Create a Java class to transform an XML document




 ©NIIT                   XML and Web Services             Lesson 1B / Slide 18 of 23
Developing Applications Using JAXP

Demonstration-Parsing XML
  Document Using XSLT API
    •    Problem Statement


         •   New Tech Books has a Web service that allows online trading of
             books. Information of books is exchanged between the
             organization and their clients as XML documents. Tom Wilkins,
             manager of New Tech Books, needs to view these XML files in
             the HTML format. Tom instructs Jerry Smith, the software
             engineer to develop a Java application that can transform the
             XML documents in the HTML format. Jerry Smith decides to
             transform the XML documents using XSLT API.




 ©NIIT                 XML and Web Services         Lesson 1B / Slide 19 of 23
Developing Applications Using JAXP

Demonstration-Parsing XML
  Document Using XSLT API (Contd.)
    •    Solution

         •   Create an XSL file for the corresponding XML file.
         •   Writing the Java code that imports the various transformation
             related classes.
         •   Compile and run the XSLT application.




 ©NIIT                 XML and Web Services          Lesson 1B / Slide 20 of 23
Developing Applications Using JAXP


Summary
    In this lesson, you learned that:
         • JAXP is the Java API for processing XML documents.
         • JAXP API consists of three APIs
               • The SAX API
               • The DOM API
               • The XSLT API
         • You use the SAX and DOM APIs to parse various XML documents.
         • You use the XSLT API to transform various input source documents into
               different types of output result documents, such as HTML, XHTML, and
               WML.




 ©NIIT                   XML and Web Services             Lesson 1B / Slide 21 of 23
Developing Applications Using JAXP


Summary (Contd.)
    •    Various packages that JAXP provides to parse and transform XML documents
         are:
         • org.xml.sax
         • org.xml.sax.ext
         • org.xml.sax.helpers
         • javax.xml.parser
         • org.w3c.dom
         • javax.xml.transform
         • javax.xml.transform.dom
         • javax.xml.transform.sax
         • javax.xml.transform.stream




 ©NIIT                  XML and Web Services            Lesson 1B / Slide 22 of 23
Developing Applications Using JAXP


Summary (Contd.)
    •    Various types of interfaces that the SAX parser uses to parse an XML
         document are:
         • ContentHandler
         • ErrorHandler
         • DTDHandler
         • EntityHandler




 ©NIIT                   XML and Web Services              Lesson 1B / Slide 23 of 23

Weitere ähnliche Inhalte

Was ist angesagt?

LDAP Synchronization Connector presentation at LDAPCon 2009
LDAP Synchronization Connector presentation at LDAPCon 2009LDAP Synchronization Connector presentation at LDAPCon 2009
LDAP Synchronization Connector presentation at LDAPCon 2009
Jonathan Clarke
 
Data exchange between flex and java script, 2007
Data exchange between flex and java script, 2007Data exchange between flex and java script, 2007
Data exchange between flex and java script, 2007
Evgenios Skitsanos
 

Was ist angesagt? (18)

LDAP Synchronization Connector presentation at LDAPCon 2009
LDAP Synchronization Connector presentation at LDAPCon 2009LDAP Synchronization Connector presentation at LDAPCon 2009
LDAP Synchronization Connector presentation at LDAPCon 2009
 
The lazy administrator, how to make your life easier by using tdi to automate...
The lazy administrator, how to make your life easier by using tdi to automate...The lazy administrator, how to make your life easier by using tdi to automate...
The lazy administrator, how to make your life easier by using tdi to automate...
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
 
A sane approach to microservices
A sane approach to microservicesA sane approach to microservices
A sane approach to microservices
 
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
 
Ajax Zf
Ajax ZfAjax Zf
Ajax Zf
 
AJAX the Great: The Origin and Development of the Dynamic Web (2007)
AJAX the Great: The Origin and Development of the Dynamic Web (2007)AJAX the Great: The Origin and Development of the Dynamic Web (2007)
AJAX the Great: The Origin and Development of the Dynamic Web (2007)
 
Data exchange between flex and java script, 2007
Data exchange between flex and java script, 2007Data exchange between flex and java script, 2007
Data exchange between flex and java script, 2007
 
RESTful services on IBM Domino/XWork (ICON UK 21-22 Sept. 2015)
RESTful services on IBM Domino/XWork (ICON UK 21-22 Sept. 2015)RESTful services on IBM Domino/XWork (ICON UK 21-22 Sept. 2015)
RESTful services on IBM Domino/XWork (ICON UK 21-22 Sept. 2015)
 
Project First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be usedProject First presentation about introduction to technologies to be used
Project First presentation about introduction to technologies to be used
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
 
Utilizing JSF Front Ends with Microservices
Utilizing JSF Front Ends with MicroservicesUtilizing JSF Front Ends with Microservices
Utilizing JSF Front Ends with Microservices
 
GraphQL 101
GraphQL 101GraphQL 101
GraphQL 101
 
Best DotNet Training in Delhi
Best   DotNet Training  in DelhiBest   DotNet Training  in Delhi
Best DotNet Training in Delhi
 
3 jdbc api
3 jdbc api3 jdbc api
3 jdbc api
 
A powerful web application server (intravision IBM Connect 2013 Update) Febru...
A powerful web application server (intravision IBM Connect 2013 Update) Febru...A powerful web application server (intravision IBM Connect 2013 Update) Febru...
A powerful web application server (intravision IBM Connect 2013 Update) Febru...
 
OUGF OSGi/Flex
OUGF OSGi/FlexOUGF OSGi/Flex
OUGF OSGi/Flex
 

Andere mochten auch (9)

Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Up to Speed on HTML 5 and CSS 3
Up to Speed on HTML 5 and CSS 3Up to Speed on HTML 5 and CSS 3
Up to Speed on HTML 5 and CSS 3
 
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 

Ähnlich wie Deawsj 7 ppt-1_b

Deawsj 7 ppt-2_c
Deawsj 7 ppt-2_cDeawsj 7 ppt-2_c
Deawsj 7 ppt-2_c
Niit Care
 
Deawsj 7 ppt-1_a
Deawsj 7 ppt-1_aDeawsj 7 ppt-1_a
Deawsj 7 ppt-1_a
Niit Care
 
Deawsj 7 ppt-1_c
Deawsj 7 ppt-1_cDeawsj 7 ppt-1_c
Deawsj 7 ppt-1_c
Niit Care
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Shyamala Prayaga
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 
Understanding Dom
Understanding DomUnderstanding Dom
Understanding Dom
LiquidHub
 

Ähnlich wie Deawsj 7 ppt-1_b (20)

Deawsj 7 ppt-2_c
Deawsj 7 ppt-2_cDeawsj 7 ppt-2_c
Deawsj 7 ppt-2_c
 
Deawsj 7 ppt-1_a
Deawsj 7 ppt-1_aDeawsj 7 ppt-1_a
Deawsj 7 ppt-1_a
 
Deawsj 7 ppt-1_c
Deawsj 7 ppt-1_cDeawsj 7 ppt-1_c
Deawsj 7 ppt-1_c
 
Java script
Java scriptJava script
Java script
 
Linq To XML Overview
Linq To XML OverviewLinq To XML Overview
Linq To XML Overview
 
SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule Esb
 
Flex Rails Pres
Flex Rails PresFlex Rails Pres
Flex Rails Pres
 
Chapter 12:Understanding Server-Side Technologies
Chapter 12:Understanding Server-Side TechnologiesChapter 12:Understanding Server-Side Technologies
Chapter 12:Understanding Server-Side Technologies
 
Ajax
AjaxAjax
Ajax
 
Intorduction to struts
Intorduction to strutsIntorduction to struts
Intorduction to struts
 
XML Pipelines
XML PipelinesXML Pipelines
XML Pipelines
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
 
dot NET Framework
dot NET Frameworkdot NET Framework
dot NET Framework
 
Uses for scripting languages,web scripting in perl
Uses for scripting languages,web scripting in perlUses for scripting languages,web scripting in perl
Uses for scripting languages,web scripting in perl
 
Unit 1-uses for scripting languages,web scripting
Unit 1-uses for scripting languages,web scriptingUnit 1-uses for scripting languages,web scripting
Unit 1-uses for scripting languages,web scripting
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Understanding Dom
Understanding DomUnderstanding Dom
Understanding Dom
 
Asp net
Asp netAsp net
Asp net
 
VB IMPORTANT QUESTION
VB IMPORTANT QUESTIONVB IMPORTANT QUESTION
VB IMPORTANT QUESTION
 

Mehr von Niit Care (20)

Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 
Dacj 1-2 c
Dacj 1-2 cDacj 1-2 c
Dacj 1-2 c
 
Dacj 1-2 a
Dacj 1-2 aDacj 1-2 a
Dacj 1-2 a
 
Dacj 1-1 c
Dacj 1-1 cDacj 1-1 c
Dacj 1-1 c
 
Dacj 1-1 b
Dacj 1-1 bDacj 1-1 b
Dacj 1-1 b
 
Dacj 1-1 a
Dacj 1-1 aDacj 1-1 a
Dacj 1-1 a
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 

Deawsj 7 ppt-1_b

  • 1. Developing Applications Using JAXP Pre-assessment Questions 1. ______________ allow integration of applications developed in different languages and running on different platforms. a. JSP applications b. Web services c. Servlet applications d. XML applications 2. ______________ is responsible for providing the software components that are published as Web services. a. Service registry b. Service client c. Service provider d. Service broker ©NIIT XML and Web Services Lesson 1B / Slide 1 of 23
  • 2. Developing Applications Using JAXP Pre-assessment Questions (Contd.) 3. Web services are published to ______________. a. Service registry b. Service broker c. Service client d. Service provider 4. ___________ protocol enables communication between the Web services and its clients. a. SOAP b. WSDL c. UDDI d. XML ©NIIT XML and Web Services Lesson 1B / Slide 2 of 23
  • 3. Developing Applications Using JAXP Pre-assessment Questions (Contd.) 5. ___________ standard describes a Web service that is published in a service registry. a. SOAP b. WSDL c. UDDI d. XML ©NIIT XML and Web Services Lesson 1B / Slide 3 of 23
  • 4. Developing Applications Using JAXP Solutions to Pre-assessment Questions (Contd.) 1. b. Web services 2. c. Service provider 3. a. Service registry 4. a. SOAP 5. b. WSDL ©NIIT XML and Web Services Lesson 1B / Slide 4 of 23
  • 5. Developing Applications Using JAXP Objectives In this lesson, you will learn about: • Document-Oriented JAXP APIs • Creating applications using SAX, DOM, and XSLT API ©NIIT XML and Web Services Lesson 1B / Slide 5 of 23
  • 6. Developing Applications Using JAXP JAXP APIs • JAXP is a collection of APIs that you can use in your Java applications to process and translate XML documents. JAXP consists of three APIs: • Simple API for XML (SAX): Allows you to use a SAX parser to process the XML documents serially. • Document Object Model (DOM): Allows you to use a DOM parser to process the XML documents in an object-oriented manner. • XML Stylesheet Language for Transformation (XSLT): Allows you to transform XML documents in other formats, such as HyperText Markup Language (HTML). ©NIIT XML and Web Services Lesson 1B / Slide 6 of 23
  • 7. Developing Applications Using JAXP Using SAX API • The working of SAX includes: • SAX uses various classes and interfaces that are defined in the SAX API to process XML document in the form of a stream of data. • The SAX parser also notifies your application each time it recognizes any syntax constructs in the XML document. The following figure shows the working of the SAX: ©NIIT XML and Web Services Lesson 1B / Slide 7 of 23
  • 8. Developing Applications Using JAXP Using SAX API (Contd.) • SAX API Packages are: • org.xml.sax • org.xml.sax.ext • org.xml.sax.helpers • javax.xml.parsers • The steps to parse an XML document are: • Import the required packages • Extend the DefaultHandler Interface • Parse the XML Document • Override the call back methods ©NIIT XML and Web Services Lesson 1B / Slide 8 of 23
  • 9. Developing Applications Using JAXP Demonstration-Parsing XML Document Using SAX API • Problem Statement • ABC Books has implemented a Web service that allows them to perform online trading of books. Information of books is exchanged between the organization and their clients as XML documents. Larry Williams, manager of ABC Books, needs to process these XML documents before sending them to the clients. Larry instructs Don Allen, the software engineer to develop a Java application that will process the XML documents. Don Allen decides to process the XML documents using SAX API. ©NIIT XML and Web Services Lesson 1B / Slide 9 of 23
  • 10. Developing Applications Using JAXP Demonstration-Parsing XML Document Using SAX API(Contd.) • Solution 1. Create an XML document that needs to be parsed. 2. Develop the Java class to parse the XML document and display its contents. 3. Compile and run the application. ©NIIT XML and Web Services Lesson 1B / Slide 10 of 23
  • 11. Developing Applications Using JAXP Using DOM API • The working of DOM includes: • DOM uses various classes and interfaces that are defined in the DOM API to process XML document in the form a tree structure, known as DOM tree. • DOM tree consists of nodes, where each node represents a component of the XML document. Different types of nodes supported by DOM API are: • Element node • Text node • Attribute node ©NIIT XML and Web Services Lesson 1B / Slide 11 of 23
  • 12. Developing Applications Using JAXP Using DOM API (Contd.) • The following figure shows the working of DOM API: ©NIIT XML and Web Services Lesson 1B / Slide 12 of 23
  • 13. Developing Applications Using JAXP Using DOM API (Contd.) • DOM API Packages are: • org.w3c.dom • javax.xml.parsers • The steps to parse and display XML document using DOM are: • Import the DOM API related classes • Parse the XML document • Identify the various types of DOM nodes ©NIIT XML and Web Services Lesson 1B / Slide 13 of 23
  • 14. Developing Applications Using JAXP Demonstration-Parsing XML Document Using DOM API • Problem Statement • New Tech Books has implemented a Web service that allows online trading of books. Information of books is exchanged between the organization and their clients as XML documents. Ronald Billing, manager of New Tech Books instructs Jerry Smith, the software engineer to develop a Java application that can parse the XML documents and display the elements of the XML document and their contents. Jerry Smith decides to parse the XML documents using DOM API. ©NIIT XML and Web Services Lesson 1B / Slide 14 of 23
  • 15. Developing Applications Using JAXP Demonstration-Parsing XML Document Using DOM API (Contd.) • Solution 1. Write Java code that imports the various DOM related classes. In addition, the code should also identify the various types of nodes present in the XML file. 2. Compile and run the DOM application. ©NIIT XML and Web Services Lesson 1B / Slide 15 of 23
  • 16. Developing Applications Using JAXP Using XSLT API • Working of XSLT: To transform an XML document into other format such as HTML. XSLT API needs three components: • An instance of the TransformerFactory • An instance of the Transformer • The predefined transformation instructions ©NIIT XML and Web Services Lesson 1B / Slide 16 of 23
  • 17. Developing Applications Using JAXP Using XSLT API (Contd.) • The following figure shows the working of the XSLT API: ©NIIT XML and Web Services Lesson 1B / Slide 17 of 23
  • 18. Developing Applications Using JAXP Using XSLT API (Contd.) • The various packages of XSLT API are: • javax.xml.transform • javax.xml.transform.dom • javax.xml.transform.sax • javax.xml.transform.stream • The steps to transforming an XML document are: • Create a Stylesheet • Create a Java class to transform an XML document ©NIIT XML and Web Services Lesson 1B / Slide 18 of 23
  • 19. Developing Applications Using JAXP Demonstration-Parsing XML Document Using XSLT API • Problem Statement • New Tech Books has a Web service that allows online trading of books. Information of books is exchanged between the organization and their clients as XML documents. Tom Wilkins, manager of New Tech Books, needs to view these XML files in the HTML format. Tom instructs Jerry Smith, the software engineer to develop a Java application that can transform the XML documents in the HTML format. Jerry Smith decides to transform the XML documents using XSLT API. ©NIIT XML and Web Services Lesson 1B / Slide 19 of 23
  • 20. Developing Applications Using JAXP Demonstration-Parsing XML Document Using XSLT API (Contd.) • Solution • Create an XSL file for the corresponding XML file. • Writing the Java code that imports the various transformation related classes. • Compile and run the XSLT application. ©NIIT XML and Web Services Lesson 1B / Slide 20 of 23
  • 21. Developing Applications Using JAXP Summary In this lesson, you learned that: • JAXP is the Java API for processing XML documents. • JAXP API consists of three APIs • The SAX API • The DOM API • The XSLT API • You use the SAX and DOM APIs to parse various XML documents. • You use the XSLT API to transform various input source documents into different types of output result documents, such as HTML, XHTML, and WML. ©NIIT XML and Web Services Lesson 1B / Slide 21 of 23
  • 22. Developing Applications Using JAXP Summary (Contd.) • Various packages that JAXP provides to parse and transform XML documents are: • org.xml.sax • org.xml.sax.ext • org.xml.sax.helpers • javax.xml.parser • org.w3c.dom • javax.xml.transform • javax.xml.transform.dom • javax.xml.transform.sax • javax.xml.transform.stream ©NIIT XML and Web Services Lesson 1B / Slide 22 of 23
  • 23. Developing Applications Using JAXP Summary (Contd.) • Various types of interfaces that the SAX parser uses to parse an XML document are: • ContentHandler • ErrorHandler • DTDHandler • EntityHandler ©NIIT XML and Web Services Lesson 1B / Slide 23 of 23