0% found this document useful (0 votes)
28 views

Unit 2 XML

Uploaded by

2313323037015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Unit 2 XML

Uploaded by

2313323037015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

XML schema is a language which is used for expressing constraints about XML
documents. There are so many schema languages which are used now a days for example
Relax- NG and XSD (XML schema definition).

An XML schema is used to define the structure of an XML document. It is like DTD but
provides more control on XML structure.

XML Schema Data types


There are two types of data types in XML schema.

1. simpleType
2. complexType

simpleType
The simpleType allows you to have text-based elements. It contains less attributes, child
elements, and cannot be left empty.

complexType
The complexType allows you to hold multiple attributes and elements. It can contain
additional sub elements and can be left empty.

2
XQuery: Introduction and Simple Example

XQuery is a query language designed to query XML data. It allows you to extract and
manipulate information from XML documents.

Example XML Data

Let's assume we have an XML file named books.xml:

<books>
<book>
<title>Learning XML</title>
<author>Erik T. Ray</author>
<price>39.95</price>
</book>
<book>
<title>Programming Web Services with SOAP</title>
<author>James Snell</author>
<price>29.95</price>
</book>
<book>
<title>XQuery Kick Start</title>
<author>James McGovern</author>
<price>49.95</price>
</book>
</books>

Simple XQuery Example

Suppose you want to retrieve all the book titles from this XML file.

XQuery Code:
for $book in doc("books.xml")/books/book
return $book/title

Explanation of XQuery Code:

1. for $book in doc("books.xml")/books/book:


○ This expression loops through each <book> element inside the <books>
element in the books.xml file.
○ The doc() function is used to load the XML document.
2. return $book/title:
○ For each iteration, it returns the title of the current <book> element.

Output:
Learning XML
Programming Web Services with SOAP
XQuery Kick Start

More Complex Example: Books Priced Below 40

You can modify the query to filter the books based on price.

XQuery Code:

for $book in doc("books.xml")/books/book


where $book/price < 40
return $book/title

Explanation:

1. The where clause filters books with a price less than 40.
2. It returns only the titles of books that meet this condition.

Output:

Learning XML
Programming Web Services with SOAP

This is a simple introduction to how XQuery works with XML data to extract and filter
information.

XML Software Infrastructure (10 Marks Summary)

Overview: XML (eXtensible Markup Language) software infrastructure includes essential


tools and systems to support XML-based applications. This infrastructure enables processing,
storage, transformation, and communication of XML data in both data-oriented and
content-oriented applications.

1. Fundamental Components:
● XML Processors: These parse and validate XML documents. They are categorized
into tree-based (DOM) and event-based (SAX) processors, offering flexibility
depending on the application's memory and access needs.
● XSLT Processors: Transform XML documents into other formats like HTML or PDF
using stylesheets. Widely used processors include Apache’s Xalan and Microsoft’s
XSLT engines.
● Storage Systems: XML documents can be stored in different ways, including
Database Management Systems (DBMS), Content Management Systems (CMS), or
native XML stores (e.g., Tamino, TEXTML Server).

2. Server Infrastructure:

● Data Servers: Facilitate access and aggregation of XML data from various sources,
often providing XML documents in response to requests. They support mapping
between database schemas and XML structures, enabling smooth data interchange.
● Application Servers: Handle business logic and integrate XML through SOAP
messaging and XSLT transformations, enabling XML document exchange between
components. Examples include BEA WebLogic, IBM WebSphere, and Microsoft
.NET.
● Content Servers: Responsible for dynamic presentation and delivery of XML content
(e.g., HTML generation through XSLT). They also manage searching and syndicating
XML-based content.

3. XML in Web Services:

● SOAP: XML-based messaging protocol used for communication between web


services.
● WSDL: Defines web services and their operations using XML.
● ebXML: Focuses on using XML for e-business transactions, providing a standardized
framework for business document exchanges.

4. Content Management Systems (CMS):

● CMSs manage the storage, version control, and distribution of XML content. They
support collaborative content creation, including XML documents. Examples include
Vignette and Interwoven TeamSite.
● CMS also assists with indexing and delivering content, ensuring that documents are
available in different formats and media.

5. Development Tools:

● Development tools help manipulate XML documents and generate code for XML
transformation and processing. Popular tools include Altova XMLSpy and TIBCO
TurboXML, which provide tree-based views and auto-generate XSLT stylesheets.

Conclusion:
The XML software infrastructure is comprehensive, supporting various tasks from XML
parsing, transformation, and storage, to integration with web services and content
management systems. It is critical to choose the right components based on the needs of
data-oriented or content-oriented applications to ensure efficiency and scalability.

Layout tools, transformation tools, and authoring tools are essential components of XML
software infrastructure for content management and presentation.

Layout tools help designers create visual layouts for XML content, allowing them to define
how elements should appear in different formats using XSL (Extensible Stylesheet
Language) without requiring deep technical knowledge.

Transformation tools enable developers to convert XML data between different formats or
from XML to non-XML formats using XSLT (Extensible Stylesheet Language
Transformations). They provide visual mapping and debugging features to simplify
transforming data from one structure to another.

Authoring tools are used to create and edit XML documents, offering word-processing-like
interfaces for content creators, and often include features for structured content input,
template-based creation, and placeholders for dynamic data, streamlining the process of
generating high-quality, structured XML content.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy