3 Replies - 660 Views - Last Post: 09 May 2016 - 01:28 AM Rate Topic: -----

#1 ha.darraji  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 08-May 16

XML to DTD help

Posted 08 May 2016 - 02:01 PM

Evening guys, I am transferring this code of xml to dtd

------------------------------- XML Code:
<module code=”U080565”>
	<moduleName> Programming Structures </moduleName>
	<moduleLevel> Undergrad </moduleLevel>

<lecturers>
	<lecturer module leader=”true”> Peter Marshall </lecturer>
	<lecturer> Nigel James </lecturer>
</lectures>

<students>
<student ID=”1304”>
	<name> Jane Arnam </name>
	<age> 20  </age> 
</student>

<student ID=”1421”>
	<name> Ian Brown </name>
<age> </age>
</student>

<student ID=”1356”>
	<name> Basil Mtebe </name>
	<age> 24 </age>
</student>


</students>


</module>


-------------------------------------------
So far what I got for DTD is:
<!Element module (moduleName, moduleLevel, lecturers, students)>
<!Element moduleName (#PCDATA)>
<!Element moduleLevel (#PCDATA)>

<!Element lecturers (lecture, (#PCDATA)>

<!Element students (#PCDATA)>

--------------------
But not entirelly sure how do I get the full dtd as I got complex of attributes. Can you please correct me if I am wrong,

Thnaks !!

This post has been edited by Atli: 08 May 2016 - 03:32 PM
Reason for edit:: Added [code] tags.


Is This A Good Question/Topic? 0
  • +

Replies To: XML to DTD help

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4128
  • View blog
  • Posts: 13,021
  • Joined: 08-June 10

Re: XML to DTD help

Posted 08 May 2016 - 10:52 PM

for defining attributes you use <!ATTLIST>. but you donít have any complex cases. only the wrong quotes and an attribute missing its value.
Was This Post Helpful? 0
  • +
  • -

#3 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 5061
  • View blog
  • Posts: 13,657
  • Joined: 18-April 07

Re: XML to DTD help

Posted 08 May 2016 - 10:56 PM

As Dormilich has mentioned, you need the <!ATTLIST> element. But also note that your students element can have zero or more student elements of its own and those students can have elements like name and age (which there can only be one). So besides the attributes, be sure to look at the carnality of the elements (how many elements can exist for a given parent element). :)
Was This Post Helpful? 0
  • +
  • -

#4 ha.darraji  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 08-May 16

Re: XML to DTD help

Posted 09 May 2016 - 01:28 AM

Thank you ever so much for the help! Will start adding them now
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1