Tuesday, 13 August 2013

element:

In XML DTD we can create an element by using ELEMENT declaration
Syntax:
 <!ELEMENT element_name category>
<!ELEMENT element_name element_content>
(a)    Declare an element that can be empty
 Syntax:
<!ELEMENT element_name EMPTY>
Ex: <!ELEMENT address EMPTY>
(b)   DECLARING AN ELEMENT THAT CAN ACCPET ANY DATA

Syntax:
<!ELEMENT element_name EMPTY>
EX: <!ELEMENT name ANY>
(c)    DECLARING AN ELEMENT THAT CAN CONTAIN pc data
SYNTAX:
  <!ELEMENT element_name(#PC DATA)>
Example:
<!ELEMENT rollno(#PCDATA)>
(d)   Declaring an element containing sequence of child elements
SYNTAX:
 <!ELEMENT element_name(child_name1,child_name2,...)>
Ex:
<!ELEMENT address (rno, colony, city>>
(e)   Declaring an child tag to be present exactly one time
Syntax:
    <!ELEMENT element_name(child_name)>
Ex: <!ELEMENT STUDENT(ROLLNO)>
(f)     Declaring an element that should be present at least one time
SYNTAX:
<!ELEMENT element_name element (childname+)>
Ex: <!ELEMENT institute (student+)>
(g)    Declaring an element that can be present (or) more times
Syntax:
 <!ELEMENT element_name(child_name *)>
<!ELEMENT student(address *)>
(h)   Declaring an element that can be available 0 (or)1 time
Syntax:
 <!ELEMENT element_name(child_name?)>
Ex: <!ELEMENT student(address ?)>

No comments:

Post a Comment