Your SlideShare is downloading. ×
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Xml
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Xml

2,139

Published on

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,139
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • XML 1.0 is the specification that defines what "tags" and "attributes" are XLink describes a standard way to add hyperlinks to an XML file. XPointer is a syntax in development for pointing to parts of an XML document. CSS , the style sheet language, is applicable to XML as it is to HTML. XSL is the advanced language for expressing style sheets. Based on XSLT. XSLT is used to transfom XML documents from one form to other.
  • Key Messages: .NET is our implementation of xml web services – our strategy to ensure that our products connect better together and better with others. we ’ ve spent the past 3 years making XML web services integral to our entire business software platform .NET provides the comprehensive means for interoperating and driving new value from all of your (your partners and customers) existing systems … regardless of platform they run on or what programming language they were created in … Your decision will be in choosing the best software platform for bringing connectedness and integration to life … and we hope you see that .NET is the best choice We are continuing to push XML Web services and support for it in the toolset – you will see our implementations of WS-Security as we get into the details of our platform and tools Slide Build: 2 [see script] Slide Script: [BUILD 1] Microsoft .NET is software for connecting people, systems, information and devices. For Developers it means the ability to quickly build solutions that interoperate across languages, platforms and devices For IT, it means the ability to integrate new and existing systems across the organization and externally w/ Partners For Businesses, it means having the agility to connect more deeply with customers, integrate with business partners and empower its employees For Consumers it ’ s the ability to access and act upon information anytime, anywhere and on any device [BUILD 2] Microsoft .NET is built on a foundation of XML Web Services enabling both new and existing applications to connect with software and services across platforms, applications and programming languages Slide Transition: Strips Right-Down Additional Information for Presenter: NOTE: If you forego a drilldown on tools, servers, etc, this slide provides a high level overview on the commitment.
  • The current version of XML is 1.0. Still XML version 1.1 exists but not used those have special requirements. Any Kind of Data: XML documents contain text, never binary data. So BMP, voice information can’t be store in XML documents. To include binary data you need to encode into different format and you can specify encode format as attribute. But MTOM works on binary format. Unambiguous structure: An XML document not only contains data but also the structure
  • XML is designed to improve the functionality of the Web by providing more flexible and adaptable information identification. XML is a powerful tool for data representation, storage, modelling , and interoperation . Structured information contains both content (words, pictures, etc.) and some indication of what role that content plays (for example, content in a section heading has a different meaning from content in a footnote, which means something different than content in a figure caption or content in a database table, etc.). Almost all documents have some structure. A meta language used to define new markup languages . With XML, you can create a language crafted specifically for your application or domain. (Eg: XAML, ebXML , etc.,) SGML is the Standard Generalized Markup Language defined by ISO 8879. This is also a meta language. SGML has been the standard, vendor-independent way to maintain repositories of structured documentation for more than a decade, but it is not well suited to serving documents over the web. XML was created so that richly structured documents could be used over the web. The only viable alternatives, HTML and SGML, are not practical for this purpose.
  • Well formed documents are: Only small set of rules. Semantics not really known. Can be displayed Can be processed Easy to work with. Valid XML documents are: Can be validated against a standard set of rules Large number of DTD's available For instance XHTML is an XML DTD Others: e-business, multimedia, chemical language, mathematics, etc. Advantage: correct interpretation and processing possible Superceeded by XML-schema: start today, use schema not DTD
  • explex
  • In short HTML is a markup language for presentation, and XML is a language for creating markup language that describe structured data.
  • XML has its root in SGML which was created in 1986. SGML was too complex, something bit simpler was needed thus the birth of XML. SGML is the Standard Generalized Markup Language defined by ISO 8879. SGML has been the standard, vendor-independent way to maintain repositories of structured documentation for more than a decade, but it is not well suited to serving documents over the web.
  • The XML PI is: Very important for detecting encoding Identifies XML when file and media type information is unavailable or unreliable
  • Elements are the most common form of markup. Delimited by angle brackets, most elements identify the nature of the content they surround. <title> Definitive XML Schema </title>
  • In order to insert these characters into your document as content, there must be an alternative way to represent them. Character reference is a mechanism for inserting characters that cannot be typed directly on your keyboard.
  • The name , called the PI target, identifies the PI to the application. Applications should process only the targets they recognize and ignore all other PIs. Any data that follows the PI target is optional, it is for the application that recognizes the target. The names used in PIs may be declared as notations in order to formally identify them. Any data that follows the PI target is optional, it is for the application that recognizes the target.
  • The commas between element names indicate that they must occur in succession. The plus after author indicates that it may be repeated more than once but must occur at least once. The question mark after price indicates that it is optional An XML DTD can be interchanged with the XML instance An XML DTD can provide a schema for a broad class of XML documents
  • Target element is the element which the attribute applies. Attr- Name is the attribute name.
  • The commas between element names indicate that they must occur in succession. The plus after employee indicates that it may be repeated more than once but must occur at least once. The question mark after nick indicates that it is optional
  • Schemas are developed to replace DTD’s
  • Schemas are developed to replace DTD’s The Schema consists a set of predefined rules that describes a given class of XML document.
  • XML Schema definition language (XSD) has become the mainstream language for describing XML documents.
  • The definitions placed within the xsd:schema element are automatically associated with the namespace specified in the targetNamespace attribute.
  • Lexical
  • The definitions placed within the xsd:schema element are automatically associated with the namespace specified in the targetNamespace attribute.
  • The key difference between the above two parsing is that DOM loads the entire document into an in-memory data structure. In case of SAX iterates over the XML document one piece at a time in a forward-only and read-only fashion. Processing instructions provide a mechanism for document authors to communicate with XML-aware applications behind the scenes. SAX is primarily a collection of interfaces in the org.xml.sax package. The interface ContentHandler is the key piece of SAX. Almost every SAX program need to use this interface. ContentHandler is a call back interface.
  • DOM allows programs and scripts to dynamically access and update the content structure and style of a document. The HTML DOM defines the objects and properties of all HTML elements, and the methods (interface) to access them.
  • Some of the DOM rules: In a node tree, the top node is called the root Every node, except the root, has exactly one parent node A node can have any number of children A leaf is a node with no children Siblings are nodes with the same parent Some of the properties and methods of XML DOM : These are some typical DOM properties: x.nodeName - the name of x x.nodeValue - the value of x x.parentNode - the parent node of x x.childNodes - the child nodes of x x.attributes - the attributes nodes of x Element methods are: x. getElementsByTagName ( name ) - get all elements with a specified tag name x. appendChild ( node ) - insert a child node to x x. removeChild ( node ) - remove a child node from x
  • SAX stands for Simple API for XML. Unlike DOM , there is no formal specification for SAX. The Java implementation of SAX is considered to be normative , and implementations in other languages attempt to follow the rules laid down in that implementation, adjusting for the differences in language where necessary. The memory footprint of a SAX parser, by contrast, is based only on the maximum depth of the XML file (the maximum depth of the XML tree) and the maximum data stored in XML attributes on a single XML element.
  • XmlReader and XmlWriter are abstract classes.
  • Another significant XML-related feature that was introduced in SQL Server 2005 is support for XML indexes . You can create primary and secondary XML indexes for columns of type xml to enhance XML query performance. XML DML is Microsoft enhancement for XQuery.
  • The XML data type in SQL Server can also be strongly typed with XML Schemas. With a strongly typed XML Column, it is verified if the data confirms to the schema when XML data is inserted.
  • XPath is used by XSL also by XPointer .
  • XPath is used by XSL also by XPointer .
  • The <xsl:stylesheet> and <xsl:transform> are completely synonymous and either can be used. The match attribute can also be used to define a template for the entire XML document.
  • An <xsl:template> element defines a template rule to be triggered when a particular part of the source document is being processed. The attribute match="/" indicates that this particular rule is triggered right at the start of processing the source document. Here «/» is an Xpath expression which identifies the root node of the document:
  • XQuery is based on existing XPath query language. With support added for better iteration, better sorting results, and the ability to construct the necessary XML. Whereas XML Schema only defined the types, XQuery has defined the operations that are allowed on those types. XQuery results are either typed or untyped. The type information is based on schema language. XQuery is a strongly typed programming language . Like Java and C#, for example, it's a mix of static typing (type consistency checked at compile-time) and dynamic typing (run-time type tests).
  • Types in XQuery: Numbers, including integers and floating-point numbers. The boolean values true and false. Strings of characters, for example: "Hello world!". These are immutable - i.e. you cannot modify a character in a string. Various types to represent dates, times, and durations. A few XML-related types. For example a QName is a pair of a local name (like template) and a URL, which is used to represent a tag name like xsl:template after it has been namespace-resolved.
  • Popular template processors , like JSP, ASP, and PHP, allow you to embed expressions in a programming language into HTML content. XQuery gives you that ability, plus the ability to embed XML/HTML forms inside expressions, and to have them be the value of variables and parameters. XQuery node values are immutable. You can’t modify node after it has been created. The sortby() takes an input sequence (in this case $books) and one or more ordering expressions . $books sortby (author/name)
  • The document() function returns the root node of a document. The /book expression selects the child elements of the root that are named book, so $book gets set to the single root element.
  • An important goal for XQuery is that it should be usable as a query language for XML databases. Compare the corresponding SQL statement,
  • So 3+4 is a complete, valid XQuery program which evaluates to the integer 7. The XQuery standard specifies the result value of an expression or program, but it does not specify how it is to be evaluated. An implementation has considerable freedom in how it evaluates an XQuery program, and what optimizations it does.
  • The below is second section of the fifth chapter of the doc. /doc/chapter[5]/section[2] XQuery element constructor consists of a start tag and an end tag, enclosing an optional list of expressions that provide the content of the element. A FLWOR expression binds some expressions, applies an optional predicate and ordering, and constructs a new result. FLOWER stands for FOR, LET, WHERE, ORDER and RETURN Clause
  • Popular template processors , like JSP, ASP, and PHP, allow you to embed expressions in a programming language into HTML content. XQuery gives you that ability, plus the ability to embed XML/HTML forms inside expressions, and to have them be the value of variables and parameters. XQuery node values are immutable. You can’t modify node after it has been created.
  • We've seen atomic values (numbers, strings, etc), and node values (elements, attributes, etc). These are together known as simple values. The for expression first evaluates the expression following the in . Then for each value of the resulting sequence, The variable (in this case $x) is bound to the value, and the return expression evaluated using that variable binding.
  • USER & AUTO: Today <A> links in HTML are USER Today <IMG> links in HTML are AUTO <A> links are ACTUATE =USER and SHOW =REPLACE <IMG> links are ACTUATE =AUTO and SHOW =EMBED
  • Simple declaration is : H1 { font-weight: bold } Simple Complex declaration is: H2, H3, H4 {font-size: 12pt; font-style: normal; font-weight: bold;} Complex
  • My Notes: Today's applications require the ability to communicate with other systems in an efficient and secure manner. Speaker Notes For years, software development has focused on how to best reuse the code that we write. Ultimately, people and businesses want long-term return on their short-term investments in code. How do we do this? We’ve seen 3 waves of advancement in this movement in recent decades: 1980s and Object-Orientation: Object-oriented development promised the idea of building reusable abstractions (called classes) that we could then inherit from in order to reuse the base class functionality. This shift from simple procedural-based code brought with it a lot of benefits including polymorphism (the ability to dynamically bind types at runtime), abstractions that included both state and behavior, and encapsulation (controlling which parts of the code the external world can access). However, Object-Orientation by itself didn’t facilitate the dynamic evolution of software at runtime. Once an application was built, it was static. There wasn’t an easy way to infuse new code into an application. 1990s and Components: Component-based development helped us overcome this challenge. It forced the developer to think about the external facing interface of the application. This enabled us to build systems that dynamically load and bind to new functionality at runtime (an application discovers new components after it has been built) and introduced the notion of an application as a growing/evolving organism. To facilitate dynamic loading, we saw a big emphasis on runtime metadata. In the past, you couldn’t easily discern application capabilities since there was very little/rudimentary metadata information stored as part of the application. Whereas C and C++ programs from 1980s were these relatively opaque collections of code, component-based applications of the 1990s enabled runtime inspection of code to determine what a particular component supported. This introduced the notion of self-describing systems. But while this metaphor worked really well on a single machine (using method invocation on an object reference), we hit scaling problems when we tried to stretch it out and apply it as the substrate for distributed software integration (across machines, etc). 2000s and Service-Orientation – With Service-Orientation, we retain the benefits of self-describing applications, explicit encapsulation, and dynamic loading of functionality. What changes is the metaphor with which we accomplish it. Instead of using method invocation on an object reference, we shift the conversation to that of message passing – a proven metaphor for scalable distributed software integration. In addition, to support dynamic loading of service-based functionality, we use schema to describes the structure of messages, behavioral contract to define acceptable message exchange patterns, and policy to define service semantics. Simplifying service-oriented development is one of the biggest bets we’re making in "WCF". "WCF" takes the service-oriented concepts of message passing, schema, contract, and policy, and implicitly applies it to all of the services we build. As such, "WCF" provides you with the first true service-oriented programming model. Transition to next slide: We define service oriented applications as those that adhere to “The Four Tenets of Service-Orientation.” Let’s examine these and see how "WCF" implements them… 03/27/11 05:51 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. Next Generation Business Solutions Platform Strategy Review
  • Service management includes many functions including, Security, Deployment, Logging, Dynamic rerouting and Maintenance.
  • Speaker Notes Boundaries are Explicit: Services run in a separate process from their clients • Well-defined public interface to your service • Avoid RPC use explicit messages • Public “gateway” to your internal (private) implementation • Don’t expose implementation details. Explicit boundaries mean that a service can be deployed anywhere and be easily and freely accessed by other services, regardless of the environment or development language of the other service. Here messages need to cross the development environment boundaries. Same time it doesn’t care about the message consumer environment also. The thing to keep in mind is that there is a cost associated with crossing boundaries. These costs come in a number of forms, such as communication, performance, and processing overhead costs. Services should be called quickly and efficiently. Tenet 1: Boundaries are Explicit . Based on the underlying concept of encapsulation, this tenet specifies the publishing and consumption of functionality as sets of services that abstract their underlying implementation Services are Autonomous: • Deployed/Versioned independent of system and other services • Contract, once published should not be changed • A service owns its needed business components • A service should be able to perform without external dependencies Services are built and deployed independently of other services. Systems, especially distributed systems, must evolve over time and should be built to handle change easily. This SOA principle states that each service must be managed and versioned differently so as to not affect other services in the process. Ex: In the book publisher example, the Order Process service and Order Fulfillment service are completely independent of each other; each is versioned and managed completely independent of the other. In this way, when one changes it should not affect the other. It has been said that services should be built not to fail. In following this concept, if a service is unavailable for whatever reason or should a service depend on another service that is not available, every precaution should be taken to allow for such services to survive, such as redundancy or failover. Tenet 2: Services are Autonomous . Autonomy means we design the system to support the inevitable evolution of the service’s implementation over time. As we build our services, we need to assume that their internal implementation will evolve (be versioned) over time and that our services as well as the services on which we depend could change location at (almost) any time. Services share schema and contract, not class: • Clients send messages to a service that conform to a contract. • Classes contain data and behavior. • Contract must not change once published. • Contracts/Schemas provide platform-independent interoperability • Contract via WSDL Think “schemas = data” and “contracts = behavior.” The contract contains information regarding the structure of the message. Services do not pass classes and types; they pass schemas and contracts. This allows for a loosely coupled system where the service does not care what type of environment the other service is executing on. The information being passed is 100 percent platform independent.. Tenet 3: Services share schema and contract, not class . For those of you who are familiar with ASMX - this is exactly how ASMX works: The service publishes a contract that clients use to generate their own code to call the service. No types are shared between service and its clients by default. In addition, neither Service requires knowledge of each others’ internal workings in order to exchange data – they only need the published schemas & contracts. Service compatibility is determined based on policy: • Separate “content” from “behavior” • Policy describes non functional constraint such as communication protocols, security and reliability requirements Services look at each others’ policy, looking for similarities so that they can start communicating. If two services can’t satisfy each others’ policy requirements, all bets are off. These policies exist in the form of machine-readable expressions. Policies also allow you to move a service from one environment to another without changing the behavior of the service. Tenet 3: Service compatibility is determined based on policy . The services communicate through dynamically negotiated communications channels that support the necessary semantics (security, reliability, etc). Service policy statements created automatically based on configuration, class attributes, and method signatures. Client channels automatically configured via retrieved service policy. By “name” means that we reference a well known name in Policy that represents a whole specification of behavior that needs to be used when talking to this endpoint.
  • UDDI : Universal Description, Discovery and Integration. XML Web Service discovery is the process of locating and interrogating XML Web Service descriptions. Programmatic discovery can be enabled when an XML Web service publishes a .disco file.
  • If SOAP uses the HTTP as transport then HTTP security would be adequate for SOAP.
  • An Envelope : That defines a framework for describing what is in a message and how to process it. It is always a root element of SOAP message. Optional Header: A set of encoding rules for expressing instances of application-defined data types. When Header present it should be the first child element of the envelope. The Header element is a generic mechanism for adding features to a SOAP message in a decentralized manner. Mandatory Body: A convention for representing remote procedure calls and responses. Play load, response message and Fault elements goes here. The fault element is shown in <soap:Fault> . The fault element must contain a faultcode followed by faultstring .
  • The SOAP fault model requires that all SOAP-specific and application-specific faults be reported using a single distinguished element, env:Fault , carried within the env:Body element. The Fault element contains two mandatory sub-elements, Code and Reason , and (optionally) application-specific information in the Detail sub-element Another optional sub-element, Node , identifies via a URI the SOAP node which generated the fault, its absence implying that it was the ultimate recipient of the message which did so. There is yet another optional sub-element, Role , which identifies the role being played by the node which generated the fault. The Code sub-element of Fault is itself made up of a mandatory Value sub-element, whose content is specified in the SOAP specification as well as an optional Subcode sub-element.
  • The user subscribes to a feed by entering into the reader the feed's URI or by clicking an RSS icon in a web browser that initiates the subscription process. The RSS reader checks the user's subscribed feeds regularly for new work, downloads any updates that it finds, and provides a user interface to monitor and read the feeds.
  • The above RSS feed in version 1.0 format: <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"   xmlns="http://purl.org/rss/1.0/“ xmlns:dc="http://purl.org/dc/elements/1.1/“ >   <channel rdf:about="http://www.xml.com/cs/xml/query/q/19">     <title>XML.com</title>     <link>http://www.xml.com/</link>     <description>XML.com features a rich mix of information and services for the XML community.</description>     <language>en-us</language>     <items>       <rdf:Seq>         <rdf:li rdf:resource="http://www.xml.com/pub/a/2002/12/04/normalizing.html"/>         <rdf:li rdf:resource="http://www.xml.com/pub/a/2002/12/04/som.html"/>         <rdf:li rdf:resource="http://www.xml.com/pub/a/2002/12/04/svg.html"/>       </rdf:Seq>     </items>   </channel>   <item rdf:about="http://www.xml.com/pub/a/2002/12/04/normalizing.html">     <title>Normalizing XML, Part 2</title>     <link>http://www.xml.com/pub/a/2002/12/04/normalizing.html</link>     <description>In this second and final look at applying relational normalization techniques to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and the fourth and fifth normal forms.</description>     <dc:creator>Will Provost</dc:creator>     <dc:date>2002-12-04</dc:date>       </item>   <item rdf:about="http://www.xml.com/pub/a/2002/12/04/som.html">     <title>The .NET Schema Object Model</title>     <link>http://www.xml.com/pub/a/2002/12/04/som.html</link>     <description>Priya Lakshminarayanan describes in detail the use of the .NET Schema Object Model for programmatic manipulation of W3C XML Schemas.</description>     <dc:creator>Priya Lakshminarayanan</dc:creator>     <dc:date>2002-12-04</dc:date>       </item>   <item rdf:about="http://www.xml.com/pub/a/2002/12/04/svg.html">     <title>SVG's Past and Promising Future</title>     <link>http://www.xml.com/pub/a/2002/12/04/svg.html</link>     <description>In this month's SVG column, Antoine Quint looks back at SVG's journey through 2002 and looks forward to 2003.</description>     <dc:creator>Antoine Quint</dc:creator>     <dc:date>2002-12-04</dc:date>       </item> </rdf:RDF>
  • Transcript

    • 1. An overview of XML & SOAP Ch.Vishwa Mohan Project Manager KREST Embedded Technologies
    • 2. Agenda
      • What is XML ?
      • Where XML using ?
      • What is DTD ?
      • XML Schema Language
      • XML Query Languages
      • RSS
      • Web Services
      • SOAP & WSDL
    • 3. XML Related Technologies
      • XML
      • DTD
      • XML Schema
      • XPath
      • XQuery
      • XSLT
      • XLink & XPointer
      • CSS
      • XAML
      • SOAP & WSDL
      • RSS
      • All types of XML Specifications you can find at XML organization.
      • www.xml.org
      • WS-* specifications you can find at OASIS Web Site.
      • www.oasis-open.org
    • 4. Microsoft .NET Experiences & Solutions Tools Software for Connecting Information, People, Systems and Devices XML Web Services across the Entire Microsoft Platform Servers Clients Services
    • 5. What is XML ?
      • XML is self describing
      • Open standard
      • Any kind of data
      • Unicode Character set
      • Clear syntax & Textual representation of data
      • Unambiguous structure
      • A language for creating markup languages
      • Platform Independent
      • Portable Data
      • Resembles HTML or SGML
        • Tags, Attributes & Values
        • DTD’s
    • 6. What is XML ?
      • XML is a markup language for document containing structured information.
      • XML is a markup specification language With which you can design ways of describing information (text or data), usually for storage, transmission or processing by a program.
      • A markup language is a mechanism to identify structures in a document.
      • XML is, roughly speaking, a restricted form of SGML.
      • XML is more then a markup language. It is a meta language A language used to define other languages .
      • XML is fully Unicode complaint.
      • XML is extensible, platform independent and supports internationalization and localization.
    • 7. Different Types of XML Documents
      • An XML document to be considered to be correct. It must meet two requirements:
        • Well-formed
        • Valid
      • A well-formed document must confirm to the following rules:
        • An XML Document may contain XML declarations, PI’s, encoding and other information may exists.
        • Only one root element in specified XML document.
        • Elements those are not empty must specify start & end tags.
        • Empty elements can mark with the empty element tag.
        • Attributes must be enclosed in a single or double quotes.
        • Tags may be nested but must not overlap.
        • Elements names are case sensitive.
        • Document must used specified encoding (UTF-8).
      • A valid document has data that confirms to a set of content rules. These rules describes the correct data values and document organizational structure.
    • 8. What is Self Describing? ST*323*712990413 V1*7039610*NEW ZEALAND QUEEN*D*104N*SCAC***L LS*0100 R4*D*D*JAX*JACKSONVILLE FL**** V9*EAD**920819**JACKSONVILLE FL***A26 R4*D*D*ORF*NORFOLK, VA**NORFOLK INTL TERMIN** V9*EAD**920817**NORFOLK, VA***A26 R4*L*K*MEB*MELBOURNE, AUST**** V9*EDD**920712**MELBOURNE, AUST***A40 R4*L*K*SYD*SYDNEY, AUST**** V9*EDD**920715**SYDNEY, AUST***A40 R4*L*K*WLG*WELLINGTON, NEW ZEALAND**** V9*EDD**920721**WELLINGTON, NEW ZEA***A40 LE*0100 SE*25*712990413 This is not self describing data!
    • 9. XML is Self Describing <?xml version=“1.0”?> <Data> <Item ID=“112”> <Name> Rod </Name> <Price> 12.00 </Price> <Units> 1 </Units> </Item> <Item ID=“114”> <Name>Reel</Name> <Price>15.00</Price> <Units>1</Units> </Item> <Item ID=“120”> <Name>Bait</Name> <Price>24.00</Price> <Units>3</Units> </Item> </Data> Here data is self explanatory
      • In XML documents make structure explicit through markup:
      • Bad way to represent: <Transaction>Withdrawal 2003 12 15 200.00 </Transaction>
      • Better way : <Transaction type=&quot;withdrawal&quot;>
      • <Date>2003-12-15</Date>
      • <Amount>200.00</Amount>
      • </Transaction>
    • 10. What is XML is Not ?
      • A replacement for HTML
      • A Programming Language
      • A Network Transport Protocol
      • A Database
    • 11. XML vs HTML
      • HTML is a markup language for presentation and XML is a language for creating markup language that describes the structured data.
      XML HTML Describes the structured data HTML describes layout. Allows you to define your own tags Has a fixed tag set Case sensitive Case insensitive All tags must be closed Not required. All attribute values must be in single or double quote mark. Different heading. First line of XML document is with <?xml ?>
    • 12. The need for XML
      • The real XML’s power come from the fact that it can be used regardless of the platform, language or data store of system using.
      • It is desirable to transport data around networks (including the internet).
      • XML is the format of choice for marking up that data.
      • SGML was too complex, HTML not robust enough.
    • 13. A Simple XML File <?xml version=&quot;1.0&quot; encoding=&quot;utf-8“ ?> <books xmlns=&quot;http://www.MyStore.com/books&quot;> <book publisher=&quot;IDG books&quot; on-loan=&quot;Sanjay&quot;> <title>XML Bible</title> <author>Elliotte Rusty Harold</author> </book> <book publisher=&quot;Prentice Hall&quot; on-loan=&quot;Sander&quot; > <title>Definitive XML Schema</title> <author>Priscilla Walmsley</author> </book> <book publisher=&quot;APress&quot;> <title>A Programmer's Introduction to C#</title> <author>Eric Gunnerson</author> </book> </books>
      • Optional
      • Specifies version , character set and encoding .
    • 14. XML Syntax Rules
      • Tags are case sensitive
      • Each document must have a root.
      • Closing tags are required
      • Values must be enclosed in quotation marks
      • Elements must be properly nested
      • Entities must be declared
    • 15. An XML Example
      • We will define a employee structure as follow:
        • An employee is required to specify either male or female .
        • An employee has a name consists of
          • A first name
          • A last name
          • An (optional) nick name
        • An employee has a qualification.
        • An employee has a designation.
    • 16. XML Document Example <?xml version=&quot;1.0&quot; encoding=&quot;utf-8“ ?> <!DOCTYPE employees SYSTEM &quot;C:employee.dtd&quot;> <employees xmlns=&quot;http://www.krestembedded.com/empinfo&quot;> <employee gender=“male&quot;> <name> <first>Vishwa</first> <last> Mohan</last> <nick>C.V</nick> </name> <qualification>M.E </qualification> <designation>Project Manager</designation> </employee > <employee gender=“female&quot;> <name> <first>Subba</first> <last>Laxmi</last> </name> <qualification>B.Tech</qualification> <designation>Project Associate</designation> </employee > </employees>
    • 17. XML Document Example
      • <?xml version=&quot;1.0&quot; encoding=&quot;utf-8“ ?>
      • The document begins with a processing instruction:
      • While it is not required, its presence explicitly identifies the document as an XML document and its version.
      • XML documents are composed of markup and content.
      • There are six kinds of markup that can occur in an XML document:
        • elements ( and attributes)
        • entity references
        • comments
        • processing instructions
        • marked sections
        • document type declarations
    • 18. Elements vs Attributes
      • Elements are the most common form of markup. Delimited by angle brackets, most elements identify the nature of the content they surround.
      • <title> An introduction to C# Programming </title>
      • Some elements may be empty ( i.e., no content ).
      • Attributes are name-value pairs that occur inside start-tags after the element name.
      • <book publisher =&quot;Prentice Hall&quot; > </book>
      • In XML, all attribute values must be either single or double quoted.
    • 19. Attributes Advantages & Disadvantages
      • Attributes Disadvantages:
        • Can’t contain multiple values
        • Not very expandable
        • Can’t describe structures
        • More difficult to manipulate
        • Hard to test against DTD.
      • Attribute Advantages:
        • Great for internal info not needed by the user
        • <messages>
        • <Note ID =&quot;100&quot;>New Batch on .NET starts today </Note>
        • <Note ID =&quot;101&quot;>New Batch on Java starts today </Note>
        • </messages>
    • 20. Entity References
      • Some of the characters are reserved for markup language ( Eg: ‘ < ‘, ‘ > ’, ..,). These characters have alternative name to represent them ( i.e., lt, gt, etc.,).
      • In XML, entities are used to represent these special characters.
      • To use an entity, you simply reference it by name. Entity references begin with the ampersand and ends with a semicolon .
      • <book>  &lt; book>  &lt; book &gt;
      • Entities are also used to refer to often repeated or varying text and to include the content of external files.
      • Every entity must have a unique name. You can also define your own entities.
      • A special form of entity reference, called a character reference can be used to insert arbitrary Unicode characters into your document. It can be represented as
      • &#8478;  &#x211E;  Represents Rx symbol
    • 21. Entity References
      • The XML Specification provides 5 predefined internal entities:
        • &lt; produces the left angle bracket, <
        • &gt; produces the right angle bracket, >
        • &amp; produces the ampersand, &
        • &apos; produces a single quote character (an apostrophe), '
        • &quot; produces a double quote character, &quot;
      • In addition to above entities there are other types of entities:
        • External entities
        • Parameter Entities
    • 22. Comments
      • Comments begin with <!-- and end with --> .
      • Comments can contain any data except the literal string “ -- ”.
      • You can place comments anywhere between markup.
      • Comments are not part of the textual content of an XML document. An XML processor is not required to pass them along to an application.
    • 23. Processing Instructions
      • Processing instructions (PIs) as an alternative means of passing information to a particular application that may read the document. ( Always appear before the root element)
      • Like comments, they are not textually part of the XML document but the XML processor is required to pass them to an application.
      • Processing instructions have the form:
        • <?name pidata?>
      • Processing Instruction is just markup, but not element.
      • In the processing instructions section, you can script code, SQL statements etc..,
      • PI names beginning with xml are reserved for XML standardization.
      • <?xml version=&quot;1.0&quot; encoding=&quot;utf-8“ ?>
      • <?xml-stylesheet href=”person.css” type=”text/css”?>
    • 24. Marked Sections
      • In a document, a CDATA section instructs the parser to ignore most markup characters. This CDATA section starts with <![CDATA[ and ends the section with ]]> .
      • <![CDATA[
      • *p = &q;
      • b = (i <= 3); ]]>
      • All character data is passed directly to the application, without interpretation.
      • Elements, entity references, comments, & processing instructions are all unrecognized and the characters that comprise them are passed literally to the application.
      • The only string that cannot occur in a CDATA section is ]]>.
    • 25. XML DTD & Schema
    • 26. Document Type Declarations (DTD)
      • Generally, declaration ( DTD, or Schema ) allows a document to communicate meta information to parser about its contents.
      • Meta-information includes the allowed sequence and nesting of tags, attribute values and their types and defaults, the names of external files that may be referenced and whether or not they contain XML.
      • There are four kinds of declarations in XML:
        • Elements
        • Attributes
        • Entities
        • PCDATA & CDATA
      • Element Type declaration identify the name of elements and the nature of their content.
      • < !ELEMENT books (title, author+, price?)>
      • DTD’s can be specified externally or you can embed internally.
    • 27. Declaring Elements in a DTD
      • General form of declaring element is :
      • <!ELEMENT Element-Name Element-Rule>
        • Creating an element which can contain both plain text & tags.
        • <!ELEMENT Element-Name ANY >
        • Create an element which contain plain text but not other tags: <!ELEMENT Element-Name ( #PCDATA )>
        • To Create an empty element
        • <!ELEMENT Element-Name EMPTY >
        • Create an element with children which must present in the order listed.
        • <!ELEMENT Element-Name ( child1, child2 )>
        • Create an element with options ( Any one of them can appear, but not both).
        • <!ELEMENT Element-Name ( child1 | child2 )>
    • 28. Declaring Elements in a DTD
      • Some more element declarations are shown below:
        • Create an element with child which must appear 0 or 1 times.
        • <!ELEMENT Element-Name ( child ) ? >
        • Create an element with a child which must appear 1 or more times.
        • <!ELEMENT Element-Name ( child ) + >
        • Create an element with a child which may appear 0 or more times
        • <!ELEMENT Element-Name ( child ) * >
      • Declaring Attributes in a DTD as follows:
      • <!ATTLIST target-element attr-name type default >
        • The type specifies what type of data that attribute contains.
          • Legal types are : CDATA
        • The default specifies whether the item is required or not.
          • Possible values for default are: #REQUIRED, #IMPLIED
    • 29. The “employee” DTD <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <!ELEMENT employees ((employee+))> <!ATTLIST employees xmlns CDATA #FIXED &quot;http://www.krestembedded.com/empinfo&quot;> <!ELEMENT employee ((name, qualification, designation))> <!ATTLIST employee gender (male | female) #REQUIRED> <!ELEMENT name ((first, last, nick?))> <!ELEMENT first (#PCDATA)> <!ELEMENT last (#PCDATA)> <!ELEMENT nick (#PCDATA)> <!ELEMENT qualification (#PCDATA)> <!ELEMENT designation (#PCDATA)>
    • 30. DTD’s are Limited
      • The problem with DTD’s are:
        • DTDs express only relationships and data typing intended by ISO 8879
        • DTD’s do not easily express data types or conceptual relationships such as those found in RDBMS.
        • DTDs are specifications in a syntax unique to SGML and SGML tools
        • DTD’s works well for textual data.
        • DTD’s use old SGML style definitions.
        • DTD’s are not written in XML.
    • 31. XML Schema
      • An XML Schema is a description of a type of XML document. The schema is typically expressed as constraints on the structure and content of document.
        • An XML schema provides a superset of the capabilities found in DTD.
        • A schema used to defines the elements
        • It also defines structural information about the XML doc.
        • It also defines the sequence in which child elements can appear and the no of child elements.
        • It can define whether an element is empty or can include text as well as default values for attributes.
        • XML Data Schema provides one standard schema language for both text and relational data.
        • XML Schema uses XML syntax.
    • 32. Schema vs DTD
      • XML Schema definition language (XSD) has become the mainstream language for describing XML documents.
      • XML schema an improvement over DTDs that allows the author to specify data types, default value, maximum and minimum values , enumerations and other types.
      • The Schema and DTD both provide a method for specifying the structure of an XML element, whereas the both allow for element definitions, only schemas allow you to specify the type information.
      • XML Schema supports reusable types and allow you to create new types using inheritance.
      • XML Schema allows you to group elements to control the recurrence of elements and attributes.
    • 33. XML Schema Definition Language (XSD)
      • The Schema definition must have a root xsd:schema element. There are a variety of elements that may be nested within xsd:schema including, but not limited to:
        • xsd:element
        • xsd:attribute
        • xsd:complextType
      • These are approximately 44 ( int, string, long, etc., ) simple data types defined in the XSD.
        • Also possible to define custom simple types.
      • XML Schema provides
        • Enhanced ability to validate data. ( Element structure, Attribute values, Element content, etc., ).
        • Default values for elements.
        • Uniqueness as well as Key constraints.
        • Pattern matching.
    • 34. Schema Representation
      • Within XSD file, you can derive complex types from the existing complex types also.
      • <xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
      • xmlns:tns=&quot;http://example.org/person&quot;>
      • <xsd:complexType name=&quot; Person &quot;>
      • <xsd:sequence>
      • <xsd:element name=&quot;name&quot; type=&quot;xsd:string&quot;/>
      • <xsd:element name=&quot;age&quot; type=&quot;xsd:byte &quot; minOccurs=&quot;0&quot;/>
      • <xsd:element name=&quot;phone&quot; type=&quot;xsd:string“
      • minOccurs=&quot;1“ maxOccurs=&quot;5&quot;/>
      • </xsd:sequence>
      • <xsd:attribute name=&quot;id&quot; type=&quot;xsd:string &quot;/>
      • </xsd:complexType>
      • <xsd:element name=“employee&quot; type=&quot;tns:Person&quot;/>
      • </xsd:schema>
    • 35. Pattern Definition in Schema
      • Within your schema if you want to specify any element should present within specified pattern you can use <xsd:pattern …> .
        • Suppose if you want to the phone element should be present in xxx-xxx-xxxx format then you can define as follow:
      • <xsd:simpleType name=&quot; Phone &quot;>
      • < xsd:restriction base=&quot;xsd:string&quot;>
      • <xsd:pattern value=&quot; d{3}-d{3}-d{4} &quot;/>
      • < /xsd:restriction >
      • </xsd:simpleType>
      • XML Schema defines a set of type characteristics, or facets, which can be used to restrict certain aspects of the base type.
        • There are total 12 facets ( Eg: minInclusive, maxInclusive ).
        • Each facet makes it possible to restrict the value space of the base type in a different way.
    • 36. Schema for Employees <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <xs:schema targetNamespace=&quot;http://www.krestembedded.com/empinfo&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;> <xs:element name=&quot;employees&quot;> <xs:complexType> <xs:sequence> <xs:element maxOccurs=&quot;100&quot; name=&quot;employee&quot;> <xs:complexType> <xs:sequence> <xs:element name=&quot;name&quot;> <xs:complexType> <xs:sequence> <xs:element name=&quot;first&quot; type=&quot;xs:string&quot; /> <xs:element name=&quot;last&quot; type=&quot;xs:string&quot; /> <xs:element minOccurs=&quot;0&quot; name=&quot;nicK&quot; type=&quot;xs:string&quot; />
    • 37. Schema for Employees </xs:sequence> </xs:complexType> </xs:element> <xs:element name=&quot;qualification&quot; type=&quot;xs:string&quot; /> <xs:element name=&quot;designation&quot; type=&quot;xs:string&quot; /> </xs:sequence> <xs:attribute name=&quot;gender&quot; type=&quot;xs:string&quot; use=&quot;required&quot; /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
    • 38. Parsing XML
      • Two popular types of XML processing exists:
        • DOM ( Document Object Model )
        • SAX ( Simple API for XML )
      • The key differences between these two processing's are:
        • DOM loads the entire document into in-memory data structure. ( In case of SAX it doesn’t required ).
        • SAX is a simple and straightforward, event based API for parsing XML documents.
        • In case of SAX iterates over the XML document one piece at a time in a forward-only and read-only fashion.
        • SAX allows the developers to take advantage of event-driven XML parsing.
        • Both SAX and DOM provide the client application access to XML processing instructions.
        • The DOM is intended to be OS and language neutral.
    • 39. DOM
      • The DOM is W3C defined standard for accessing documents like XML & HTML.
        • DOM is platform and language neutral.
        • The DOM is separated into 3 different parts:
          • Core DOM
          • XML DOM
          • HTML DOM
        • The DOM defines the objects and properties of all document elements and the methods ( interfaces ) to access them.
        • The XML DOM is a standard object model for XML and a standard programming interface for XML. ( W3C Standard ).
        • With XML DOM interfaces you can get, change, add or delete XML elements.
        • According to DOM everything in XML document is a node.
    • 40. DOM
      • According to DOM everything in XML document is a node.
        • The entire document is a document node .
        • Every XML element is an element node .
        • The text in the XML elements are text nodes .
        • Every attribute is an attribute node .
        • Comments are comment nodes .
      • A common error in DOM processing is to expect an element node to contain text, however the text of an element node is stored in a text node.
        • <year>2005</year> ,
        • The element node <year>, holds a text node with the value &quot; 2005 &quot;. So the &quot;2005&quot; is not the value of the <year> element !.
      • Most browsers have a build-in XML parser. An XML parser reads XML and converts into an XML DOM object that can be accessed by JavaScript.
    • 41. XML Elements and Relations
    • 42. XML Elements and Relations
    • 43. SAX
      • SAX stands for Simple API for XML . SAX provides a mechanism for reading data from an XML document. ( Alternative to DOM ).
      • SAX is a callback implementation. It provides event driven API. The SAX events includes:
        • XML Text nodes
        • XML Element nodes
        • XML Processing Instructions
        • XML Comments.
        • Events are fired when each of these XML features are encountered, and again when the end of them is encountered.
        • XML attributes are provided as part of the data passed to element events.
      • The quantity of the memory by SAX parser is much smaller then DOM parser.
      • Because of the event-driven nature of SAX, processing documents can often be faster than DOM-style parsers.
      • SAX also have some draw backs. Certain validation requires full document to be loaded.
    • 44. Classes in .NET
      • The following are important classes defined in .NET to work with XML documents:
        • XmlReader & XmlWriter ( abstract classes )
        • XmlTextReader & XmlTextWriter
        • XmlValidatingReader
        • XmlNodeReader
        • XmlDocument
        • XPathDocument
        • XslTransform
        • XmlSchema
        • XPathNavigator
        • XmlCsvReader
    • 45. XML Query Languages
    • 46. XML Query Languages
      • At present XML has the following three types of Query languages:
        • XPath
        • XQuery
        • XSLT
      • XML support for Microsoft SQL server are:
        • In MS SQL Server 2000 with the FOR XML and OPENXML T-SQL keywords.
        • In MS SQL Server 2005 introduced xml data type that supports XSD schema validation and XQuery based operations and XML indexing .
        • In 2005, FOR XML feature was enhanced.
        • In 2008 enhancements includes,
          • Improved Schema validation,
          • Enhancement to XQuery support,
          • Enhancements in XML Data Manipulation Language ( DML ).
    • 47. XML Query Languages
      • From SQL Server 2005 supports XML as a data type . So it allows you to combine T-SQL Queries and XQuery expressions to search within XML data.
        • An XML data type can be used as a variable, a parameter or a return value from a UDF.
        • With Office 2003, Word & Excel documents as XML.
        • Example of combining T-SQL query and XQuery:
        • Now T-SQL statement with XQuery is:
        • SELECT [id], [Number], [info]. query (‘ Exam/Course ’) As Course FROM [Exams]
        • XQuery is allowed to query data. Microsoft extends this XQuery has named XML DML ( Data Modification Language ) to manipulate data.
        • The following keywords of XML DML are: insert, delete & replace value of.
      ID (int) Number (NCHAR(10)) Info(XML) 1 123456 XML Data 2
    • 48. XPath
      • XPath is a language for addressing parts of an XML document.
      • The most basic construct in XPath is the expression .
      • Using XPath expressions, developers can easily identify nodes in an XML document.
      • The following are XPath expressions:
        • match=“/” the root element
        • Select=“/author/surname” select the surname element which is child of the author element.
        • Select=“@date” select the elements with the attribute “date”
        • Select=“./fname” select fname children of the current node.
    • 49. XPath
      • XPath 2.0 supports 19 primitive data types plus some more derived data types .
      • Within XPath expressions you can use comparison operators such as ( =, <, > and <= , etc., ).
      • In addition XPath 2.0 also supports some string processing functionalities such as upper-case, starts-with , concat , etc.,
      • XPath also supports for expression as well as if expression.
      • An XPath expression can contain location paths, function calls, variable references, unions of sets, comparisons, mathematical operations, and so on.
    • 50. XPath Example
      • Form the Employees XML document check whether is an employee element exists whose first name is ‘vishwa’.
      • /employees/employee/name/first='Vishwa‘ // return boolean
      • Similarly to find the nick name for an employee whose first name is ‘Vishwa’
      • /employees/employee/name[first='Vishwa']/nick
      • To find the gender for an employee whose designation is ‘Project Associate’.
      • /employees/employee[designation='Project Associate']/@gender
    • 51. XPath Example
      • Let us assume the XML document to represent cars as follow:
        • <?xml version='1.0'?>
        • <cars xmlns='urn:schemas-develop-com:cars'>
        • <car make='BMW'>
        • <model>323i</model>
        • <year>2000</year>
        • <price>26,990</price>
        • </car>
        • </cars>
        • The following expression returns the car model
        • /cars/car/model // returns ‘323i’
        • The following expressions yields Boolean value
        • starts-with(model, '32') // returns true
        • car/price < 27,000 // returns false
        • The following expression concatenation the make and model
        • concat(car/make, car/model)
    • 52. XSLT
      • XSLT strands for Extensible Stylesheet Language Transformation
      • XSLT can be used to transform
        • XML to XML ( One format to another format )
        • XML to Non XML ( Eg: HTML, Text, Pdf, etc., )
        • XML to FO ( XML to Formatting Objects )
      • XSLT uses the XPath language for identifying the appropriate data in the source tree.
      • <xsl:template match = XPath Expression >
      • <xsl:apply-templates select = XPath Expression >
        • XPath also provides range of functions that assist XSLT.
      • Within the .NET Framework there is an XML Transform Control to convert XML document contents into different format.
      • <asp:Xml ID=“ x &quot; runat=&quot;server&quot; DocumentSource =&quot; My .xml“ TransformSource =&quot; MyTrans .xslt“ />
    • 53. XSLT
      • The XSLT document is an XML document so starts of XML PI.
      • The root element that declares the document to be an XSL style sheet is <xsl:stylesheet> or <xsl:transform> .
      • With the help of <?xml-stylesheet?> PI, you can reference stylesheet for your XML document.
      • An XSL style sheet consists of one or more set of rules that are called templates .
        • A template contains rules to apply when a specified node is matched. The <xsl:template> element is used to build templates.
        • The match attribute is used to associate a template with an XML element.
        • The value for the match attribute is an XPath expression .
    • 54. XSLT Functions
      • The below are some of the XSLT built-in commands. These functions ranged from string processing, date processing and loop operators etc.,
        • <xsl:template match =“myElement” />
        • <xsl:value-of select =“myElement” />
        • <xsl:for-each select =“myElement” > … </xsl:for-each>
        • <xsl:sort />
        • <xsl:if test=“cost &gt; 20.00”> …. </xsl:if>
        • <xsl:choose > and <xsl:when >
    • 55. XSLT Example
      • The below is an XML document and its transformation file.
      • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
      • <menuitem xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance >
      • < item>Hamburger</item>
      • <item>French Fries</item>
      • <item>Milk Shake</item>
      • <cost>4.99</cost>
      • </menuitem>
      • XSLT file for the above XML document is:
      • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>
      • <xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;>
      • <xsl:template match=&quot;/item&quot;>
      • <xsl:apply-templates />
      • </xsl:template>
      • <xsl:template match=&quot;item&quot;>
      • <xsl:value-of select=&quot;.&quot; /> <br />
      • </xsl:template>
      • <xsl:template match=&quot;cost&quot; />
      • </xsl:stylesheet>
    • 56. XQuery
      • XQuery is based on existing XPath query language.
      • The XQuery language is to XML as the SQL language is to relational databases.
      • XQuery provides a distributed query mechanism across data sources that are exposed as XML and is set to become a universal query language for data integration.
        • So you can use XML Query over SQL Server database.
      • The following are the benefits of XQuery are:
        • A greater expressiveness with an ability to perform complex query operations ( Eg: joins, ordering, sorting, etc., ).
        • A human-friendly, non-XML syntax.
        • Strong typing at both runtime and compile time.
        • A rich set of functions and operators to operate on the XML schema types.
    • 57. XQuery
      • XQuery is a powerful and convenient language designed for processing XML data.
        • XQuery not only used on files in XML format, but also other data including databases whose structure nested, named trees with attributes is similar to XML.
      • The primitive data types in XQuery are same as XML Schema. Some of the data types used in XQuery are:
        • Numbers & Boolean
        • Strings of Characters
        • Types to represent dates, times and duration.
        • A few XML Related types
      • In addition to primitive types also supports derived types. The derived types are just variations or restrictions of other types.
      • The following are other data types to represent XML values:
        • Element, attributes, namespace, text, comment, PI, & document(root) nodes.
        • These types are very similar to corresponding DOM classes. Such as Node, Element, and so on.
    • 58. XQuery Functions
      • Various XQuery functions creates or returns nodes. Take note the function parameters and function results can be primitive values, nodes or sequences of either.
        • document() : Returns the root node of specified XML file.
        • count() : Returns the number of values in the sequence.
        • children() : Returns the sequence of child nodes.
        • sortby() : To sort a sequence.
        • max() : The biggest element in the given element.
        • contains() : Is given element contains specified word or etc.,
    • 59. XQuery User Defined Functions
      • In addition to predefined functions, in XQuery you can also define your own utility function.
        • Below function returns all the descendent nodes of argument:
        • define function descendant-or-self ($x) {
        • $x,
        • for $y in children ($x)
        • return descendant-or-self ($y)
        • }
        • By invoking the above function for the given node as below: descendant-or-self(<a>X<b>Y</b></a>)
        • Evaluates to the sequence:
        • <a>X<b>Y</b></a>; &quot;X&quot;; <b>Y</b>; &quot;Y&quot;
    • 60. XQuery Expressions
      • XQuery borrows path expressions from XPath .
        • XQuery can be viewed as generalization of XPath .
        • All XPath expressions are also XQuery expressions.
        • The following XQuery expression retrieves the <chapter> sub elements from the <book> main element from books.xml file.
        • let $book := document(&quot;books.xml&quot;)/book
        • return $book/chapter
        • The below code retrieves the titles from each chapter from the books.xml file.
        • <html> {
        • let $book := document(&quot;mybook.xml&quot;)/book
        • for $ch in $book/chapter
        • return <h2>{$ch/title)</h2>
        • }</html>
    • 61. XQuery Expressions
      • The below is a SQL query and the corresponding XQuery:
        • The below query is a join of two tables named Customers & Orders.
        • select customers.name from customers, orders where customers.cust_id=orders.cust_id and orders.part_id=&quot;xx&quot;
        • For the above SQL query expression corresponding XQuery is:
        • for $c in customers
        • for $o in orders
        • where $c.cust_id=$o.cust_id and $o.part_id=&quot;xx“
        • return $c.name
      • The below is another example of XQuery:
      • for $seller in document(&quot;users.xml&quot;)
      • return for $item in document(&quot;items.xml&quot;)//item_tuple
      • return if $seller/userid = $item/offered_by
      • then if $seller/name = &quot;Tom Jones&quot; then $item
      • else ()
      • else ()
    • 62. XQuery Expressions
      • Take note, in XQuery every thing is an expression which evaluates to a value.
        • An XQuery program or script is just an expression together with some other optional functions and other definitions.
        • So 3+4 is a valid XQuery expression. //Evaluates 7
        • The below is a query expression which evaluates a string.
        • if (3 < 4) then &quot;yes!&quot; else &quot;no!&quot;
        • In XQuery you can define local variables with ‘let’ statement.
        • let $x := 5 let $y := 6 return 10*$x+$y //Evaluates 56
        • The primitive data types in XQuery is same as XML Schema
      • adsfasf
    • 63. XQuery Expressions
      • XQuery supports the following different types of expressions:
        • Path expressions : ( Based on syntax of XPath )
        • /doc/chapter[5]/section[2]
        • Element constructors : Consists of start and end tags, enclosing an optional list of expressions.
        • <emp empid = {$id}> {$name} {$job} </emp>
        • FLWOR expressions : ( For and Let expressions )
        • FOR $b IN document(“myBooks.xml&quot;)//book
        • WHERE $b/publisher = &quot;Morgan Kaufmann&quot; AND $b/year = &quot;1998&quot;
        • RETURN $b/title
        • Expressions involving operators and functions
        • Conditional expressions (If, then else, etc.)
        • Quantified expressions
        • List constructors
        • Expressions that test or modify data types.
    • 64. XQuery Operators & Functions
      • The following are different types of operator
        • Infix and prefix operators
        • Parenthesized expressions
        • Arithmetic and logical operators
        • Sequence operators UNION, INTERSECT and EXCEPT
        • Functions can be defined in XQuery
      • The function will find the maximum depth of the xml document.
      • DEFINE FUNCTION depth($e AS ELEMENT) AS xsd:integer
      • {
      • IF empty($e/*) THEN 1
      • ELSE max(FOR $c in $e/* RETURN depth($c)) + 1
      • }
      • depth(document(&quot;partlist.xml&quot;))
    • 65. XQuery Conditional Expression
      • IF THEN ELSE construct
      • Make a list of holdings. For journals, include the editor, and for all other holdings, include the author.
      • FOR $h IN //holding
      • RETURN
      • <holding>
      • {$h/title,
      • IF $h/@type = &quot;Journal&quot; THEN
      • $h/editor
      • ELSE
      • $h/author
      • }
      • </holding>
    • 66. XQuery Quantified Expressions
      • Existential and Universal quantifiers
        • Find titles of books in which both sailing and windsurfing are mentioned in the same paragraph.
          • FOR $b IN //book
        • WHERE SOME $para IN $b
        • contains($para, &quot;sailing&quot;)
        • AND contains($para, &quot;windsurfing&quot;)
        • RETURN $b/title
        • Find titles of books in which sailing is mentioned in every paragraph.
        • FOR $b IN //book
        • WHERE EVERY $p IN $b //Para SATISFIES
        • contains($p, &quot;sailing&quot;)
        • RETURN $b/title
    • 67. XQuery Sequence-related Operators
      • A sequence may be constructed by enclosing zero or more expressions separated by commas.
      • For example: ($x, $y, $z) denotes a sequence containing three members represented by variables
      • The >> (precedes) and << (follows) Boolean. functions
      • () denotes an empty sequence.
    • 68. XQuery Operators on Data Types
      • INSTANCE OF returns True if its first operand is an instance of the type named in its second operand.
      • CAST is used to convert a value from one data type to another.
      • TREAT AS causes the query processor to treat an expression as though its data type were a subtype of its static type.
      • VALIDATE executes XML Schema validation.
    • 69. XQuery Functions
      • You can also create new node objects directly in the program. By using an element constructor expression
      • <p>See <a href=&quot;index.html&quot;><i>here</i></a> for info.</p>
      • You can use {curly braces} to embed XQuery expression inside element constructors.
        • let $i := 2 return
        • let $r := <em>Value </em> return
        • <p>{$r} of 10*{$i} is {10*$i}.</p> it creates following node
        • <p><em>Value </em> of 10*2 is 20.</p>
      • The below evaluates the children’s of sequences:
        • children( <p>This is <em>very</em> cool.</p> ) evaluates to
        • &quot;This is &quot;, <em>very</em>, &quot; cool.“
    • 70. XQuery Sequences
      • XQuery expressions actually evaluates to sequences of simple values.
        • The comma operator can be used to concatenate two values or sequences. ( Eg: 3,4,5 ).
        • The simple values can be atomic values or node values.
        • The following is an example of sequences:
        • let $a := 3,4
        • let $b := ($a, $a)
        • let $c := 99
        • let $d := ()
        • return ( count ($a), count($b), count($c), count($d))
        • Evaluates to (2, 4, 1, 0)
        • Iterating over sequences:
      • for $x in (1 to 3) return ($x,10+$x)
    • 71. XML Linking Languages (XLink, XPointer)
    • 72. XML Linking Language
      • The XML Linking Language is called Xlink .
        • In HTML <A> provides linking and URL’s is the pointing mechanism. ( In XML we can still use <A> links).
      • XML Links have two options. Actuate specifies when the link occurs.
        • USER: Here user clicks on link to activate.
        • AUTO: Here the link is automatically activated when displays.
      • In addition SHOW option in XML Links. It specifies what will “show” when link is actuated.
        • NEW: means a new window appears
        • REPLACE: a new window replaces the existing
        • EMBED: the link will be embedded, becoming part of it
        • Eg: <IMG> links are ACTUATE =AUTO and SHOW =EMBED
    • 73. XPointers
      • X Pointers enable us to more precisely point to data within a Web resource.
        • doc: document which contains the reference
        • from: beginning section to be linked
        • to: end of section to be linked
    • 74. XML Style Sheet Specification (CSS, XSLT, XSLT-FO)
    • 75. XML Style Sheet Languages
      • HTML is simple markup tags that Web browsers use to format text on a screen.
        • The basic HTML tags are simple.
        • The HTML tag set identifies the basic document structure. It doesn’t specify much about styles.
      • In 1996, CSS was emerged as a separate stylesheet for formatting HTML.
        • At present CSS was used to style XML as well.
      • In addition to CSS XSL ( Extensible Stylesheet Language ) was specially developed to specify styles for XML.
    • 76. Splitting Content from Style
      • So HTML page contains document structure, contents and Styles. Now you can split the content and styles.
        • HTML + Style Sheet
        • Style sheets can be exchanged with users across authoring, browsing, and viewing tools.
        • The first Web Style language is CSS.
        • A CSS style sheet can be directly placed into an HTML 4.0 document. It is within <STYLE> in <HEAD> or it can be placed in a separate file.
      Style/Content Coding Content Coding Style Coding
    • 77. Simple Style Sheet Example
      • The below is a sample CSS example:
      • <STYLE type=&quot;text/css&quot;>
      • H1 {color: blue; font-size: 18pt; font-style: italic;
      • font-weight: bold;}
      • H2, H3, H4 {font-size: 12pt; font-style: normal;
      • font-weight: bold;}
      • H2 {color: black}
      • H3 {color: aqua}
      • H4 {color: fuchsia}
      • </STYLE>
      • CSS uses a linear model to directly apply formatting to the source HTML or XML.
      • CSS Selectors are used to match styles to tags/attributes.
      • Only a single “flow area” is recognized for CSS styling.
      • CSS can be used along with XSL for rendering XML or XHTML.
      • The CSS2 style sheet is made up of number of rules. Each rule can be declaration. The declaration can be simple or complex.
    • 78. Selectors
      • The patterns which are used to apply styles in CSS are called selectors .
      • A selector may simply be an element name
      • Selectors also may be rich contextual patterns
      • Case-sensitivity of document language element names in selectors depends on the document language.
        • HTML is not case sensitive
        • XML is case sensitive
      • Different kinds of selectors:
        • * Matches any element (universal selector)
        • E Matches any type E element.
        • E F Matches any E element that is a descendant of an F element.
        • E > F Matches any F element that is a child of an element E (child selector)
    • 79. CSS for XML
      • The below is an XML document with stylesheet PI.
      • <?xml version=“1.0”?>
      • <?xml:stylesheet type=&quot;text/css&quot; href=”MyStyles.css&quot;?>
      • <Presentation>
      • <Title> XML and Related Technologies </Title>
      • <Date> 14 th of Dec 2009 </Date>
      • <Speaker>Ch.Vishwa Mohan</Speaker>
      • </Presentation>
      • The below is style sheet for above document.
      • <STYLE type=&quot;text/css&quot;>
      • Title {color: blue; font-size: 14pt; font-style: italic;
      • font-weight: bold;}
      • Date {color: red; font-size: 12pt; font-style: normal; }
      • Speaker {color: black; font-size: 12pt; font-style: normal; }
      • </STYLE>
    • 80. XSL
      • XSL stands for Extensible Style Sheet Language .
      • XSL was designed to specify styles for XML.
      • Unlike CSS XSL is in XML syntax.
      • XSL has a 2-part processing model Transform / Format .
      • XSL also allows for multiple flow areas and support for online and print formatting.
      • XSLT ( XSL Transformation Language ) was the first module of XSL.
    • 81. XSLT with Templates <?xml version=“1.0”?> <xsl:transform xmlns:xsl= “http://www.w3.org/1999/ XSL/ Transform” xsl:version=“1.0”> <xsl:template match=“/”> <xsl:text> <html><head><title>Article Summary</title></head> <body><h1>Article Summary by Author</h1></xsl:text> <xsl:apply-templates> <xsl:text></body></html></xsl:text> </xsl:template/> <xsl:template match=“author”> <xsl:text><p><b>Author:&nbsp;</b></xsl:text> <xsl:apply-templates select=”/author/surname”/> <xsl:text>,&nbsp;</xsl:text> <xsl:apply-templates select=:”/author/fname”/></p> </template>
    • 82. Web Services & SOAP
    • 83. From Objects to Services
      • Polymorphism
      • Encapsulation
      • Subclassing
      • Message-based
      • Schema+Contract+Policy
      • Broad Interop
      • Location Transparent
      • Tight Coupling
      • Runtime Metadata
      Object-Oriented Service-Oriented Component-Oriented 1980s 2000s 1990s
    • 84. What is SOA ?
      • Service Oriented Architecture ( SOA ) is an approach to loosely coupled, protocol independent, standards-based distributed computing where software resources available on the network are considered as Services.
        • SOA represents business functions as shared, reusable services.
        • SOA is not a product but an architectural paradigm .
        • The software component in a SOA are services based on standard protocol.
        • In SOA share schema and contract not class/database.
        • Service orientation provides the benefits of loosely coupled , message-oriented programming.
      • Two critical characteristics are realized for SOA development are:
        • Services are truly independent.
        • Services can be managed.
    • 85. Four Tenets of Service Orientation SERVICE ORIENTATION Compatibility Based On Policy Share Schema & Contract, Not Class Services Are Autonomous Boundaries Are Explicit
    • 86. What is a Service ?
      • Services are reusable units providing business functionality that are ..,
        • Clearly defined using standard policies, practice and framework.
        • Clearly described (usually with XML)
        • Autonomous
        • Abstraction of the underlying business logic and functionality.
      • Here functionality exposed via structured messaging scheme.
      • Not XML Centric, Not HTTP centric.
        • JSON, XML, SOAP, .., over TCP, HTTP, Named Pipes, MSMQ ..,
      • Messages sent and received.
      • Moves from client server model to a sender/receiver model.
      • Versioning independency.
    • 87. Web Services
      • The Web Service technology is simulated (inspired) by SOA.
        • Take note Web Services and Services are not identical.
      • In Web Services, XML used as “ wire format ” of RPC that is SOAP.
      • With Web Services following specifications are used:
        • SOAP : XML based messaging protocol
        • UDDI: Yellow Pages for Web Services
        • WSDL: Web Service Description Language
      • XML Web Services use SOAP as the primary transport and serialization protocol.
    • 88. Web Services
    • 89. SOAP
      • SOAP is a XML based protocol for invoking Remote Procedure Calls, specially for Web Applications.
      • SOAP is a specification that defines the XML format for messages.
      • SOAP uses the following transports HTTP, MSMQ, TCP/IP, SMTP, etc.,. Basically SOAP doesn’t care what the transport is.
        • It can be used combination of all the above transports.
      • The most compelling feature of SOAP is that it has been implemented on many different hardware and software platforms.
    • 90. SOAP Message <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?> < env:Envelope xmlns:env= &quot; http://www.w3.org/2002/12/soap-envelope &quot;> < env:Header > <n:alertcontrol xmlns:n=&quot;http://example.org/alert&quot;> <n:priority>1</n:priority> <n:expires>2012-12-12T00:00:00</n:expires> </n:alertcontrol> < /env:Header > < env:Body > <m:alert xmlns:m=&quot;http://example.org/alert&quot;> <m:msg>World is going to destroy ! </m:msg> </m:alert> < /env:Body > < /env:Envelope >
    • 91. SOAP
      • SOAP is a light weigh protocol for the exchange of information in a decentralized, distributed environment. It is an XML based protocol consists of three parts:
        • An Envelope
        • Optional Header
        • Mandatory Body
      • A SOAP message must not contain DTD. Similarly SOAP message must not contain processing instructions.
      • SOAP versioning is based on XML namespaces:
        • SOAP 1.1 is identified by the http://schema.xmlsoap.org/soap/evelope namespace.
        • SOAP 1.2 is identified by the http://www.w3.org/2002/12/soap-envelop namespace.
    • 92. SOAP Envelope
    • 93. Schema for SOAP Envelop
      • The below schema states every SOAP envelope consists of optional header and mandatory body.
      • <schema targetNamespace='urn:schemas-xmlsoap-org:soap.v1'>
      • <element name='Envelope'>
      • <type>
      • <element name='Header' type='Header' minOccurs ='0' />
      • <element name='Body' type='Body' minOccurs ='1' />
      • </type>
      • </element>
      • </schema>
    • 94. SOAP Faults
      • Exceptions thrown by an Web Services are sent back to the client in the form of SOAP Fault .
        • A SOAP Fault is a <Fault> XML element within the SOAP message.
        • In ASP.NET these faults are converted to SoapException .
      • The SOAP Fault element is used to carry error and/or status information within a SOAP message.
      • The SOAP Fault element defines the following sub elements:
        • FaultCode
        • FaultString
        • FaultActor
        • Detail
        • Node
        • Role
    • 95. RSS
    • 96. What is RSS
      • RSS ( Really Simple Syndication ) is a family of web feed formats used to publish frequently updated works such as blog entries, news, headlines, audio and video in standardized format.
        • An RSS document ( called as “feed”, ‘web feed” or “channel” ) includes full or summarized text, plus metadata such as publishing dates and authorship.
        • RSS feeds can be read by an RSS reader/feed reader , or aggregator , which can be web based, desktop based or mobile devices based.
        • The feeds are stored in XML format.
        • RSS formats are specified using XML , a generic specification for the creation of data formats.
        • Users can subscribe the feed by entering RSS URI, or by clicking on RSS icon in a web browser.
    • 97. Simple RSS Example <rss version=&quot;0.91&quot;>   <channel>      <title>XML.com</title>      <link>http://www.xml.com/</link>      <description>XML.com features services for XML community</description>      <language>en-us</language>     <item>        <title>Normalizing XML, Part 2</title>        <link>http://www.xml.com/pub/a/2002/12/04/normalizing.html</link>        <description> Relation normalization techniques to XML schema data modeling </description>     </item>     <item>        <title>The .NET Schema Object Model</title>        <link>http://www.xml.com/pub/a/2002/12/04/som.html</link>        <description>Describes in detail the use of the .NET Schema Object Model </description>     </item>   </channel> </rss>
    • 98. Thank You ! You can reach me at : [email_address] 9490995632

    ×