开发者

xml validation question using a DTD for a newbie

I am attempting to find out why this xml document will not validate. I am new to this, but it all looks good. I am attemtping to validate it at http://www.validome.org/grammar/validate/ my xml document named contacts1.xml looks like this...

<?xml version=”1.0”?>
<!DOCTYPE contacts SYSTEM “contacts1.dtd”>
<contacts>
<contact>
<name>
<first>Jeff</first>
<middle>Craig</middle>
<last>Rafter</last>
</name>
<location>
<latitude>34.031892</latitude>
<longitude>-117.207642</longitude>
</location>
<phone>001-909-555-1212</phone>
<knows>David Hunter, Danny Ayers</knows>
<description>Jeff is a developer and author for Beginning XML <em>4th
edition</em>.<br/>Jeff <strong>loves</strong> XML!</description>
</contact>
</contacts>

my DTD document named contacts1.dtd looks like this...

<!ELEMENT contacts (contact)>
<!ELEMENT contact (name, location, phone, knows, description)>

<!ELEMENT name (first, middle, last)>
<!ELEMENT first (#PCDATA)>
<!ELEMENT middle (#PCDATA)>
<!ELEMENT last (#PCDATA)>

<!ELEMENT location (address | (latitude, longitude))>
<!ELEMENT address (#PCDATA)>
<!ELEMENT latitude (#PCDATA)>
<!ELEMENT longitude (#PCDATA)>

<开发者_JAVA技巧;!ELEMENT phone (#PCDATA)>
<!ELEMENT knows (#PCDATA)>

<!ELEMENT description (#PCDATA | em | strong | br)*>
<!ELEMENT em (#PCDATA)>
<!ELEMENT strong (#PCDATA)>
<!ELEMENT br EMPTY>

The error message I get from the validator says

Value following "version" within text declaration must be a quoted string.

Can someone please tell me what the problem is, it all appears to be typed in correctly


You have some rather fancy quotation marks on the first line which are not permitted. Use plain-old-ASCII (ISO-646) single or double quotes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜