[FRPythoneers] xml woes

Mike Olson Mike.Olson at fourthought.com
Fri Sep 6 12:53:14 MDT 2002


On Fri, 2002-09-06 at 10:23, Karl Putland wrote:
> Days of pain later and still searching for the answer.
> 
> Trying to create a document using xml.dom.minidom or anything that will
> work.  Not from an existing document, but from scratch.
> 
> Problem is, that I can't get the <!DOCTYPE ...> tag to print out.

toprettyxml is more of an internal interface.  Use xml.dom.ext.Print or
xml.dom.ext.PrettyPrint.  Though testing this out myself I see there is
a problem as your probably the first top try and print a DOCTYPE using
minidom.

I'd recommend http://4Suite.org as I know this does work.

>>> from Ft.Xml.cDomlettec import implementation
>>> imp = implementation
>>> from Ft.Xml.Domlette import implementation
>>> imp = implementation
>>>  dt = imp.createDocumentType("Foo","PUBID","SYSID")
  File "<stdin>", line 1
    dt = imp.createDocumentType("Foo","PUBID","SYSID")
    ^
SyntaxError: invalid syntax
>>> dt = imp.createDocumentType("Foo","PUBID","SYSID")
>>> doc = imp.createDocument("http://foo.com","foo:Foo",dt)
>>> xml.dom.ext.Print(doc)
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE Foo PUBLIC "PUBID"
"SYSID"><foo:Foo xmlns:foo='http://foo>>>

Mike

> 
> How in the world does this work?
> 
> I've parsed a document with a <!DOCTYPE> directive.  It appears as the
> doctype attribute of the document.  Then call document.toprettyxml(),
> and there is no DOCTYPE>
> 
> Help appreciated...
> 
> -- 
> Karl Putland
> ShipEze Inc
> 
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
-- 
Mike Olson                                Principal Consultant
mike.olson at fourthought.com                +1 303 583 9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
PO Box 270590,                            http://4Suite.org
Louisville, CO 80027-5009, USA
XML strategy, XML tools, knowledge management




More information about the FRPythoneers mailing list