From a414f98e717ee864f1eb9137cd3cab2029b40e2d Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Tue, 6 May 2003 13:22:18 +0000 Subject: [PATCH] Minor update for new 4suite. When generating XHTML, validate the result. git-svn-id: http://dom-editor.googlecode.com/svn/branches/Gtk2@478 ef21e15d-ca94-4315-9c45-0d95b1b2e117 --- Dome/support.py | 3 ++- Dome/to_html.py | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Dome/support.py b/Dome/support.py index 3bd6ba5..deff5c5 100644 --- a/Dome/support.py +++ b/Dome/support.py @@ -2,7 +2,8 @@ import rox import os, sys import traceback -from Ft.Xml.Domlette import Node, implementation +from xml.dom import Node +from Ft.Xml.Domlette import implementation from Ft.Xml import XMLNS_NAMESPACE from Ft.Xml.Lib.Nss import GetAllNs diff --git a/Dome/to_html.py b/Dome/to_html.py index 5a5b328..efc473e 100644 --- a/Dome/to_html.py +++ b/Dome/to_html.py @@ -1,6 +1,9 @@ # Due to a shocking number of bugs and incompatibilities between PyXML and 4Suite, # this actually seems to be the easiest way to convert a XML document to HTML! +# (note: moved to XHTML now anyway) +# Validates the output. + import sys from xml.dom.html import HTMLDocument from Ft.Xml.cDomlette import implementation @@ -16,7 +19,9 @@ from cStringIO import StringIO stream = StringIO(''' - + @@ -33,4 +38,13 @@ stream = StringIO(''' proc.appendStylesheet(InputSource.InputSource(stream)) def to_html(doc): - return proc.runNode(doc, None, ignorePis = 1) + import os, rox + import traceback + data = proc.runNode(doc, None, ignorePis = 1) + cin, cout = os.popen4('xmllint --postvalid --noout -') + cin.write(data) + cin.close() + results = cout.read() + if results.strip(): + rox.alert(results) + return data -- 2.11.4.GIT