External referenced DTD in XML -
test.xml:
<?xml version='1.0' encoding='utf-8'?> <!doctype email system "test.dtd"> <email> <von>test@test.com</von> <zu>xxx@example.com</zu> <titel>hello</titel> <text>dear john....;-).</text> <prior type="schnell"/> </email>
test.dtd:
<?xml version='1.0' encoding='utf-8'?> <!doctype email [ <!element email (von,zu,titel,text,prior)> <!element von (#pcdata)> <!element zu (#pcdata)> <!element titel (#pcdata)> <!element text (#pcdata)> <!attlist prior type cdata #required > ]>
error code in test.dtd
the markup declarations contained or pointed document type declaration must well-formed. [2]
please help!!
you have duplicate doctype declarations. if want reference external dtd:
test.xml
<?xml version='1.0' encoding='utf-8'?> <!doctype email system "test.dtd"> <email> <von>test@test.com</von> <zu>xxx@example.com</zu> <titel>hello</titel> <text>dear john....;-).</text> <prior type="schnell"/> </email>
test.dtd
<!element email (von,zu,titel,text,prior)> <!element von (#pcdata)> <!element zu (#pcdata)> <!element titel (#pcdata)> <!element text (#pcdata)> <!element prior empty> <!attlist prior type cdata #required >
if want dtd part of xml file (internal subset):
<?xml version='1.0' encoding='utf-8'?> <!doctype email [ <!element email (von,zu,titel,text,prior)> <!element von (#pcdata)> <!element zu (#pcdata)> <!element titel (#pcdata)> <!element text (#pcdata)> <!element prior empty> <!attlist prior type cdata #required > ]> <email> <von>test@test.com</von> <zu>xxx@example.com</zu> <titel>hello</titel> <text>dear john....;-).</text> <prior type="schnell"/> </email>
note: you're missing element declaration prior
element.
Comments
Post a Comment