Week 9 - XML and Web Data
Week 9 - XML and Web Data
ke
OUTLINE
• 2. Overview of XML
• 3. XML Schema
Definition: XML (eXtensible Markup Language) is a markup language used to structure and
store data in a hierarchical format. Semi-structured data refers to data that does not
conform to a rigid structure like traditional databases but still has some structure and
organization.
Explanation:
manner, using elements enclosed in tags. It provides a flexible way to structure and
schema, semi-structured data allows for variations in data structure. For example,
different XML documents can have different elements or attributes, yet they can still
be processed.
product listing may have different attributes, such as name, price, manufacturer, and
services, configuration files, and data exchange between heterogeneous systems. For
instance, a web service that provides weather data can deliver XML-formatted
2. Overview of XML:
Explanation:
• Basic Syntax: XML documents consist of text data enclosed in tags. Tags are used to
define elements, attributes, and their relationships. Tags are enclosed in angle
• Elements and Attributes: Elements are the building blocks of XML documents and
can contain text data or other elements. Attributes provide additional information
about elements and are specified within the opening tag of an element.
• Scenario: An online book catalog uses XML to represent book listings. Each <book>
Abdulrahman A. Mohamed Mobile: +254 713 500 814 Email: [email protected]
element contains attributes like title, author, and <price> elements for book
information.
system may specify settings like database connection details, caching options, and
3. XML Schema:
Definition: XML Schema defines the structure, data types, and constraints that XML
documents must adhere to. It provides a schema definition language for validating XML
data.
Explanation:
including the elements and attributes that are allowed, their order, and their
• Data Type Validation: XML Schema can enforce data type constraints, ensuring that
data within elements and attributes adhere to specified data types (e.g., strings,
numbers, dates).
• Scenario: An online order processing system uses XML Schema to validate incoming
order data. The schema defines the structure and data types for customer
where HL7 (Health Level Seven) XML schemas define the structure of medical
Abdulrahman A. Mohamed Mobile: +254 713 500 814 Email: [email protected]
Definition: XML Query Languages enable the retrieval and manipulation of data from XML
Explanation:
• XPath: XPath is a query language that allows you to navigate through an XML
document to select elements and attributes based on their paths and conditions.
• XQuery: XQuery is a more powerful query language that can perform complex
queries, aggregations, and transformations on XML data. It's especially useful for
• Scenario: An e-commerce website uses XPath to extract product details, such as the
names and prices of all products in a specific category, from an XML-based product
catalog.
extract and transform XML content for presentation on websites. For example, it
can extract news articles from an XML database, apply formatting, and display them
on a news portal.
These concepts and tools in XML play a significant role in various domains, including web