Unit-IV; Professional Sales Representative (PSR).pptx
Xml Session No 1
1.
2. •XML stands for EXtensible Markup Language
•XML is a markup language much like HTML
•XML was designed to carry data, not to display data
•XML tags are not predefined. You must define your own tags
•XML is designed to be self-descriptive
•XML is a W3C Recommendation
3. There are two current versions of XML. The first XML 1.0 was initially defined in
1998 and it has undergone minor changes/revisions since then. Though changes
have been done, a new revision number has not been assigned to this version. It is
called XML 1.0 5th edition, with the latest edition (5th) being released on 26th Nov
2008.
The second version XML 1.1 was initially published on 4th Feb 2004, the same day
as the XML 1.0, 3rd edition. XML 1.1 is currently in its 2nd edition which was
released on 16th Aug 2006. It contains certain features that are expected to make
XML easier to use.
6. The various components of an XML
document used for representing data in a
hierarchical order are:
Processing Instruction (PI)
Tags
Elements
Content
Attributes
Entities
Comments
Ashok K Sharma
11/25/13
6
7. <?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
<!--STOREDATA is the root element-->
<STORE STOREID=“S101”>
<PRODUCTNAME>Toys</PRODUCTNAME>
Processing Instruction (PI)
Provides information on how
the XML file should be
processed.
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Ashok K Sharma
11/25/13
7
8. <?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
Tags
<!--STOREDATA is the root element-->
<STORE STOREID=“S101”>
Is a means of identifying
<PRODUCTNAME>Toys</PRODUCTNAME> data. Tags consist of start
tag and end tag.
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Ashok K Sharma
11/25/13
8
9. <?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
Root Element
<!--STOREDATA is the root element-->
<STORE STOREID=“S101”>
Contains all other elements
<PRODUCTNAME>Toys</PRODUCTNAME> in the document.
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Ashok K Sharma
11/25/13
9
10. <?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
<!--STOREDATA is the root element-->
Comments
<STORE STOREID=“S101”>
<PRODUCTNAME>Toys</PRODUCTNAME> Are statements used to
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Ashok K Sharma
11/25/13
explain the XML code.
10
11. <?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
<!--STOREDATA is the root element-->
<STORE STOREID=“S101”>
<PRODUCTNAME>Toys</PRODUCTNAME> Child Elements
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Ashok K Sharma
11/25/13
Are the basic units used to
identify and describe data in
XML.
11
12. Components of an XML Document (Contd.)
<?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
<!--STOREDATA is the root element-->
<STORE STOREID=“S101”>
<PRODUCTNAME>Toys</PRODUCTNAME> Attributes
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Ashok K Sharma
11/25/13
Provide additional
information about the
elements for which they are
declared.
12
13. <?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
<!--STOREDATA is the root element-->
<STORE STOREID=“S101”>
<PRODUCTNAME>Toys</PRODUCTNAME>
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Content
Refers to the information
represented by the elements
of an XML document. An
element can contain:
• Character or data content
• Element content
• Combination or mixed
content
Ashok K Sharma
11/25/13
13
14. <?xml version=“1.0” encoding=“UTF-8”?>
<STOREDATA>
<!--STOREDATA is the root element-->
<STORE STOREID=“S101”>
<PRODUCTNAME>Toys</PRODUCTNAME>
<QUANTITY>100</QUANTITY>
<DISPLAY>The price of this toy
is < 200 </DISPLAY>
</STORE>
</STOREDATA>
Ashok K Sharma
11/25/13
Entities
Is a set of information that
can be used by specifying a
single name.
14
15. Every start tag must have an end tag.
Empty tags must be closed using a forward
slash (/).
All attribute values must be given in double
quotation marks.
Tags must have proper nesting.
XML tags are case sensitive.
Ashok K Sharma
11/25/13
15
16.
17. Element declaration
Syntax
<!ELEMENT element-name (element-content)>
Example
<!ELEMENT employee(#PCDATA)>
Any Element content
<!ELEMENT employee ANY>
Other Child Element as Content
<!ELEMENT employee (name,phone,age,dept)>
At least One occurrence of child element
<!ELEMENT employee (name,contact+)>
Zero or more occurrence of element
<!ELEMENT employee(name,phone,email*)>
Ashok K Sharma
11/25/13
17
18. Attribute Declaration
Syntax
<!ATTLIST element-name attribute-name attribute-type default-value>
Example
<!ATTLIST payment type CDATA "check">
Entities
Entity References
Character
<
>
&
"
'
<
>
&
"
'
Ashok K Sharma
11/25/13
18
19. <?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>
http://www.xmlvalidation.com/
Ashok K Sharma
11/25/13
19
20. Note.dtd
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
Referring DTD from XML
<!DOCTYPE root-element SYSTEM "filename">
Note.xml
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!
</body>
</note>
Ashok K Sharma
11/25/13
20
21.
22. An XML schema defines the list of
elements and attributes that can be
used in an XML document.
An XML schema specifies the order in
which the elements appear in the XML
document, and their data types.
Microsoft has developed the XML
Schema Definition (XSD) language to
define the schema of an XML
document.
Ashok K Sharma
11/25/13
22
23. Some of the advantages of creating an XML
schema by using XSD are:
XSD provides control over the type of data that can
be assigned to elements and attributes.
XSD enables you to create your own data types.
XSD enables you to specify restrictions on data.
The syntax for defining an XSD is the same as the
syntax used for XML documents.
XML schema content models can be used to
validate mixed content.
XML schema is extensible.
XML schema is self documenting.
Ashok K Sharma
11/25/13
23
24. Data Types in XML Schemas (Contd.)
In an XML schema created using
XSD, every element must be
associated with a data type.
XSD Data Types
Primitive
User Defined
Simple Type
Complex Type
Ashok K Sharma
11/25/13
24
25. boolean
byte
date
dateTime
decimal
double
float
int
A Boolean true or false value. Representations of true are "true" and "1"; false
is denoted as "false" or "0".
A signed 8-bit integer in the range [-128, 127].
Represents a specific date
Represents a specific instant of time. It has the form YYYY-MM-DDThh:mm:ss
folowed by an optional time-zone suffix
Any base-10 fixed-point number.
A 64-bit floating-point decimal number
A 32-bit floating-point decimal number
Represents a 32-bit signed integer in the range [-2,147,483,648, 2,147,483,647].
integer
Represents a signed integer
One of the standardized language codes
language
A signed, extended-precision integer; at least 18 digits are guaranteed
long
negativeInteger
Represents an integer less than zero
nonNegativeInteger An integer greater than or equal to zero
nonPositiveInteger An integer less than or equal to zero.
positiveInteger
An extended-precision integer greater than zero
string
Any sequence of zero or more characters.
26. 1. Complex Type : A data type which contains other elements.
2. Simple Type : A data type which contains one formatted element.
27.
28. A CSS is a text file containing one or
more rules or definitions for the style
characteristics of a particular
element.
It controls how tags are formatted in
XML and HTML documents.
The CSS file can be included in XML
documents with the same data
structure.
Ashok K Sharma
11/25/13
28
29. A CSS can be applied to an XML
document using the following
syntax:
<?xml:stylesheet type="text/css"
href="path-name"?>
Ashok K Sharma
11/25/13
Specifies the type of
formatting that is being used.
29
30. Introducing XSL
CSS does not support the reorder, sort, and display of
elements based on a condition.
For such advanced formatting, XML supports
Extensible Style Sheet Language (XSL).
XSL has two parts:
XSL Transformations (XSLT)
XML Path (XPath)
XSL:
Contains instructions on how an XML document should
be transformed into an HTML or an XHTML document.
Uses XPath expressions to extract specific data from an
XML document.
The XSLT processor transforms the XML document
into an HTML or XHTML or into another XML
document.
Ashok K Sharma
11/25/13
30
31. The XSLT processor applies the
transformation information to the
source document and builds the
result tree as shown in the following
figure.
MSXML Parser
XSLT style sheet
XSLT tree
XSLT
processor
XML document
Ashok K Sharma
11/25/13
Result tree
Source tree
31
32. XSLT provides the following
elements to select and format data:
stylesheet
value-of
for-each
sort
text
Ashok K Sharma
11/25/13
32
33. XSLT provides the following
elements to select and format data:
stylesheet
value-of
for-each
sort
text
Ashok K Sharma
11/25/13
Instructs the browser that the document is a style
sheet file.
Is the root element for all XSLT style sheets.
Is written as:
<xsl:stylesheet
xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
version="1.0">
33
34. XSLT provides the following
elements to select and format data:
stylesheet
value-of
for-each
sort
text
Ashok K Sharma
11/25/13
Displays the value of the specified element or
attribute.
Follows the syntax:
<xsl:value‑of
select="elementname/attributename"/>
34
35. XSLT provides the following
elements to select and format data:
stylesheet Instructs the XSLT processor to process the
information for each instance of the specified pattern.
value-of
Follows the syntax:
<xsl:for-each select="pattern">
for-each [action to be performed]
</xsl:for-each>
sort
text
Ashok K Sharma
11/25/13
35
36. XSLT provides the following
elements to select and format data:
stylesheet
value-ofand Sorts data based on the values assigned to elements
for-each attributes.the syntax:
Follows
<xsl:sort select="expression"
sort
order="ascending | descending"
case-order="upper-first | lower-first“
data-type="text | number | qname"/>
text
Ashok K Sharma
11/25/13
36
37. XSLT provides the following
elements to select and format data:
stylesheet
value-of
for-each
sort
text
Ashok K Sharma
11/25/13
Generates constant text in the output and displays
labels.
Follows the syntax:
<xsl:text> Text to be displayed as
label </xsl:text>
37
38. Used with the if and choose elements to narrow down the
formatting criteria.
The following table lists various comparison and Boolean
operators.
Operator
Meaning
Example
Equal to
PRICE[. = 20]
PRODUCTNAME[. = ‘Mini Bus’]
Not equal to
PRICE[. != 20]
PRODUCTNAME[. != ‘Barbie Doll’]
<
Less than
PRICE[. < 20]
>
Greater than
PRICE[. > 20]
<=
Less than or equal to
PRICE[. <= 20]
>=
Greater than or equal to
and
Logical AND
PRICE[. >= 20]
PRICE[. > 20 and . < 30]
or
Logical OR
PRICE[. = 20 or . = 45]
not
Negation operator
PRICE[not(. = 30)]
=
!=
Ashok K Sharma
11/25/13
38
39. Operator/Special
Character
Example
Description
@
@PRODUCTID
Used as a prefix for the attribute.
@*
@*
Selects all attributes.
:
:
Separates the namespace prefix from the element or
attribute name.
( )
(PRICE*QUANTITY)
Used to group operations.
[ ]
[@PRODUCTID='P001']
Applies a filter pattern.
+
num1 + num2
Returns the sum of two numbers.
-
num1 - num2
Returns the difference of two numbers.
*
num1 * num2
Returns the product of two numbers.
div
num1 div num2
Returns the quotient of two numbers.
mod
num1 mod num2
Returns the modulus, that is, the remainder of integer
division.
40.
41. DOM defines the logical structure of documents.
DOM provides an Application Programming Interface
(API) for dynamically accessing and manipulating a
document.
The DOM objects have associated methods and
properties to access and manipulate a document.
A DOM-enabled parser is required to use the features
provided by DOM.
A DOM-enabled parser:
Parses an XML document to ascertain its validity.
Creates an in‑memory representation of the XML
document as a tree structure.
Ashok K Sharma
11/25/13
41
42. MSXML parser:
Is the Microsoft implementation of DOM.
Provides fundamental as well as added interfaces to access
documents.
The following figure represents how a DOM tree is used by
applications to access data.
MSXML Library
XML
Document
Parser
Parsed
Document
DOM Tree
Root
Child
Application
Text
Child
Text
Ashok K Sharma
11/25/13
42
43. Following are the key DOM objects:
Document
Element
Node
NodeList
Attr
Text
ParseError
Ashok K Sharma
11/25/13
43
44. Following are theis key DOM objects:
It the top-level object that implements all the
Document
Element
Node
NodeList
Attr
Text
ParseError
Ashok K Sharma
11/25/13
basic DOM methods.
It also has methods that support XSLT.
It has methods that can be used to navigate,
query, and modify the content and structure of
an XML document.
Some of the methods provided by this object
are createElement(), createAttribute(),
createComment() , and createTextNode().
Some of the properties provided by this object that
help in manipulating the information contained in
the object are async, childNodes, firstChild,
documentElement, xml, and readyState.
44
45. Following are the key DOM objects:
Document
Element
Node
NodeList
Attr
Text
ParseError
Ashok K Sharma
11/25/13
It represents all the element nodes in an XML
document.
The attributes associated with the elements
are
considered to be the properties of the elements
rather than their child elements.
Some of the methods of this object are
also inherited from the Node object.
Some of the methods provided by this object
are
getAttribute(),
getElementsByTagName(),
normalize(), and removeAttributeNS().
45
46. Following are the key DOM objects:
Document
Element
Node
NodeList
Attr
Text
ParseError
Ashok K Sharma
11/25/13
It represents a single node in the XML document
tree structure.
It provides methods to work with child elements.
Some of the methods of this object are
appendChild(newChild),
insertBefore(newNode,refNode),
and removeChild(nodeName).
46
47. Following are the key DOM objects:
Document
Element
Node
NodeList
Attr
Text
ParseError
Ashok K Sharma
11/25/13
It provides a list of nodes present in an XML
document for manipulation.
This object enables you to iterate through a
collection of nodes.
Some of the method of this object are item()
and nextNode().
47
48. Following are the key DOM objects:
Document
Element
Node
NodeList
Attr
Text
ParseError
Ashok K Sharma
11/25/13
It represents an attribute of the Element
object.
It is also a Node and inherits various attributes
and methods of Node object.
An attribute is not considered by the DOM to
be
a child node of an element, but rather a property.
48
49. Following are the key DOM objects:
Document
Element
Node
NodeList
Attr
Text
ParseError
Ashok K Sharma
11/25/13
It represents the text inside an XML element in
the node tree.
The splitText() method is associated with
this object.
49
50. XML DOM Objects in Scripts
The DOM objects can be used within
scripting languages such as
JavaScript and VBScript.
Using DOM objects in scripts allow
dynamically applying a style sheet to
an XML document.
The code for using DOM objects for
accessing an XML document needs
to be used as an HTML page.
Ashok K Sharma
11/25/13
50
Notas do Editor
While explaining the definition of system forensics, ask the students to note the following key words in the definition:
Identify
Extract
Process
Analyze
Digital and hardware evidence
Tell the students that these form an integral aspect of system forensics and would be discussed in detail.
Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on:
The role that system forensics plays in organizations having an IT set up.
This discussion will serve as a precursor to the next slide.
While explaining the definition of system forensics, ask the students to note the following key words in the definition:
Identify
Extract
Process
Analyze
Digital and hardware evidence
Tell the students that these form an integral aspect of system forensics and would be discussed in detail.
Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on:
The role that system forensics plays in organizations having an IT set up.
This discussion will serve as a precursor to the next slide.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Tell the students that the key words that they were told to note while discussing the definition of system forensics, will be elaborated as part of the system forensics process.
Introduce the students to the different types of threats that systems face by:
Asking the students to give examples of what they think are environmental and human threats.
Asking the students to give instances of what they think are malicious and non-malicious threats.
Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
Introduce the students to the different types of threats that systems face by:
Asking the students to give examples of what they think are environmental and human threats.
Asking the students to give instances of what they think are malicious and non-malicious threats.
Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
While explaining the definition of system forensics, ask the students to note the following key words in the definition:
Identify
Extract
Process
Analyze
Digital and hardware evidence
Tell the students that these form an integral aspect of system forensics and would be discussed in detail.
Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on:
The role that system forensics plays in organizations having an IT set up.
This discussion will serve as a precursor to the next slide.
Introduce the students to the different types of threats that systems face by:
Asking the students to give examples of what they think are environmental and human threats.
Asking the students to give instances of what they think are malicious and non-malicious threats.
Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
While explaining the definition of system forensics, ask the students to note the following key words in the definition:
Identify
Extract
Process
Analyze
Digital and hardware evidence
Tell the students that these form an integral aspect of system forensics and would be discussed in detail.
Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on:
The role that system forensics plays in organizations having an IT set up.
This discussion will serve as a precursor to the next slide.
Elaborate on the role that system forensics plays in an organization, based on the discussion in the previous slide and the information given on this slide.
Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
Connect the information given on this slide to the initial discussion held on the different types of system-related crimes.
While explaining the definition of system forensics, ask the students to note the following key words in the definition:
Identify
Extract
Process
Analyze
Digital and hardware evidence
Tell the students that these form an integral aspect of system forensics and would be discussed in detail.
Before moving on to the next slide, hold a brief discussion on why is it important for organizations to take the help of system forensics. The discussion should be focused on:
The role that system forensics plays in organizations having an IT set up.
This discussion will serve as a precursor to the next slide.
Introduce the students to the different types of threats that systems face by:
Asking the students to give examples of what they think are environmental and human threats.
Asking the students to give instances of what they think are malicious and non-malicious threats.
Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
Introduce the students to the different types of threats that systems face by:
Asking the students to give examples of what they think are environmental and human threats.
Asking the students to give instances of what they think are malicious and non-malicious threats.
Conclude the discussion on the different types of threats by giving additional examples of malicious and non malicious threats.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
Hold a two- three minute discussion on the different types of system-related crimes that the students have experienced or heard.
At the end of the discussion, give additional examples of system-related crimes.
Elaborate on the role that system forensics plays in an organization, based on the discussion in the previous slide and the information given on this slide.