Professional Documents
Culture Documents
There are no predefined tags provided for the XMl documents and
hence the XML doc will be defined based on the user defined tags
only.
Where a tag is a string which will be enclosed within an angular
basis.
What ever the tags that are opened in an XML document it is
mandatory to close those tags.
When ever the XML document is defined using a hierarchy of
elements then it is mandatory to close the elements in the same
hierarchy.
Valid XML document
+ 1 Any
* 0 any
For eg:
<! ELEMENT Employees(emp +)>
<! ELEMENT Emp(empno,ename,sal) >
<! ELEMENT empno(#PCDATA)>
<! ELEMENT ename(#PCDATA)>
<! ELEMENT esal(#PCDATA)>
Based on the above defintions an XML file has to be designed.
<Employees>
<Emp>
<empno>101</empno>
<ename>Kamala</ename>
<sal>10000</sal>
</Emp>
<Emp>
-----
-----
</Emp>
</Employees>
ATTLIST It is used for providing additional information
for the elements placed on the XML document.
Syntax
<!ATTLIST elementName attributeName(“DefaultValue”)>
for e.g.:-
<!ATTLIST emp deptno(“10”)>
XML doc
<Employees>
<Emp deptno=“10”>
----
----
</Emp>
</Employees>
Note there is no specification which specifies to use an
attribute or an element within the XML document.
For eg XML Documents using elements
<Employees>
<Emp>
<empno>1001</empno>
<ename>Sudhir</ename>
<sal>1000</sal>
</Emp>
</Employees>
XML doc using Attribute Information
<Employees>
<Emp empno=“1001” ename=“sudhir” sal=“10000” />
-----------------------------
</Employees>
Points to remember where attribute Method
should not be used
When ever an element has to support multiple values then
attributes can’t be used,since a single attribute can accept only a
single value at a time.
Whenever the information on the data for an element should be
nested then attribute information cant be used.
.net provides rich class libraries in order to integrate XML
documents defined using elements and hence it reduces the
burden of the programmer to integrate XML documents within
.net
Note dot net provides class libraries to work with XML
documents defined using attributes but still the programming will
become complex.
Entity
Entity It is used to define a user specific named entities
which can be used in the XML document.
Note when ever a named entity is used within a XML
document then the value of the named entity will be
substituted as a macro substitution within the XML
document.
<!ENTITY entityName “Value”>
for e.g
<!ENTITY SL “sudhironline”>
note when ever in a XML document &SL; is used then
in that position the value “sudhironline” will be
substituted
Entity
</RootElement>
External DTD Binding when ever the data type
definitions are specified in a DTD file and if it has been
explicitly binded to the XML document then it is said to
be external DTD binding.
Syntax to bind a DTD file to the XML Document
<!DOCTYPE rootElementName SYSTEM/PUBLIC
“path of DTDfile/URL “>
note if the data type definition file is present in the
local drives of a system then
<!DOCTYPE Employees SYSTEM “c:\emp.dtd”>
X
M
L
XML Application
P
Document A
R
S
E
R
Data Set
Write XML
Read XML