|
List Info
Thread: correct way to output HTML without the
|
|
| correct way to output HTML without the
<?xml... |

|
2006-05-23 23:11:20 |
Nic,
An XML document instance must have an xml declaration
otherwise it is not
valid XML. If you want to have no xml declaration you need
to output SGML.
Only SGML documents allow not declaration as the very first
line in the
document. I'm not sure how to get SGML output using
libxml2 but . Your
"-//W3C//DTD HTML 4.01 Transitional//EN" doctype
is SGML. Maybe your
statement about "xml_output_buffer" is wrong.
Is there an
'sgml_output_buffer' in libxml2 that you could use?
I hope that this helps.
John
> -----Original Message-----
> From: xml-bounces gnome.org [mailto ml-bo
unces gnome.org] On
> Behalf Of Nic James Ferrier
> Sent: Wednesday, 24 May 2006 3:10 AM
> To: libxml
> Subject: [xml] correct way to output HTML without the
<?xml...
>
>
> I've got a libxml2 DOM with HTML in it (note: it's
just an XML DOM
> with HTML in it).
>
> I want to output it as well-formed HTML, preferably
with the HTML4
> transitonal DTD but no xml declaration, eg:
>
> <DOCTYPE HTML ...>
> <html>
> <head>
> <link rel="xxx" .../>
> </head>
> .
> .
> .
> </html>
>
> I'm not sure of the right way to achieve this.
>
> I tried this:
>
> htmldoc = libxml2.newDoc("1.0")
> html4_transitional =
htmldoc.newDtd("HTML", "-//W3C//DTD
> HTML 4.01 Transitional//EN",
>
> "http://www.w3.or
g/TR/html4/loose.dtd")
> htmldoc.addChild(html4_transitional)
> .
> .
> .
>
xml_output_buffer.htmlDocContentDumpFormatOutput(htmldoc,
> "utf-8", 1)
>
> but that spits out HTML without the DTD or a
well-formed DOM.
>
>
> Outputting with:
>
> xml_output_buffer.saveFormatFileTo(htmldoc,
'UTF-8', 1)
>
> outputs the XML including the XML declaration, which I
don't want
> since this is well-formed HTML.
>
>
> Anybody know the right way to go about this?
>
>
> Nic
> _______________________________________________
> xml mailing list, project page http://xmlsoft.org/
> xml gnome.org
> http://mai
l.gnome.org/mailman/listinfo/xml
>
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| correct way to output HTML without the
<?xml... |

|
2006-05-24 02:18:33 |
On Wed, May 24, 2006 at 09:11:20AM +1000, John.Hockaday ga.gov.au
wrote:
> Nic,
>
> An XML document instance must have an xml declaration
otherwise it is not
> valid XML.
I disagree with this statement:
-----------
<!DOCTYPE foo [
<!ELEMENT foo EMPTY>
]>
<foo/>
-----------
it has no XMLDecl but is valid.
> > I want to output it as well-formed HTML,
preferably with the HTML4
> > transitonal DTD but no xml declaration, eg:
It's possible, use the xmlsave.h APIs with the
XML_SAVE_NO_DECL option.
Daniel
--
Daniel Veillard | Red Hat http://redhat.com/
veillard redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| correct way to output HTML without the
<?xml... |

|
2006-05-24 08:17:46 |
<John.Hockaday ga.gov.au> writes:
> Nic,
>
> An XML document instance must have an xml declaration
otherwise it is not
> valid XML.
This is not true, John.
An XML 1.1 document MUST have an XML decl. Here is the
relevant para
from http://www.tapsellfer
rier.co.uk
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| correct way to output HTML without the
<?xml... |

|
2006-05-24 08:20:34 |
<John.Hockaday ga.gov.au> writes:
> Nic,
>
> An XML document instance must have an xml declaration
otherwise it is not
> valid XML.
One more thing... the XML decl does not infer validity. Only
a DTD or
schema can infer validity.
The decl is simply required by XML 1.1 to state the version
of XML
being used. XML 1.0 doesn't require it because 1.0 is
assumed.
Nic
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| correct way to output HTML without the
<?xml... |

|
2006-05-24 09:02:16 |
* John.Hockaday ga.gov.au <John.Hockaday ga.gov.au> [2006-05-24 01:15]:
> An XML document instance must have an xml declaration
otherwise
> it is not valid XML.
Only if the encoding differs from UTF-8 or ASCII and then
only if
there is no other authority to declare it (such as HTTP
headers).
And then you’re only talking about well-formedness, not
validity,
which are two very different things.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/&g
t;
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| correct way to output HTML without the
<?xml... |

|
2006-05-24 10:52:41 |
Nic wrote:
>> > I want to output it as well-formed HTML,
preferably with the HTML4
>> > transitonal DTD but no xml declaration, eg:
>
Daniel replied:
> It's possible, use the xmlsave.h APIs with the
XML_SAVE_NO_DECL
> option.
No way to do it from Python though?
Is it the case that the xmlsave stuff has come fairly
recently and the
Python code has not been rejigged to use it?
It looks like the xmlsave API is slightly more generic than
the stuff
the Python layer uses.
Nic
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| correct way to output HTML without the
<?xml... |

|
2006-05-29 14:37:32 |
On Wed, May 24, 2006 at 11:52:41AM +0100, Nic James Ferrier
wrote:
>
> Nic wrote:
>
> >> > I want to output it as well-formed HTML,
preferably with the HTML4
> >> > transitonal DTD but no xml declaration,
eg:
> >
>
> Daniel replied:
>
> > It's possible, use the xmlsave.h APIs with the
XML_SAVE_NO_DECL
> > option.
>
> No way to do it from Python though?
>
>
> Is it the case that the xmlsave stuff has come fairly
recently and the
> Python code has not been rejigged to use it?
yes
> It looks like the xmlsave API is slightly more generic
than the stuff
> the Python layer uses.
and yes, sorry
Daniel
--
Daniel Veillard | Red Hat http://redhat.com/
veillard redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
[1-7]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|