Custom tag in DTD document
And now I want to add this to a DTD document, so that it can be properly validated.
I've tried to input it like this
But the w3c validator is complaining about it!
<!-- gallery object, block object -->
<!ELEMENT gallery EMPTY>
src %Text; #REQUIRED
height %Length; #IMPLIED
width %Length; #IMPLIED
What could I do to make this validated correctly?
Line 12, Column 27: document type does not allow element "gallery" here
The W3C is not complaining about my DTD document, it's only saying that my gallery tag is not allowed where it is.
My html document looks like this
<!DOCTYPE html SYSTEM "http://www.mydomain.com/xhtml.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Last edited by artheus; 01-27-2010 at 03:44 AM.
Why use a custom element?
Rather than question your methods (I like to experiment with weird stuff, too, to help me learn how things actually work), how about surrounding it in a div first?
Interestingly enough I can't seem to ever put anything as a direct, first descendant of the body element without first wrapping it in a div without getting a validation error. I'm no W3C guru so I don't know why this is, but I'll bet that if you put a div around it first then it might fix the problem.
Any block level element will validate, whereas an inline element must be enclosed in a block level element.
Interestingly enough I can't seem to ever put anything as a direct, first descendant of the body element without first wrapping it in a div without getting a validation error.
Don't use "custom DTDs"
Last edited by Fang; 01-28-2010 at 09:23 AM.
Thanks aj_nsc, for being supportive of my experimentations. I tried your suggestion, and it seem as though it's not working like that either... :/
Fang.. Why be so negative towards experimenting? The only way of evoluting knowledge is through experimentation. I don't really get W3C there either.. Cause, using custom DTD's with valid syntax, should be just as normal as customizing files in any Open-Source project.
So I don't really get the "big bad" harm in making custom DTD's for custom projects.. But I can see that it would be better to just use the good old div-tag with the className "gallery" instead.
But that's not funny, and experimental is it??
I'm in no way against experimenting, but have never seen the necessity of creating a custom DTD.
You define the element as EMPTY, yet you add a closing tag???
<!ELEMENT GALLERY (%block) - O EMPTY>
Last edited by Fang; 01-29-2010 at 02:48 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread