0

I have a DTD file and an XML file.
I referred to the DTD file in the XML file using the following statement referring to this website.
<!DOCTYPE XXXXX SYSTEM path\to\file.dtd>.
When I try to import the XML file into Excel using XML Data import function it throws an error
enter image description here

I have tried copying the entire DTD file into the XML under the <!DOCTYPE [ ] to avoid this situation, but the same error persists. I'm not familiar with using XML files.

Question: How can I fix this XML file (along with DTD) and import the same into Excelc successfully

  1. DTD File
  2. XML File
Prasanna
  • 4,036
  • 5
  • 34
  • 51
  • The XML you pasted doesn't even include a doctype statement? What was the actual tag you used? Did you check the [wiki](https://en.wikipedia.org/wiki/Document_type_definition#XML_DTDs_and_schema_validation) article for a good example how it should look (aka did you include quotes and the correct element name)? – Seth Apr 19 '17 at 10:12
  • Thanks for the comment. I included a doctype statement as shown in my question and still got the error. In the first instance, I linked the file in doctype. In the second instance, I copied and pasted the contents of my `DTD` file within the doctype.... and still got an error – Prasanna Apr 19 '17 at 11:03
  • In which case your doctype tag is wrong. In addition I'm not sure your DTD is actually a valid one. What is your actual goal here? It looks like the XML is describing some kind of graphic but you won't just be able to import it. What do you expect as a result from the import? – Seth Apr 19 '17 at 12:27
  • Doctype tag?? *Background information:* The XML file describes a graphic. The graphic has some tag numbers which I'm interested in. If the XML becomes valid without any errors, I can import the XML into Excel and get the `tag` column information I'm interested in – Prasanna Apr 19 '17 at 12:34
  • ` ` that is wrong as per the example from the wiki. It doesn't have the correct format and as such can't be validated. In addition valid DTD doesn't start with a XML declaration as it's not XML but rather SGML. So even if you used the right doctype it would be unlikely that it would verify successfully. What's the source of the DTD? Did you consider using an XML Schema instead? – Seth Apr 19 '17 at 12:53
  • As you pointed, I removed the XML declaration in the beginning of the DTD file and tried using it. But still returns an error. When you say that my ` ` is incorrect, do you mean that I have missed the double quotes for the path? Because I have tried that too. Additionally, I have placed the DTD in the same folder as the XML and just used it like ` ` even that did not work. – Prasanna Apr 19 '17 at 14:12
  • Use forwards slashes, not backslashes in the path. This is a URI, not a windows filename. – Michael Kay Apr 19 '17 at 15:06
  • @MichaelKay What if the the XML and the DTD files reside in the same folder? And also in my case, it is not a URL and windows path. Correct me if I'm wrong – Prasanna Apr 19 '17 at 16:22
  • @prasanna XML defines it to be a URI. A URI always uses forwards slashes, never backslashes. – Michael Kay Apr 19 '17 at 22:49
  • If I'm not mistaken this should be the correct doctype ` ` there is no "xxxxxx" that is a valid tag in your document. In addition your DTD is still invalid and it might just be that tells you to bugger off with that invalid DTD. Just as an example there should be a space after `ATTLIST` and there should be spaces around the `%` in your DTD. All of this is visible in the wiki article. There are countless spaces missing and senseless newlines added to your DTD. – Seth Apr 20 '17 at 05:51

0 Answers0