The markup declarations contained or pointed to by the document type declaration must be well-formed

前端 未结 2 1169
萌比男神i
萌比男神i 2021-01-06 04:10

I have written one XML, but in that XMLon very first line I am getting an error

The markup declarations contained or pointed to by the document type

2条回答
  •  轮回少年
    2021-01-06 04:28

    I guess this is because of the extra spaces between < and ?xml and between ? and >.

    Note that you also seem to have extra spaces at the begin and end of the doctype declaration.

    Edit

    OK, I found two other issues with your file:

    1. It seems you forgot the “a” in apache.org in the DTD uri.
    2. The DTD available at http://struts.apache.org/dtds/struts-2.0.dtd starts with an XML declaration (), which is forbidden at the beginning of a DTD (because a DTD is not an XML file).

    If the first error is the one causing the trouble, it will be easy to fix. However, the second error is on the struts developers side. I guess most XML parsers ignores it (otherwise the struts team would have fixed it a long time ago), but if you have an XML parse that do complain about it, I’m afraid your only option is to switch to another one.

提交回复
热议问题