Unit-1 XML To RWD
Unit-1 XML To RWD
DEVELOPMENT
SITA1502
Subject Code : SITA1502
Subject Name: Customer Interface Design
and Development
<f:table>
<f:name>african coffee table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
• In the example above, there will be no conflict because the two <table> elements have different names.
XML Namespaces - The xmlns Attribute
• When using prefixes in XML, a so-called namespace for the prefix must be defined.
• The namespace is defined by the xmlns attribute in the start tag of an element.
• The namespace declaration has the following syntax. xmlns:prefix="uri".
• <root>
<h:table xmlns:h="http://www.W3.Org/TR/html4/">
<h:tr>
<h:td>apples</h:td> <f:table
<h:td>bananas</h:td> xmlns:f="http://www.W3schools.Com/furniture">
</h:tr> <f:name>african coffee table</f:name>
</h:table> <f:width>80</f:width>
<f:length>120</f:length>
</f:table>
</root>
XML Namespaces - The xmlns
Attribute(con…)
• Namespaces can be declared in the elements where they are used or in the XML root element:
<root
xmlns:h="http://www.W3.Org/TR/html4/"
xmlns:f="http://www.W3schools.Com/furniture">
<h:table>
<h:tr>
<h:td>apples</h:td>
<h:td>bananas</h:td>
</h:tr>
</h:table>
<f:table>
<f:name>african coffee table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
</root>
XSD Example - ‘note.xsd’
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://Www.W3.Org/2001/xmlschema">
<xsd:element Name="note">
<xsd:complextype>
<xsd:sequence> This is the root element, Associates “xsd” namespace
with type specified below with XML Schema
<xsd:element Name="to" Type="xsd:string"/>
<xsd:element Name="from" Type="xsd:string"/>
<xsd:element Name="heading" Type="xsd:string"/>
<xsd:element Name="body" Type="xsd:string"/>
</xsd:sequence>
</xsd:complextype>
</xsd:element>
</xsd:schema>
Referencing a Schema in an XML Document
<?xml version="1.0"?>
<Note xmlns="https://www.W3schools.Com"
xmlns:xsi="http://www.W3.Org/2001/xmlschema-instance"
xsi:schemalocation="https://www.W3schools.Com note.xsd">
<to>tove</to>
<from>jani</from>
<heading>reminder</heading>
<body>don't forget me this weekend!</Body>
</note>
Explanation
• The <schema> element is the root element of every XML schema
• xmlns:xsd=http://www.W3.Org/2001/xmlschema indicates that the elements and data types used in the
schema come from the "http://www.W3.Org/2001/xmlschema" namespace and should be prefixed
with xsd:
• xmlns="https://www.w3schools.com" this declaration tells the schema-validator that all the elements
used in this XML document are declared in the "https://www.w3schools.com" namespace
• Once you have the XML schema instance namespace available:
xmlns:xsi="http://www.W3.Org/2001/xmlschema-instance"
• We can use the schemalocation attribute. This attribute has two values, separated by a space. The first
value is the namespace to use. The second value is the location of the XML schema to use for that
namespace:
xsi:schemalocation="https://www.W3schools.Com note.xsd"
DTD vs XSD
XML PARSER
• XML parser is a software library or a package that provides interface for
client applications to work with XML documents.
• It checks for proper format of the XML document and may also validate the
XML documents. Modern day browsers have built-in XML parsers.
• The goal of a parser is to transform xml into a readable code.
XML - Document object model
(DOM)
XSL (Extensible Stylesheet Language)
XSL (Extensible Stylesheet Language)
• XForms is an XML format used for collecting inputs from web forms.
XForms was designed to be the next generation
of HTML / XHTML forms.
• XForms uses XML to create input forms on the Web.
What You Should Already Know
Before you continue you should have a basic understanding of the following:
HTML
HTML Forms
XHTML
XML
What Is XForms?
XForms is the next generation of HTML forms
XForms is richer and more flexible than HTML forms
XForms is platform and device independent
XForms separates data and logic from presentation
XForms uses XML to define form data
XForms stores and transports data in XML documents
XForms contains features like calculations and validations of forms
XForms reduces or eliminates the need for scripting
XForms is a W3C Recommendation
XForms is the successors of HTML Forms
Forms are an important part of many web applications today. An HTML form makes it
possible for web applications to accept input from a user.
Today, ten years after HTML forms became a part of the HTML standard, web users
do complex transactions that are starting to exceed the limitations of standard HTML
forms.
XForms provides a richer, more secure, and device independent way of handling web
input.
XHTML
TRANSFORMATIONS
XSL
T
XSL has two independent languages:
<xsl:for-each select=node-set-expression>
</xsl:for-each>
XLink Syntax
In HTML, the <a> element defines a hyperlink. However, this is not how
it works in XML. In XML documents, you can use whatever element
names you want - therefore it is impossible for browsers to predict what
link elements will be called in XML documents.
An example of how to use XLink to create links in an XML document:
<homepages xmlns:xlink="http://www.google.com">
</homepages>
To get access to the XLink features we must declare the XLink namespace. The
XLink namespace is: "http://www.google.com".
The xlink:type and the xlink:href attributes in the <homepage> elements come
from the XLink namespace.
15
ROOT
XPath example university
/university/instructor instructor
Id
_123456789
instructor
Id
_333445555
instructor
Id
_999887777
ROOT
instructor
/university/instructor
Id
_123456789
instructor
Id
_333445555
Instructor
Id
_999887777
ROOT
university
XPath(example)
instructor
Id
/university/
_123456789
instructor
Instructor
id
_333445555
instructor
Id
_999887777
ROOT
/university/instructor instructor
Id
_123456789
instructor
Id
_333445555
instructor
Id
_999887777
19
ROOT
XPath (xample) university
/university/instructor
instructor
Id
• for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title
return $x/title
© 2013 Interactive
11/8/2013 93
Accessibility
What is RWD?
95
Images automatically adjusted and also the content of that
web site adjusts to the screen of a same website.
• How a website is structured, how information is spread through the website and how
critical is the content for the particular purpose of the website are some key
considerations while designing navigational elements for a responsive website.
Component
Of Website