Re: parsing xHTML
Matthew Hixson <[email protected]> Sun, 14 Sep 2003 22:39:05 -0700
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
When I add '-domfactory org.enhydra.xml.xhtml.XHTMLDomFactory' I see:
file:///foo.html:2: Error: Element type "html" must be declared.
file:///foo.html:3: Error: Element type "body" must be declared.
file:///foo.html:4: Error: Element type "table" must be declared.
file:///foo.html:5: Error: Element type "tr" must be declared.
file:///foo.html:6: Error: Element type "td" must be declared.
file:///foo.html:6: Error: Element type "img" must be declared.
file:///foo.html:6: Error: The element type "img" must be terminated by
the matching end-tag "</img>".
Error: Parse of "foo.html" failed: org.xml.sax.SAXException: Stopping
after fatal error: The element type "img" must be terminated by the
matching end-tag "</img>".
Do I need some kind of DTD declaration in my HTML?
Thanks,
-M@
On Sunday, September 14, 2003, at 06:02 PM, Jacob Kjome wrote:
>
> By default, XMLC uses an HTML parser. Try using "-dom xhtml" or doing
> "-domfactory org.enhydra.xml.xhtml.XHTMLDomFactory" (which is
> functionally the same as the former) ...or use "-domfactory
> org.enhydra.xml.xhtml.HTMLDomFactory which is almost the same as the
> XHTMLDomFactory, but defaults to the text/html mime type where the
> former defaults to application/xml+xhtml and the most classes
> implement HTMLElement rather than the custom XHTML element interfaces.
> Just depends on your needs.
>
> You probably also need to specify a different parser which supports
> XML. Try using "-parser xerces". It is actually the jtidy parser
> (which only understands HTML, not XML) which is "fixing" up your
> invalid HTML.
>
> Jake
>
> At 03:35 PM 9/14/2003 -0700, you wrote:
>> I was playing around with XMLC a bit this afternoon and discovered
>> that XMLC was outputting incorrect HTML when my input HTML was a well
>> formed XML doc. For example, I'd close my <img> tags like so:
>>
>> <img src="foo.png" alt=""/>
>>
>> With this inside a <td> element XMLC was choosing to open the next
>> <td> instead of following the <img> tag with </td>. Anyway, I fixed
>> it by writing non-well formed HTML. Is there a way to get XMLC to do
>> the right thing when I write xHTML?
>> Thanks,
>> -M@
>>
>> _______________________________________________
>> XMLC mailing list
>> [email protected]
>> http://www.enhydra.org/mailman/listinfo.cgi/xmlc
>
> _______________________________________________
> XMLC mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/xmlc
>