下午好,我对 XMl 和 DTD 还很陌生,但同时我也很开心。我有一个简单的任务,我将其命名为“联系人”,但我很难让 DTD 进行验证。我当然错过了一些东西,希望能得到一些提示或帮助。代码在下方,错误在代码下方。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Contacts [
<!ELEMENT Contacts (XYZ, ABC, WIZ)>
<!ELEMENT XYZ (#PCDATA)>
<!ELEMENT ABC (#PCDATA)>
<!ELEMENT WIZ (#PCDATA)>
]>
<Contacts>
<XYZ>
"XYZ Inc.",
"Jones","Barnaby"
"bjones@xyz.com"
"Owner-Operator"
"402-410-2314"
"8923 Holmes St"
"Omaha","NE","68222","USA"
"<div>Prospect</div>"
"Business"
</XYZ>
<ABC>
"ABC International"
"Magnum","Thomas"
"tmagnum@abcint.biz"
"Owner-Operator"
"402-310-2222"
"402-571-2893"
"3204 Plains Ave"
"Papillion","NE","68103","USA"
"<div>Vendor</div>"
"Business"
</ABC>
<Wiz>"Wiz Kids"
"Plum","Steve"
"steve@wizkids.com"
"Sales Rep"
"402-555-2325"
"402-516-2038"
"402-333-2428"
"1234 Main St"
"Belluvue","NE","68201","USA
#http://wizkids.com#
<div>Vendor</div>"
</Wiz>
</Contacts>
错误:
- 必须声明元素类型“div”
- 意外的元素“div”。父元素类型的内容必须匹配 (#PCDATA)。
- 必须声明元素类型“div”
- 意外的元素“div”。父元素类型的内容必须匹配 (#PCDATA)。
- 必须声明元素类型“Wiz”
- 必须声明元素类型“div”
- 意外元素“Wiz”。父元素类型的内容必须匹配 (XYZ,ABC,WIZ)。