0

I have tried everything that I can think of backwards and forwards, I have counted and recounted my lt's and gt's again and again, but this external dtd file keeps being invalidated with the message: "XML Parsing error @line 30 (the last line containing "]>"): Start tag expected, '<' not found." Can anyone help me out? Thanx much!

<?xml version="1.0"?>
<!DOCTYPE items 
[
<!ELEMENT items (item+)>
<!ELEMENT item     (description, country, sellingPrice, cost, quantityOnHand, 
                    backorderedAmount, dateLastReceived, quantitySoldYearToDate, 
                    warehouseSection, warehouseShelve, remarks, supplier, supplier+)>
<!ATTLIST item itemNumber ID #REQUIRED>     
<!ELEMENT description  (#PCDATA)>
<!ELEMENT country    (#PCDATA)>
<!ELEMENT sellingPrice      (#PCDATA)>
<!ATTLIST sellingPrice saleItem (Y|N) #REQUIRED>    
<!ELEMENT cost  (#PCDATA)>
<!ELEMENT quantityOnHand (#PCDATA)>
<!ELEMENT backorderedAmount (#PCDATA)>
<!ATTLIST backorderedAmount dateOrdered NMTOKEN #IMPLIED>   
<!ELEMENT dateLastReceived   (month, day, year)>
<!ELEMENT month  (#PCDATA)>
<!ELEMENT day  (#PCDATA)>
<!ELEMENT year  (#PCDATA)>
<!ELEMENT quantitySoldYearToDate    (#PCDATA)>
<!ELEMENT warehouseSection (#PCDATA)>
<!ELEMENT warehouseShelve     (#PCDATA)>
<!ELEMENT remarks     (#PCDATA)>
<!ELEMENT supplier       (number, shipmentLeadTime, supCost)>
<!ELEMENT number  (#PCDATA)>
<!ELEMENT shipmentLeadTime  (#PCDATA)>
<!ATTLIST shipmentLeadTime unit (days|weeks) #REQUIRED>
<!ELEMENT supCost  (#PCDATA)>
]>
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
ecelizzy
  • 41
  • 3

1 Answers1

0

Since this is an external DTD, do you also have a DOCTYPE declaration in your XML file that references this DTD? If so, you'll need to remove the doctype from the DTD.

Here's an example to try that has it commented out:

<!--<!DOCTYPE items [-->
<!ELEMENT items (item+)>
<!ELEMENT item     (description, country, sellingPrice, cost, quantityOnHand, 
                    backorderedAmount, dateLastReceived, quantitySoldYearToDate, 
                    warehouseSection, warehouseShelve, remarks, supplier, supplier+)>
<!ATTLIST item itemNumber ID #REQUIRED>     
<!ELEMENT description  (#PCDATA)>
<!ELEMENT country    (#PCDATA)>
<!ELEMENT sellingPrice      (#PCDATA)>
<!ATTLIST sellingPrice saleItem (Y|N) #REQUIRED>    
<!ELEMENT cost  (#PCDATA)>
<!ELEMENT quantityOnHand (#PCDATA)>
<!ELEMENT backorderedAmount (#PCDATA)>
<!ATTLIST backorderedAmount dateOrdered NMTOKEN #IMPLIED>   
<!ELEMENT dateLastReceived   (month, day, year)>
<!ELEMENT month  (#PCDATA)>
<!ELEMENT day  (#PCDATA)>
<!ELEMENT year  (#PCDATA)>
<!ELEMENT quantitySoldYearToDate    (#PCDATA)>
<!ELEMENT warehouseSection (#PCDATA)>
<!ELEMENT warehouseShelve     (#PCDATA)>
<!ELEMENT remarks     (#PCDATA)>
<!ELEMENT supplier       (number, shipmentLeadTime, supCost)>
<!ELEMENT number  (#PCDATA)>
<!ELEMENT shipmentLeadTime  (#PCDATA)>
<!ATTLIST shipmentLeadTime unit (days|weeks) #REQUIRED>
<!ELEMENT supCost  (#PCDATA)>
<!--]>-->

Also see this answer here: External referenced DTD in XML

If this does not answer your question, please update it with a minimal, complete, and verifiable example.

Community
  • 1
  • 1
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
  • Thanx, Daniel and yes I have it referenced in my XML file. When I do delete the first and last lines (that you commented out), I'm getting a different error message "XML Parsing error @line 1: Extra content at the end of the document." I am ready to SCREAM! Thanx for the help! (MUCH!) – ecelizzy Nov 09 '16 at 21:53
  • @ecelizzy - Can you update your question with the XML and updated DTD? – Daniel Haley Nov 09 '16 at 21:55
  • Turns out that the problem was with the validator not the program. Thanx, again! – ecelizzy Nov 23 '16 at 18:22