Professional Documents
Culture Documents
Sarju S
Lecturer Department of Computer Science and Engineering WWW.lectnote.blogspot.com
Java XML Bean
JSP
EJB
1
Module II
Document Type declarations Creating XML DTDs Element type declaration Attribute List Declaration Attribute types Attribute defaults Displaying XML Data in HTML browser as HTML tables Storing XML data in HTML document Converting XML to HTML with XSL minimalist XSL style sheets XML applications
10
13
15
18
19
20
21
22
23
24
Attribute Types
String Enumerated ID, IDREF,IDREFS ENTITY, ENTITIES NMTOKEN,NMTOKENS NOTATION.
26
String Attributes
The simplest type of attribute is the CDATA or string attribute. CDATA attribute values can be any string of characters. For example <!ATTLIST product name CDATA >
27
String Attributes
An element of type product has an attribute called name whose values can be any string of characters except <,>,& Sample:<product name=Acme> or <product name=Profit &Loss>
28
Enumerated Attributes
An enumerated attribute is one that can take on one of a fixed set of values supplied as part of its declaration. Ex: <!ATTLIST product name CDATA . Color(red|green) >
29
Enumerated Attributes
An element of type product has two attributes known as name and color. The name attribute can have any string of characters except <,>,&.Color attribute must be either the string red or green . <product name=acme color=red>
Note : Remember the enumerated attribute elements are case sensitive.
30
ID/IDREF/IDREFS
ID name to an element to uniquely identify it. must begin with a letter, a _ ,or a : character . Example
<!ATTLIST hello UniqueName ID .> the sample element might look like this <hello UniqueName =P1234>
31
IDREF
Represents the value of an ID attribute of another element. <!ATTLIST book Reference IDREF .> the sample element might look like this <hello UniqueName =P1234> <book Reference=P1234>
32
IDREFS
Represents multiple IDs of elements, separated by whitespace. <!ATTLIST book References IDREFS > book element might look like this: <book References=P1234 Q5678>
33
ENTITY/ENTITIES
The name of an entity (which must be declared in the DTD) <!ENTITY bob system bob.gif NDATA gif> <!ATTLIST letter salutation ENTITY > The letter element might look like this: <letter salutation=bob>
34
NMTOKEN /NMTOKENS
A valid XML name. any combination of letters, digits and some punctuation characters ., -, _ and :. Note that this list does not contain any white space characters.
35
NOTATION
An attribute list declaration of type NOTATION must specify one or more notations declared somewhere in the Document Type Declaration.
<!NOTATION EDIFACT SYSTEM EDIFACT Format> <!ATTLIST invoice format NOTATION (EDIFACT)> <invoice format=EDIFACT>
36
ATTRIBUTE DEFAULTS
#IMPLIED #REQUIRED #FIXED value
37
#IMPLIED
Specifies that there is no default value for this attribute, and that the attribute is optional. Syntax
<!ATTLIST element_name attribute_name CDATA #IMPLIED> Example <!ATTLIST tutorial rating CDATA #IMPLIED>
38
#REQUIRED
The attribute must have an explicitly specified value on every occurrence of the element in the document. Syntax <!ATTLIST element_name attribute_name CDATA #REQUIRED> Example <!ATTLIST tutorial published CDATA 39 #REQUIRED>
#FIXED
The #FIXED keyword specifies that you will provide value, and that's the only value that can be used by users of this DTD. Syntax <!ATTLIST element_name attribute_name CDATA #FIXED> Example <!ATTLIST tutorial language CDATA 40 #FIXED "EN">
XSL
XSL stands for Extensible Styles Language and is a very powerful language for applying styles to XML documents.
formatting language transformation language.
41
XSL
The formatting language allows you to apply styles similar to what CSS does. The transformation language is known as XSLT (XSL Transformations).
42
xmlns:xsl='http://www.w3.org/TR/WD-xsl
43
44
45
<xsl:value-of>
tag allows you to retrieve the value from a node.
47