tags:

views:

26

answers:

1

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)>

<!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

+2  A: 

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.

bmargulies
excellent catch
Jherico
I once spent several hours perplexed by a fancy dash that resulted from Microsoft Output prettifying a plain old -.
bmargulies
Thanks for the answer, but that is how they came up when I copied them into the window, I am using notepad to create it, it looks fine in notepad, any suggestions on how to verify it is iso-646?
Eric
Well, the only occurence of 'version' in your document is in the pseudo at the top, where the quotes appear curly. Try replacing them with plain old single quotes.If you have cygwin you can use 'od' to look at hex. I don't recall the Windows equivalent.
bmargulies