Jump to content

Help getting this to validate?


Eric

Recommended Posts

I think I'm doing this DTD correctly, but it's not validating (keeps saying I'm not allows to have <person> in it's location)

<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="style.xsl"?><!DOCTYPE family [  <!ELEMENT family   (person,name,yearborn,######)>  <!ELEMENT person  (name,yearborn,######)>  <!ELEMENT name     (#PCDATA)>  <!ELEMENT yearborn (#PCDATA)>  <!ELEMENT ######   (#PCDATA)>]><family>	<person>  <name>***</name>  <yearborn>***</yearborn>  <######>***</######>	</person>	<person>  <name>***</name>  <yearborn>***</yearborn>  <######>***</######>	</person>	<person>  <name>***</name>  <yearborn>***</yearborn>  <######>***</######>	</person>	<person>  <name>***</name>  <yearborn>***</yearborn>  <######>***</######>	</person>	<person>  <name>***</name>  <yearborn>***</yearborn>  <######>***</######>	</person></family>

(I removed the actual data with "***" for this post)Your stupid word filter changed one of the words. It means "Gender". Some people are so childish, whoever added that word which is HARMLESS and means GENDER to the word filter. It's like your mind is stuck in 2nd grade!

Link to comment
Share on other sites

Hve you tryed replacing the "#" signs with some text?

If you mean, for example<!ELEMENT family (person,name,yearborn,######)>that's because the admin of this board added s.e.x. to the word filter (very stupid move)There IS an actual word there, it's just filtered on here :)
Link to comment
Share on other sites

Hm... the document's parse tree shows normally when I replace the "#" signs with s.e.x. AND when I removed the link for the xsl stylesheet. Are you sure the error isn't somewhere there? What do you actually mean by "validate"? I haven't tryed doing much with DTDs but I thought the the XML is not going to be showed if it doesn't validate againt a DTD :) .

Link to comment
Share on other sites

I got it solved now.I sent this question to www-validator@w3.org and this is what they said.

The DTD is wrong. It has<!ELEMENT family (person,name,yearborn,s.e.x)> which means that a family consists of elements person, name, yearborn, and s.e.x, each occurring exactly one. What you most probably mean is<!ELEMENT family (person)+>which means that a family consists of one or more persons (each of which contains what the definition for person says).
When I changed the DTD to this, it validates:<!DOCTYPE family [ <!ELEMENT family (person)+> <!ELEMENT person (name,yearborn,s.e.x)> <!ELEMENT name (#PCDATA)> <!ELEMENT yearborn (#PCDATA)> <!ELEMENT s.e.x (#PCDATA)>]>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...