Jump to content

Am I valid??


Eivo

Recommended Posts

Is this code valid, one validator tells me NO and another says YES. Who is correct?

<?xml version="1.0" encoding="utf-8" standalone="yes"?><!DOCTYPE site_info [	<!ELEMENT site_info (page)>	<!ELEMENT page (title, sort_order, author, p_body, date_posted, edited?)>	<!ELEMENT title (#PCDATA)>	<!ELEMENT sort_order (#PCDATA)>	<!ELEMENT author (#PCDATA)>	<!ATTLIST author level CDATA #REQUIRED>	<!ELEMENT p_body (#PCDATA)>	<!ELEMENT date_posted (month, date, year)>	<!ELEMENT month (#PCDATA)>	<!ELEMENT date (#PCDATA)>	<!ELEMENT year (#PCDATA)>	<!ELEMENT edited (edit_date, author)>	<!ELEMENT edit_date (month, date, year)>]><site_info>	<page>		<title>Home</title>		<sort_order>100</sort_order>		<author level="admin">mikeandfox</author>		<p_body><![CDATA[ <p>Creative Learning Daycare and Preschool</p><br /> ]]></p_body>		<date_posted>			<month>May</month>			<date>21</date>			<year>1982</year>		</date_posted>		<edited>			<edit_date>				<month>October</month>				<date>31</date>				<year>2007</year>			</edit_date>			<author level="admin">mikeandfox</author>		</edited>	</page></site_info>

I am just starting to learn XML, so I am doing some exercises as I go through the O'Reilly "XML in a nutshell". I just want to be sure I am on the right track so far. Thanks :)

Link to comment
Share on other sites

It is valid. It's just that some validators don't support inline DTDs. If you place your DTD in an external file, and reference it from the XML file, you should validate at both validators.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...