Tuesday 10 December 2013

how to use dtd file, taking the help of dtd file

How to use dtd files
Here I am just trying to say how to use the data present in dtd file to enhance and use efficiently our .xml file.
See may be here I made some mistake but it is really help full to understand what is dtd file.
 I just share my experience with all of my friends and if you know any information that can increase my knowledge or any critics or suggestion then please comment.   

In .dtd files if something is defined like this
  <!ELEMENT group-limit (group-includes?, group-excludes?)>
it’s meaning is that <group-limit> is a tag which can has two elements <group-includes> tag and <group-excludes> tag and its each element tag can has <company-id> tag.
<!ELEMENT group-includes (group-id*)>
and
<!ELEMENT group-excludes (group-id*)>
Means they have one tag <group-id>
So the below code is the precise implementation of above describe statements
<company-limit>
    <company-includes>
        <company-id>liferay.com</company-id>
        <company-id>yoursite.com</company-id>
   </company-includes>
   <company-excludes>
          <company-id>mysite.com</company-id>
   </company-excludes>
<company-limit>
liferay.com, mysite.com and yoursite.com are the patterns or name of specified attributes.
<!ELEMENT group-limit (group-includes?, group-excludes?)>
<!ELEMENT group-includes (group-id*)>
<!ELEMENT group-excludes (group-id*)>
<!ELEMENT group-id (#PCDATA)>
The group-id element must have either the name or pattern attributes specified.
<group-limit>
    <group-includes>
<group-id>my.com</group-id>
</group-includes>
    <group-excludes>
        <group-id>your.com</group-id>
    </group-excludes>
</group-limit>

Thanks 
asif aftab

No comments:

Post a Comment