Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    20
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Question What is wrong with my dtd code?

    Hello, I am having an error message when I try to validate my code. Can someone please let me know what is wrong with the dtd file. Thank you.
    DTD:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    
    <!ELEMENT patients_info (patients+)>
    	<!ELEMENT patients (first_name, middle_name, last_name, social, age, 
                          room_number, primary_insurance, secondary_insurance, med_history, drug_allergies)>
    	<!ELEMENT first_name (#PCDATA)>
    	<!ELEMENT middle_name (#PCDATA)>
    	<!ELEMENT last_name (#PCDATA)>
    	<!ELEMENT social (#PCDATA)>
    	<!ELEMENT age (#PCDATA)>
    	<!ELEMENT room_number (#PCDATA)>
    	<!ELEMENT primary_insurance (insurance_name ,phone , id , group, address)>
    	<!ELEMENT secondary_insurance (insurance_name ,phone , id , group, address)>
    	<!ELEMENT med_history (#PCDATA)>
    	<!ELEMENT drug_allergies (#PCDATA)>
    XML
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <?DOCTYPE patients_info SYSTEM "patients.dtd"?>
    <?xml-stylesheet type = "text/css" href = "patients.css"?>
    	
    	<patients_info>
    	
    	<pagetitle>
    			<![CDATA[
    				Patients Information]]>
    		</pagetitle>
    	
    	<!--patient 1 -->
    	
     <patients>
          <first_name>Kate</first_name>
    	  <middle_name>Michelle</middle_name>
          <last_name>Cusse</last_name>
          <social_security>Social Security #: 123456789</social_security>
          <age> Age: 24</age>
          <room_number>Room: 103</room_number>
         <primary_insurance>
    	  	<insurance_name>Blue Cross</insurance_name>
    		<id>ID:12345</id>
    		<group>Group#:2</group>
    		<phone> (770)123-4567</phone>
    		<address>Address: 123 Main Street,GA 30023.</address>
    	</primary_insurance>
          
    	  <secondary_insurance>
    	  <insurance_name>  Humana</insurance_name>
    	  <id> ID: 14532</id> 
    	  <group>Group#:2</group>
    	  <phone>(770) 123-8325</phone>
    	   <address>Address: 143 Main Street, GA 30023.</address>
    	 </secondary_insurance>
          <med_history>High Cholesterol</med_history>
    	  <drug_allergies>NA</drug_allergies>
       </patients>
       
       <!--patient 2 -->
      	<patients>
          <first_name>James</first_name>
    	  <middle_name>Paul</middle_name>
          <last_name>Smith</last_name>
          <social_security>Social Security #:124456725</social_security>
          <age>Age: 22</age>
          <room_number>Room: 107</room_number>
    	  <primary_insurance>
    	  	<insurance_name>Blue Cross </insurance_name>
    	  	<id>ID:15532</id>
    	  	<group>Group#:2</group> 
    	  	<phone>(770)123-6732 </phone>
    	  	<address>Address: 123 Main Street,GA 30023.</address>
    	  </primary_insurance>
    	 
          <secondary_insurance>
    	  	<insurance_name>Humana</insurance_name>
    		<phone> (678) 576-8635 </phone>
    	  	<id> ID: 17532</id>
    	  	<group>Group#:2</group>
    	  	<address> Address: 143 Main Street, GA 30023.</address>
    	  </secondary_insurance>
          <med_history>High Blood Pressure</med_history>
    	  <drug_allergies>NA</drug_allergies>
       </patients>
       
       <!--patient 3 -->
       <patients>
          <first_name>Nick</first_name>
    	  <middle_name>Ryan</middle_name>
          <last_name>Zell</last_name>
          <social_security>Social Security#: 123456789</social_security>
          <age> Age: 30</age>
          <room_number>Room: 201</room_number>
          
    	  <primary_insurance>
    	  	<insurance_name>Blue Cross </insurance_name>
    		<phone> (770) 245-5725</phone>
    	  	<id>ID:18945</id>
    	  	<group>Group#:3</group>
    	  	<address>Address: 123 Main Street,GA 30023.</address>
    	  	</primary_insurance>
    	  
          <secondary_insurance>
    	  	<insurance_name>Humana</insurance_name>
    		<phone> (678)737-9397 </phone>
    	  	<id>ID: 17853</id>
    	  	<group>Group#:2</group>
    	   	<address>Address: 143 Main Street, GA 30023.</address>
    	  </secondary_insurance>
    	   
          <med_history>Cancer</med_history>
    	  <drug_allergies>NA</drug_allergies>
       </patients>
       
       <!-- Patient 4 -->
       <patients>
          <first_name>Alan</first_name>
    	  <middle_name>James</middle_name>
          <last_name>Wilkes</last_name>
          <social_security>Social Security #: 346248935</social_security>
          <age>Age: 45</age>
          <room_number>Room: 109</room_number>
          <primary_insurance>
    	  	<insurance_name>Blue Cross </insurance_name>
    		<phone> (687) 782-6306 </phone>
    	  	<id>ID:56723</id>
    	  	<group>Group#:1 </group>
    	 	<address>Address: 123 Main Street,GA 30023.</address>
    	  </primary_insurance>
    	  
          <secondary_insurance>
    	  	<insurance_name>Humana</insurance_name>
    		<phone> (357)620-3296</phone>
    	  	<id>ID: 54246</id>
    	  	<group>Group#:3 </group>
    	   	<address>Address:143 Main Street, GA 30023.</address>
    	  </secondary_insurance>
    	   
          <med_history>Healthy</med_history>
    	  <drug_allergies>NA</drug_allergies>
       </patients>
       
       </patients_info>

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <?DOCTYPE patients_info SYSTEM "patients.dtd"?>
    <?xml-stylesheet type = "text/css" href = "patients.css"?>
    	
    	<patients_info>
    	
    	<pagetitle>
    			<![CDATA[
    				Patients Information]]>
    		</pagetitle>
    the xml not follow the structure declared in dtd. At first look youd don't have any pagetitle as subnode of patients_info

    best regards

  • #3
    New Coder
    Join Date
    Jan 2009
    Posts
    20
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <?DOCTYPE patients_info SYSTEM "patients.dtd"?>
    <?xml-stylesheet type = "text/css" href = "patients.css"?>
    	
    	<patients_info>
    	
    	<pagetitle>
    			<![CDATA[
    				Patients Information]]>
    		</pagetitle>
    the xml not follow the structure declared in dtd. At first look youd don't have any pagetitle as subnode of patients_info

    best regards
    The problem is in the dtd file where I get an error. The XML validated.

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by gabald_28 View Post
    The problem is in the dtd file where I get an error. The XML validated.
    post the error message, please.

    best regards

  • #5
    New Coder
    Join Date
    Jan 2009
    Posts
    20
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    post the error message, please.

    best regards
    I get two errors:
    <!ELEMENT patients_info (patients+)> // Error-Expected Comment or CDATA[xml]

    <!ELEMENT first_name (#PCDATA)> //Error-An exception occurred! Type:EmptyStackException, Message:The element stack is empty[xml]
    Thank you for helping.

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    XML
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE patients_info SYSTEM "patients.dtd"?>
    - doctype start with <! not <?
    - add this in dtd before patients and remove your patiens_info
    Code:
    <?xml encoding="UTF-8"?>
    <!ELEMENT patients_info (pagetitle,patients+)>
    <!ATTLIST patients_info xmlns CDATA #FIXED ''>
    
    <!ELEMENT pagetitle (#PCDATA)>
    <!ATTLIST pagetitle xmlns CDATA #FIXED ''>
    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •