From ninti@ninti.com Mon Dec 2 03:00:12 2002 From: ninti@ninti.com (Michael Hall) Date: Mon, 2 Dec 2002 14:00:12 +1100 Subject: [XML-SIG] XSLT parameters Message-ID: <1038798012.3deaccbceb6f8@anchor.net.au> Hi: I'm using xml.xslt.Processor in a CGI script to transform XML to HTML using XSL. Simple enough, and works great. But what is the syntax/method to pass parameters to the XSL stylesheet? I tried something like this but it doesn't work: html = xsltproc.runUri(xmlfile, topLevelParams={'p': 27}) This topic seems to be almost completely undocumented in PyXML, 4Suite and Python documentation. Any pointers greatly appreciated. TIA. Mick -- ---------------------------------------------------- MICHAEL HALL Web Development Officer Batchelor Institute of Indigenous Tertiary Education W: mick.hall@nt.gov.au (08) 8951 8352 H: ninti@ninti.com (08) 8953 1442 ---------------------------------------------------- From Juergen Hermann" Message-ID: On Mon, 2 Dec 2002 14:00:12 +1100, Michael Hall wrote: >I tried something like this but it doesn't work: Define "doesn't work". Ciao, J=FCrgen -- J=FCrgen Hermann, Developer WEB.DE AG, http://webde-ag.de/ From jed@osafoundation.org Tue Dec 3 02:42:33 2002 From: jed@osafoundation.org (Jed Burgess) Date: Mon, 2 Dec 2002 18:42:33 -0800 Subject: [XML-SIG] Running PyXML with debug build on Linux Message-ID: <026c01c29a75$a271bfd0$8800a8c0@Nomad2> This is a multi-part message in MIME format. ------=_NextPart_000_0269_01C29A32.93A806A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable PyXML works fine for me on Windows, and it works with a non-debug = version on Linux, but when I try to use it with a debug build of Python = on Linux, I get an import error. My own code fails in the same way as = the test programs. I get the error: File "perf_expatbuilder.py", line 18, in ? from xml.dom import minidom, expatbuilder File = "/home/jed/osaf/debug/lib/python2.2/site-packages/_xmlplus/dom/expatbuild= er.py", line 32, in ? from xml.parsers import expat File = "/home/jed/osaf/debug/lib/python2.2/site-packages/_xmlplus/parsers/expat.= py", line 4, in ? from pyexpat import * ImportError: = /home/jed/osaf/debug/lib/python2.2/site-packages/_xmlplus/parsers/pyexpat= .so: undefined symbol: Py_InitModule4 What can I do to fix this? Are there any special steps I have to take = to get PyXML to work with the debug version of python on Linux? Thanks, Jed ------=_NextPart_000_0269_01C29A32.93A806A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
PyXML works fine for me on Windows, and = it works=20 with a non-debug version on Linux, but when I try to use it with a debug = build=20 of Python on Linux, I get an import error.  My own code fails in = the same=20 way as the test programs.  I get the error:
 
  File "perf_expatbuilder.py", = line 18, in=20 ?
    from xml.dom import = minidom,=20 expatbuilder
  File=20 "/home/jed/osaf/debug/lib/python2.2/site-packages/_xmlplus/dom/expatbuild= er.py",=20 line 32, in ?
    from xml.parsers = import=20 expat
  File=20 "/home/jed/osaf/debug/lib/python2.2/site-packages/_xmlplus/parsers/expat.= py",=20 line 4, in ?
    from pyexpat import=20 *
ImportError:=20 /home/jed/osaf/debug/lib/python2.2/site-packages/_xmlplus/parsers/pyexpat= .so:=20 undefined symbol: Py_InitModule4
 
What can I do to fix this?  Are = there any=20 special steps I have to take to get PyXML to work with the debug version = of=20 python on Linux?
 
Thanks,
Jed
 
------=_NextPart_000_0269_01C29A32.93A806A0-- From martin@v.loewis.de Tue Dec 3 07:50:51 2002 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 03 Dec 2002 08:50:51 +0100 Subject: [XML-SIG] Running PyXML with debug build on Linux In-Reply-To: <026c01c29a75$a271bfd0$8800a8c0@Nomad2> References: <026c01c29a75$a271bfd0$8800a8c0@Nomad2> Message-ID: "Jed Burgess" writes: > What can I do to fix this? Are there any special steps I have to > take to get PyXML to work with the debug version of python on Linux? You need to build PyXML with the debug version of python. Regards, Martin From jed@osafoundation.org Tue Dec 3 09:48:09 2002 From: jed@osafoundation.org (Jed Burgess) Date: Tue, 3 Dec 2002 01:48:09 -0800 Subject: [XML-SIG] Running PyXML with debug build on Linux References: <026c01c29a75$a271bfd0$8800a8c0@Nomad2> Message-ID: <02cc01c29ab1$171646e0$8800a8c0@Nomad2> I did build PyXML using the debug version of Python. I have it renamed to be python_d so that I can have both a release and a debug version coexisting. It works on Windows, and I am using the same build method to build 7 other packages. PyXML is the only one that fails and it only does so with the debug version on Linux. Does it work for other people on Linux? Are there any additional arguments? Thanks, Jed > > What can I do to fix this? Are there any special steps I have to > > take to get PyXML to work with the debug version of python on Linux? > > You need to build PyXML with the debug version of python. From gordonwebster@yahoo.com Tue Dec 3 22:17:19 2002 From: gordonwebster@yahoo.com (Gordon Webster) Date: Tue, 3 Dec 2002 14:17:19 -0800 (PST) Subject: [XML-SIG] xml.parsers.expat Message-ID: <20021203221719.43139.qmail@web10406.mail.yahoo.com> Dear Python XML Gurus Following the example in the library reference for the xml.parsers.expat module, I created a parser, defined handlers for the start and end of XML tags and for character data. Everything works just fine so long as my XML file is not too long. After a certain length however, the character handler flags errors and the whole parsing process grinds to a halt. Is there some limit to the amount of character data I can parse from a file? If I change the order of the sections in my XML file, the error seems to occur at more or less the same place. If I substitute several copies of a section that was previously read OK into the top of my file, the same thing happens after about the same amount of data has been read. Any help would be greatly appreciated. Gordon ===== . . ..... Gordon Webster gordonwebster@yahoo.com ..... . . From martin@v.loewis.de Tue Dec 3 22:45:43 2002 From: martin@v.loewis.de (Martin v. Löwis) Date: Tue, 3 Dec 2002 23:45:43 +0100 Subject: [XML-SIG] xml.parsers.expat References: <20021203221719.43139.qmail@web10406.mail.yahoo.com> Message-ID: <000901c29b1d$b7001cf0$961ae8d9@mira> > Is there some limit to the amount of character data I > can parse from a file? No. You just need to feed more data. Regards, Martin From fdrake@acm.org Tue Dec 3 22:56:29 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 3 Dec 2002 17:56:29 -0500 Subject: [XML-SIG] xml.parsers.expat In-Reply-To: <20021203221719.43139.qmail@web10406.mail.yahoo.com> References: <20021203221719.43139.qmail@web10406.mail.yahoo.com> Message-ID: <15853.13981.85633.926238@grendel.zope.com> Gordon Webster writes: > Following the example in the library reference for the > xml.parsers.expat module, I created a parser, defined > handlers for the start and end of XML tags and for > character data. Gak! There's a tiny but possibly relevant error in the example. ;-( Just calling the Parse() method with data causes the parser to expect more data; to tell it you're done, you need to call Parse() with the optional second argument set to true (an empty data string is fine): p.Parse('', 1) This tells the parser that there isn't any more input, so anything that hasn't been reported will be reported. (I'll fix the documentation.) Now, if you've passed the complete document already, this shouldn't be a real problem in practice. If this doesn't fix it for you, please provide specific code and a sample document that exhibit this problem, and the exact error you're seeing. That will make it much easier to help diagnose. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From Mike.Olson@fourthought.com Wed Dec 4 04:44:02 2002 From: Mike.Olson@fourthought.com (Mike Olson) Date: 03 Dec 2002 21:44:02 -0700 Subject: [XML-SIG] XSLT parameters In-Reply-To: <1038798012.3deaccbceb6f8@anchor.net.au> References: <1038798012.3deaccbceb6f8@anchor.net.au> Message-ID: <1038977044.3180.7.camel@penny> On Sun, 2002-12-01 at 20:00, Michael Hall wrote: > Hi: > > I'm using xml.xslt.Processor in a CGI script to transform XML to HTML using > XSL. Simple enough, and works great. > > But what is the syntax/method to pass parameters to the XSL stylesheet? > > I tried something like this but it doesn't work: > > html = xsltproc.runUri(xmlfile, topLevelParams={'p': 27}) This should work. Do you declare the top level params in the stylesheet? Mike > > This topic seems to be almost completely undocumented in PyXML, 4Suite and > Python documentation. > > Any pointers greatly appreciated. TIA. > > Mick > > -- > ---------------------------------------------------- > MICHAEL HALL Web Development Officer > Batchelor Institute of Indigenous Tertiary Education > W: mick.hall@nt.gov.au (08) 8951 8352 > H: ninti@ninti.com (08) 8953 1442 > ---------------------------------------------------- > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig -- Mike Olson Principal Consultant mike.olson@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 From Jean-Michel.Bruel@univ-pau.fr Thu Dec 5 09:42:45 2002 From: Jean-Michel.Bruel@univ-pau.fr (Jean-Michel BRUEL) Date: Thu, 5 Dec 2002 10:42:45 +0100 Subject: [XML-SIG] [CFP:] UML'2003 Message-ID: <200212050942.gB59gjc03440@univ-pau.fr> (Apologies if you receive multiple copies of this announcement) -------------------------------------------------------------- Call for Papers Sixth International Conference on UML - Modeling Languages and Applications October 20-24, 2003, San Francisco, USA http://www.umlconference.org -------------------------------------------------------------- The Unified Modeling Language (UML) has rapidly become the `lingua-franca' of the software community, both in industry and academia. In doing so it has focused attention on the modeling process, whether with languages inside or outside the UML family. The UML series of conferences is the premier venue for the exchange of innovative technical ideas and experiences relating to modeling. UML 2003 will include conference papers, workshops, tutorials and a tool exhibition. We invite three kinds of papers; although the lengths vary, each accepted paper will be allocated the same length slot in the conference programme. RESEARCH PAPERS describing innovative research on any aspect of modeling. SHORT EXPERIENCE PAPERS describing experience of significant application of modeling. Such papers will be judged by the quality of their contribution to industrial best-practice (rather than to the body of research knowledge). SHORT TOOL PAPERS describing innovative work on modeling-related tools. Such papers may concern tools with any licensing model (e.g. commercial or open source). They will be judged on their interest to the modeling community, and on the contribution they make to future tool-building within it. Topics include, but are not limited to: - lessons learned from modeling - tool support for any aspect of modeling or model use - models in the development and maintenance process - model evaluation, formal or informal - meta-modeling - model-driven engineering - semantics of modeling languages - domain-specific and concern-oriented modeling. Papers concerning modeling languages other than UML are welcome, but authors must bear in mind that their readers will, in general, be most familiar with UML. Hard Deadline for Abstracts 08 April 2003 Hard Deadline for Submissions 15 April 2003 Notification to Authors 24 June 2003 Final Version of Accepted Papers 29 July 2003 Paper Submissions: Submit your manuscript electronically in Postscript or PDF using the Springer LNCS style. Full papers should be 10-15 pages in length, short papers 2-4 pages. Full details, including more specific guidelines on the preparation of papers, can be found on the conference website. Papers will undergo a thorough process of review by a programme committee comprising leading experts from academia and industry; however, papers which are too long may be rejected without review. Proceedings will be published by Springer Verlag in the LNCS series. All papers must be original, unpublished, and not submitted simultaneously for publication elsewhere. Workshop and Tutorial Submissions: Proposals for advanced tutorials and workshops are requested: details of the proposal process are on the conference website. Important dates are listed below. Workshop deadline for submissions: 21 April 2003 Workshop notification of acceptance: 30 April 2003 Tutorial deadline for submissions: 29 June 2003 Tutorial notification of acceptance: 20 July 2003 Tutorial notes camera-ready copy deadline: 21 September 2003 See the conference website http://www.umlconference.org for details. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% General Chair Grady Booch, USA Conference Chair Jon Whittle, USA Programme Chair Perdita Stevens, UK Workshop Chair Ana Moreira, Portugal Tutorial Chair Joao Araujo, Portugal Local Arrangements Sherif Yacoub, USA Publicity Chairs Geri Georg, USA and Jean-Michel Bruel, France %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% From dev-xml@smartology.nl Thu Dec 5 16:49:42 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Thu, 5 Dec 2002 17:49:42 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions Message-ID: <200212051749.42769.dev-xml@smartology.nl> Hello, I've used the basic non-validating parser often, but I now need a validating parser ... so tried it with xmlproc. Problem is that I can't catch SAXParseExceptions with the error() or fatalError() handlers. the code: from xml.sax.saxlib import HandlerBase, DocumentHandler, ErrorHandler, DTDHandler class xpdf_parser(DocumentHandler): def warning(self, exception): # warning ... record self.warning.append(exception) print exception def error(self, exception): # non fatal error ... record (parsing probably stops) self.error.append(exception) print exception def fatalError(self, exception): # fatal error ... parsing stops self.error.append(exception) print exception return ... ---- if __name__ == '__main__': from xml.sax import make_parser from xml.sax.handler import feature_namespaces # create a parser parser = make_parser('xml.sax.drivers.drv_xmlproc_val') # create the handler pdf = xpdf_parser() # tell the parser to use our handler parser.setDocumentHandler(pdf) parser.setErrorHandler(pdf) parser.setDTDHandler(pdf) # Parse the input parser.parse(xpdf_file) As a result I get the following error: xpdf.xml:2:34: Not a valid name xpdf.xml:2:34: Whitespace expected here xpdf.xml:2:34: Expected type or alternative list Traceback (most recent call last): File "./xpdf.py", line 251, in ? produce_pdf = main(basedir.xpdf + xpdf_file) File "./xpdf.py", line 244, in __init__ parser.parse(xpdf_file) File "/usr/lib/python2.1/site-packages/_xmlplus/sax/drivers/drv_xmlproc.py", line 31, in parse self.parser.parse_resource(sysID) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlval.py", line 31, in parse_resource self.parser.parse_resource(sysid) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 127, in parse_resource self.read_from(infile,bufsize) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 200, in read_from self.feed(buf) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 329, in feed self.do_parse() File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", line 101, in do_parse self.parse_doctype() File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", line 509, in parse_doctype sys_id)) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 129, in parse_resource self.close() File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 334, in close self.parseEnd() File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/dtdparser.py", line 217, in parseEnd self.dtd_consumer.dtd_end() File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmldtd.py", line 212, in dtd_end self.parser.report_error(1006,elem) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", line 63, in report_error EntityParser.report_error(self,number,args) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 517, in report_error self.err.warning(msg) File "/usr/lib/python2.1/site-packages/_xmlplus/sax/drivers/drv_xmlproc.py", line 90, in warning self.err_handler.warning(saxlib.SAXParseException(msg,None,self)) TypeError: object of type 'list' is not callable The validation part obviously works (xpdf.xml:2:34: Not a valid name etc.), but I would like to be able to handle the Exception myself i.s.o. halting the program. I've not been able to find the solution to this answer ... anyone ? Kind Regards, Remy Cool From =?iso-8859-1?Q?Martin_v._L=F6wis?= Thu Dec 5 17:11:18 2002 From: =?iso-8859-1?Q?Martin_v._L=F6wis?= (=?iso-8859-1?Q?Martin_v._L=F6wis?=) Date: Thu, 5 Dec 2002 18:11:18 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions References: <200212051749.42769.dev-xml@smartology.nl> Message-ID: <009901c29c81$53cb6cb0$aa2ce8d9@mira> > I've not been able to find the solution to this answer ... anyone ? I recommend that you abandon SAX, in favour of SAX2. The SAX libraries are maintained in PyXML only for backwards compatibility, and no corrections are likely made for errors. With SAX2, things may work out of the box; if not, please submit a bug report (or, better yet, a fix). See the Python online documentation for details of using SAX2 (SAX is not documented for Python). Regards, Martin From dev-xml@smartology.nl Thu Dec 5 21:00:36 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Thu, 5 Dec 2002 22:00:36 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions In-Reply-To: <009901c29c81$53cb6cb0$aa2ce8d9@mira> References: <200212051749.42769.dev-xml@smartology.nl> <009901c29c81$53cb6cb0$aa2ce8d9@mira> Message-ID: <200212052151.50287.dev-xml@smartology.nl> On Thursday 05 December 2002 18:11, Martin v. Löwis wrote: > I recommend that you abandon SAX, in favour of SAX2. The SAX > libraries are maintained in PyXML only for backwards compatibility, > and no corrections are likely made for errors. With SAX2, things > may work out of the box; if not, please submit a bug report (or, > better yet, a fix). I've changed the code to: from xml.sax.handler import ContentHandler, ErrorHandler, DTDHandler, EntityResolver class xpdf_parser: ... ... from xml.sax import make_parser from xml.sax.handler import feature_namespaces, feature_validation if __name__ == '__main__': # create a parser parser = make_parser('xml.sax.drivers2.drv_xmlproc') # tell the parser we are not interested in XML namespaces parser.setFeature(feature_namespaces, 0) # tell the parser we want dtd validation parser.setFeature(feature_validation, 1) # create the handler pdf = xpdf_parser() # tell the parser to use our handler parser.setContentHandler(pdf) parser.setErrorHandler(pdf) parser.setDTDHandler(pdf) # Parse the input parser.parse(xpdf_file) This is SAX2 correct ? I also 'fixed' the DTD and the DTD warnings are gone ... but the TypeError remains. I'll look into the code, but if someone, who is more experienced with this module knows the answer .... please help me conserve some time. Kind Regards, Remy From martin@v.loewis.de Thu Dec 5 21:11:45 2002 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 05 Dec 2002 22:11:45 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions In-Reply-To: <200212052151.50287.dev-xml@smartology.nl> References: <200212051749.42769.dev-xml@smartology.nl> <009901c29c81$53cb6cb0$aa2ce8d9@mira> <200212052151.50287.dev-xml@smartology.nl> Message-ID: "Remy C. Cool" writes: > This is SAX2 correct ? Yes, it looks right > I also 'fixed' the DTD and the DTD warnings are gone ... but the > TypeError remains. Perhaps you just look closely at the exception :-) self.err_handler.warning(saxlib.SAXParseException(msg,None,self)) TypeError: object of type 'list' is not callable and in the handler you write def warning(self, exception): # warning ... record self.warning.append(exception) print exception I *think* you have ommitted some essential part, e.g. def __init__(self): self.warning = [] What do you think self.err_handler.warning is after that initialization? Regards, Martin From dev-xml@smartology.nl Thu Dec 5 21:19:09 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Thu, 5 Dec 2002 22:19:09 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions In-Reply-To: References: <200212051749.42769.dev-xml@smartology.nl> <200212052151.50287.dev-xml@smartology.nl> Message-ID: <200212052219.09124.dev-xml@smartology.nl> I've double checked that part, but it was a long day today so I could have overlooked something. This is my __init__ : def __init__(self): # containers self.warning = [] self.error = [] # flags self.is_inside_template_tag = 0 self.description = '' self.is_inside_description_tag = 0 The self.warning and self.error lists are declared, so that's not the problem. I'll run some tests on that. Regards, Remy On Thursday 05 December 2002 22:11, Martin v. Löwis wrote: > "Remy C. Cool" writes: > > This is SAX2 correct ? > > Yes, it looks right > > > I also 'fixed' the DTD and the DTD warnings are gone ... but the > > TypeError remains. > > Perhaps you just look closely at the exception :-) > > self.err_handler.warning(saxlib.SAXParseException(msg,None,self)) > TypeError: object of type 'list' is not callable > > and in the handler you write > > def warning(self, exception): > # warning ... record > self.warning.append(exception) > print exception > > I *think* you have ommitted some essential part, e.g. > > def __init__(self): > self.warning = [] > > What do you think self.err_handler.warning is after that > initialization? > > Regards, > Martin > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig From dev-xml@smartology.nl Thu Dec 5 21:23:36 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Thu, 5 Dec 2002 22:23:36 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions In-Reply-To: <200212052219.09124.dev-xml@smartology.nl> References: <200212051749.42769.dev-xml@smartology.nl> <200212052219.09124.dev-xml@smartology.nl> Message-ID: <200212052223.36052.dev-xml@smartology.nl> Commenting out the lines that appends the error/warning to the list so that only the print exception statements remains did not change anything. Trace: Traceback (most recent call last): File "./xpdf.py", line 253, in ? produce_pdf = main(basedir.xpdf + xpdf_file) File "./xpdf.py", line 246, in __init__ parser.parse(xpdf_file) File "/usr/lib/python2.1/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse self.feed(buffer) File "/usr/lib/python2.1/site-packages/_xmlplus/sax/drivers2/drv_xmlproc.py", line 93, in feed self._parser.feed(data) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlval.py", line 44, in feed self.parser.feed(data) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 329, in feed self.do_parse() File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", line 93, in do_parse self.parse_start_tag() File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", line 197, in parse_start_tag self.app.handle_start_tag(name,attrs) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlval.py", line 203, in handle_start_tag self.parser.report_error(2003, name) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlproc.py", line 63, in report_error EntityParser.report_error(self,number,args) File "/usr/lib/python2.1/site-packages/_xmlplus/parsers/xmlproc/xmlutils.py", line 519, in report_error self.err.error(msg) File "/usr/lib/python2.1/site-packages/_xmlplus/sax/drivers2/drv_xmlproc.py", line 223, in error self._err_handler.error(saxlib.SAXParseException(msg, None, self)) TypeError: object of type 'list' is not callable On Thursday 05 December 2002 22:19, Remy C. Cool wrote: > I've double checked that part, but it was a long day today so I > could have overlooked something. > > This is my __init__ : > > def __init__(self): > > # containers > self.warning = [] > self.error = [] > > # flags > self.is_inside_template_tag = 0 > self.description = '' > self.is_inside_description_tag = 0 > > The self.warning and self.error lists are declared, so that's not > the problem. I'll run some tests on that. > > Regards, > Remy > > On Thursday 05 December 2002 22:11, Martin v. Löwis wrote: > > "Remy C. Cool" writes: > > > This is SAX2 correct ? > > > > Yes, it looks right > > > > > I also 'fixed' the DTD and the DTD warnings are gone ... but > > > the TypeError remains. > > > > Perhaps you just look closely at the exception :-) > > > > self.err_handler.warning(saxlib.SAXParseException(msg,None,self)) > > TypeError: object of type 'list' is not callable > > > > and in the handler you write > > > > def warning(self, exception): > > # warning ... record > > self.warning.append(exception) > > print exception > > > > I *think* you have ommitted some essential part, e.g. > > > > def __init__(self): > > self.warning = [] > > > > What do you think self.err_handler.warning is after that > > initialization? > > > > Regards, > > Martin > > > > _______________________________________________ > > XML-SIG maillist - XML-SIG@python.org > > http://mail.python.org/mailman/listinfo/xml-sig > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig From walter@livinglogic.de Thu Dec 5 21:32:51 2002 From: walter@livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Thu, 05 Dec 2002 22:32:51 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions In-Reply-To: <200212052219.09124.dev-xml@smartology.nl> References: <200212051749.42769.dev-xml@smartology.nl> <200212052151.50287.dev-xml@smartology.nl> <200212052219.09124.dev-xml@smartology.nl> Message-ID: <3DEFC603.6020502@livinglogic.de> Remy C. Cool wrote: > I've double checked that part, but it was a long day today so I could > have overlooked something. > > This is my __init__ : > > def __init__(self): > > # containers > self.warning = [] > self.error = [] > > # flags > self.is_inside_template_tag = 0 > self.description = '' > self.is_inside_description_tag = 0 > > The self.warning and self.error lists are declared, so that's not the > problem. It *is* the problem. By setting the warning attribute on the instance, you're hiding the method. Bye, Walter Dörwald From dev-xml@smartology.nl Fri Dec 6 07:05:08 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Fri, 6 Dec 2002 08:05:08 +0100 Subject: [XML-SIG] handle drv_xmlproc_val SAXParseExceptions In-Reply-To: <3DEFC603.6020502@livinglogic.de> References: <200212051749.42769.dev-xml@smartology.nl> <200212052219.09124.dev-xml@smartology.nl> <3DEFC603.6020502@livinglogic.de> Message-ID: <200212060805.08066.dev-xml@smartology.nl> Thanks for the eye opener :) Validation works perfectly now. Regards, Remy On Thursday 05 December 2002 22:32, Walter Dörwald wrote: > Remy C. Cool wrote: > > I've double checked that part, but it was a long day today so I > > could have overlooked something. > > > > This is my __init__ : > > > > def __init__(self): > > > > # containers > > self.warning = [] > > self.error = [] > > > > # flags > > self.is_inside_template_tag = 0 > > self.description = '' > > self.is_inside_description_tag = 0 > > > > The self.warning and self.error lists are declared, so that's not > > the problem. > > It *is* the problem. By setting the warning attribute on the > instance, you're hiding the method. > > Bye, > Walter Dörwald > > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig From Jean-Michel.Bruel@univ-pau.fr Fri Dec 6 12:44:31 2002 From: Jean-Michel.Bruel@univ-pau.fr (Jean-Michel BRUEL) Date: Fri, 6 Dec 2002 13:44:31 +0100 Subject: [XML-SIG] [CFP:] QoS in CBSE 2003 Message-ID: <200212061244.gB6CiV512275@univ-pau.fr> (Apologies if you receive multiple copies of this announcement) -------------------------------------------------------------- Call for Papers Quality of Service in Component-Based Software Engineering QoSCBSE'2003 Workshop at "Reliable Software Technologies 2003" http://www.ada-europe.org/conference2003.html June 20th, 2003, Toulouse, France Workshop webpage : http://liuppa.univ-pau.fr/QoSCBSE2003 -------------------------------------------------------------- In the overall topic of reliable software, we are specifically interested in improving the way developers can manage the complexity of developing software which is most of the time distributed, based on existing reused pieces, and with strong and stringent timing constraints. The goal of this workshop is to look at issues related to the integration of non-functional properties expression, evaluation, and prediction in the context of component-based software engineering development. It is now widely recognized that what makes Component-Based Software Engineering (CBSE) hard to efficiently use is the fact that components are easy to produce but not easy to compose. This scope is addressed by a number of ongoing researches. In the context of this particular workshop we would like to focus on the difficulty of predicting the overall behavior and offered quality of service (in a broad sense, e.g. performance, dependability) of a composite out of its "internal" components. This implies that a software builder should have the behavior and the quality of service offered and required of each components expressed in some way, as well as some support tool or underlying framework supporting the composition of these added-value features. The aim of this workshop is to bring together practitioners and academics that are currently working around these topics to highlight the ongoing solutions and the problems encountered. The workshop is organized on two half-day sessions. The morning session is dedicated to invited talks and presentations. Followed, in the afternoon, by working sessions. The number and subject of these sessions will be decided by the organizers depending upon the position papers. A number of open questions will be addressed during the workshop. These questions will be refined, selected and modified according to the early discussions of the day, and some working sessions will be organized in order to give some indications on their answer. Examples of open questions: - How can we constraint/improve my component-based design with QoS annotations? - What research path should we take to make progress in predicting system behavior based on components behavior? - How do we decompose system behavior to get specific components requirements for non-functional system properties? Researchers and practitioners are invited to submit position papers on topics related to the workshop. A partial list of topics is: - Composition Language - Software performance modeling and evaluation - QoS specification - ADLs and their use in supporting features composition - Software dependability - Compositionality - Modeling methods and tools for non-functional requirements - Industrial case studies The 5-10 pages (single-spaced, 12-point, 1-inch margins) papers should be submitted either in postscript or a pdf format, via email to bruel@univ-pau.fr. The workshop organizers will review the submissions and select papers that present relevant and interesting ideas and concepts that can contribute to the discussions that will take place in the workshop. The workshop proceedings will be made available before the start of the workshop on the workshop website and may appear as a technical report at one of the organizers universities. Important dates --------------- 21 February 2003 Papers Submission Deadline 11 April 2003 Notification of acceptance 2 May 2003 Final papers (camera-ready) required 20 June 2003 Workshop in Toulouse Program committee ----------------- Jean-Michel Bruel (contact) U. of Pau, France Abdelmalek Benzekri U. of Toulouse III, France Geri Georg Agilent Technologies, USA Ileana Ober VERIMAG, France Ramon Puigjaner U. de les Illes Balears, Spain Jon Whittle NASA Ames, USA From dev-xml@smartology.nl Fri Dec 6 12:43:18 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Fri, 6 Dec 2002 13:43:18 +0100 Subject: [XML-SIG] setFeature(feature_validation, 1) causes misfire on endElement() Message-ID: <200212061343.18802.dev-xml@smartology.nl> I don't know if this 'problem' is known, but when experimenting with the xmlproc parser I stumbled upon the following problem: Code: # create a parser parser = make_parser('xml.sax.drivers2.drv_xmlproc') # tell the parser we are not interested in XML namespaces parser.setFeature(feature_namespaces, 0) # tell the parser we want dtd validation parser.setFeature(feature_validation, 1) # create the handler pdf = xpdf_parser() # tell the parser to use our handler parser.setContentHandler(pdf) parser.setErrorHandler(pdf) parser.setDTDHandler(pdf) # Parse the input parser.parse(xpdf_file) When feature_validation is set to true ... the endElement handler does not work. When feature_validation is set to false, endElement works and validation is still enabled. An other problem (not related) is that the locator function: def setDocumentLocator(self, locator): self.locator = locator doesn't work ... how do I get/reference the locator object inside my parser so that I can use the getLineNumber, getColumnNumber functions ? Kind Regards, Remy From martin@v.loewis.de Fri Dec 6 12:53:01 2002 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 06 Dec 2002 13:53:01 +0100 Subject: [XML-SIG] setFeature(feature_validation, 1) causes misfire on endElement() In-Reply-To: <200212061343.18802.dev-xml@smartology.nl> References: <200212061343.18802.dev-xml@smartology.nl> Message-ID: "Remy C. Cool" writes: > When feature_validation is set to true ... the endElement handler does > not work. When feature_validation is set to false, endElement works > and validation is still enabled. What do you mean by "does not work"? > An other problem (not related) is that the locator function: > > def setDocumentLocator(self, locator): > self.locator = locator > > doesn't work Again, what do you mean by "doesn't work"? Regards, Martin From dev-xml@smartology.nl Fri Dec 6 14:35:33 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Fri, 6 Dec 2002 15:35:33 +0100 Subject: [XML-SIG] setFeature(feature_validation, 1) causes misfire on endElement() In-Reply-To: References: <200212061343.18802.dev-xml@smartology.nl> Message-ID: <200212061535.33271.dev-xml@smartology.nl> On Friday 06 December 2002 13:53, Martin v. Löwis wrote: > "Remy C. Cool" writes: > > When feature_validation is set to true ... the endElement handler > > does not work. When feature_validation is set to false, > > endElement works and validation is still enabled. > > What do you mean by "does not work"? When the above feature is set to 1 (true) the parser does not call the endElement(self) function. Example code: class myParser(ContentHandler): def __init__(self): pass def startElement(self, name): print 'start:', name def endElement(self, name): print 'end:', name With feature_validation set to false (o) or removing the line completely ... the result is: start: taga start: tagb end: tagb end: taga With feature_validation set to true (1) the result is: start: taga start: tagb > > An other problem (not related) is that the locator function: > > > > def setDocumentLocator(self, locator): > > self.locator = locator > > > > doesn't work > > Again, what do you mean by "doesn't work"? Example code: class myParser(ContentHandler): def __init__(self): pass def setDocumentLocator(self, locator): self.locator = locator def startElement(self, name): print 'start:', name print self.locator.getLineNumber() def endElement(self, name): print 'end:', name Running the above results in a self.locator does not have the property getLineNumber() error. Regards, Remy Cool From confirm-minizine@recommend-it.com Fri Dec 6 23:30:21 2002 From: confirm-minizine@recommend-it.com (Recommend-It Confirmation Bot) Date: 6 Dec 2002 18:30:21 -0500 Subject: [XML-SIG] Recommend-It: PLS REPLY to CONFIRM [xml-sig@python.org/20021206000760053] Message-ID: <20021206233021.31535.qmail@sproc.postmasterdirect.com> CONFIRMATION OF RECOMMEND-IT SUBSCRIPTION REQUEST IS REQUIRED! We have just received a subscription request to add you to the free lists run by Recommend-It. You must confirm your subscription to join these lists by following the simple instructions below. INSTRUCTIONS: In order to activate your subscription(s), you MUST send us an email by replying to this message to verify your email address! It is very easy: simply hit the "Reply" button to this email, leave the confirmation code in the "Subject:" and click to "Send." Alternatively, you can also confirm via the web: http://www.ric2.com/pmdconfirm.jsp?E=xml-sig%40python.org&T=20021206000760053 If asked, your codes are E: xml-sig@python.org and T: 20021206000760053 This is just to verify your email address and to make sure no one is trying to subscribe you without your permission. If this subscription request is in error, do nothing, you will NOT receive any mail from us. We NEVER spam, and this email is to validate the subscription request we received via the Recommend-It web site. There is a possibility that someone may have attempted to sign you up maliciously; in which case ignore this email. Again, we do not harvest or send unsolicited email of any sort, nor do we wish to do that. Finally, let us remind you again: to confirm your subscription, "Reply" to this message, leaving the code in the subject line, and click on "Send". Recommend-It lists requested: ---------------------------- Recommend-It/Dating.list Recommend-It/Entertainment_Ezine.list Recommend-It/HUMOR.list Recommend-It/Recommend-It_Megazine.list ** xml-sig@python.org From john2000@twcny.rr.com Sat Dec 7 19:21:50 2002 From: john2000@twcny.rr.com (john prieur) Date: Sat, 7 Dec 2002 14:21:50 -0500 Subject: [XML-SIG] Re: XML-SIG digest, Vol 1 #1496 - 1 msg References: <20021207170004.793.9007.Mailman@mail.python.org> Message-ID: <000601c29e25$e4c7c0b0$b860a118@twcny.rr.com> ----- Original Message ----- From: To: Sent: Saturday, December 07, 2002 12:00 PM Subject: XML-SIG digest, Vol 1 #1496 - 1 msg > Send XML-SIG mailing list submissions to > xml-sig@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/xml-sig > or, via email, send a message with subject or body 'help' to > xml-sig-request@python.org > > You can reach the person managing the list at > xml-sig-admin@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of XML-SIG digest..." > > > Today's Topics: > > 1. Recommend-It: PLS REPLY to CONFIRM [xml-sig@python.org/20021206000760053] (Recommend-It Confirmation Bot) > > --__--__-- > > Message: 1 > Date: 6 Dec 2002 18:30:21 -0500 > To: > From: "Recommend-It Confirmation Bot" > Subject: [XML-SIG] Recommend-It: PLS REPLY to CONFIRM [xml-sig@python.org/20021206000760053] > > CONFIRMATION OF RECOMMEND-IT SUBSCRIPTION REQUEST IS REQUIRED! > > We have just received a subscription request to add you to the > free lists run by Recommend-It. You must confirm your subscription to > join these lists by following the simple instructions below. > > INSTRUCTIONS: > > In order to activate your subscription(s), you MUST send us an email > by replying to this message to verify your email address! It is very easy: > simply hit the "Reply" button to this email, leave the confirmation code > in the "Subject:" and click to "Send." > > Alternatively, you can also confirm via the web: > > http://www.ric2.com/pmdconfirm.jsp?E=xml-sig%40python.org&T=2002120600076005 3 > > If asked, your codes are E: xml-sig@python.org and T: 20021206000760053 > > This is just to verify your email address and to make sure no one is trying > to subscribe you without your permission. If this subscription request is > in error, do nothing, you will NOT receive any mail from us. > > We NEVER spam, and this email is to validate the subscription request we > received via the Recommend-It web site. There is a possibility that someone > may have attempted to sign you up maliciously; in which case ignore this > email. Again, we do not harvest or send unsolicited email of any sort, nor > do we wish to do that. > > Finally, let us remind you again: to confirm your subscription, "Reply" to this > message, leaving the code in the subject line, and click on "Send". > > > Recommend-It lists requested: > ---------------------------- > Recommend-It/Dating.list > Recommend-It/Entertainment_Ezine.list > Recommend-It/HUMOR.list > Recommend-It/Recommend-It_Megazine.list > > > > > ** xml-sig@python.org > > > > > > > > > > > > > > > End of XML-SIG Digest From eikeon@eikeon.com Sun Dec 8 23:41:40 2002 From: eikeon@eikeon.com (Daniel "eikeon" Krech) Date: 08 Dec 2002 18:41:40 -0500 Subject: [XML-SIG] expatreader bug Message-ID: <1039390900.24667.6799.camel@panther> --=-VGae5KDpI5MYaymV5z8f Content-Type: text/plain Content-Transfer-Encoding: 7bit SF is currently down and I have been meaning to report what I think is a small bug in expatreader. I have needed to add the following to some of my code: # Workaround for bug in expatreader.py. Needed when # expatreader is trying to guess a prefix. #parser.start_namespace_decl("xml", "http://www.w3.org/XML/1998/namespace") Attached is a test case for the issue. Let me know if I need to submit the bug/patch elsewhere or if someone can take it from here? --eikeon, http://eikeon.com/ --=-VGae5KDpI5MYaymV5z8f Content-Disposition: attachment; filename=expatreader_test.py Content-Transfer-Encoding: quoted-printable Content-Type: text/x-python; name=expatreader_test.py; charset=UTF-8 from xml.sax import make_parser from xml.sax.saxutils import handler, XMLGenerator from xml.sax.xmlreader import InputSource from xml.sax.handler import ErrorHandler from StringIO import StringIO sio =3D StringIO("""blah""") # As seen in: # http://www.w3.org/2000/10/rdf-tests/rdfcore/unrecognised-xml-attributes/t= est001.rdf source =3D InputSource() source.setByteStream(sio) parser =3D make_parser() # Workaround for bug in expatreader.py. Needed when # expatreader is trying to guess a prefix. #parser.start_namespace_decl("xml", "http://www.w3.org/XML/1998/namespace") parser.setFeature(handler.feature_namespaces, 1) parser.setContentHandler(XMLGenerator()) parser.setErrorHandler(ErrorHandler()) parser.parse(source) =20 # Results of running test against: # [eikeon@panther rdflib]$ python2.2 -V # Python 2.2.2 # # [eikeon@panther rdflib]$ python2.2 expatreader_test.py # # Traceback (most recent call last): # File "expatreader_test.py", line 22, in ? # parser.parse(source) # File "/usr/local/lib/python2.2/xml/sax/expatreader.py", line 91, in par= se # xmlreader.IncrementalParser.parse(self, source) # File "/usr/local/lib/python2.2/xml/sax/xmlreader.py", line 123, in pars= e # self.feed(buffer) # File "/usr/local/lib/python2.2/xml/sax/expatreader.py", line 144, in fe= ed # self._parser.Parse(data, isFinal) # File "/usr/local/lib/python2.2/xml/sax/expatreader.py", line 246, in st= art_element_ns # prefix =3D self._ns_stack[-1][apair[0]][-1] # IndexError: list index out of range # [eikeon@panther rdflib]$ --=-VGae5KDpI5MYaymV5z8f-- From uche.ogbuji@fourthought.com Mon Dec 9 15:31:39 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Mon, 09 Dec 2002 08:31:39 -0700 Subject: [XML-SIG] XSLT parameters In-Reply-To: Message from Michael Hall of "Mon, 02 Dec 2002 14:00:12 +1100." <1038798012.3deaccbceb6f8@anchor.net.au> Message-ID: Ouch. Seems I misconfigured procmail so I hid XML-SIG messages since mid November. I *thought* this list was rather quiet :-) > Hi: > > I'm using xml.xslt.Processor in a CGI script to transform XML to HTML using > XSL. Simple enough, and works great. > > But what is the syntax/method to pass parameters to the XSL stylesheet? > > I tried something like this but it doesn't work: > > html = xsltproc.runUri(xmlfile, topLevelParams={'p': 27}) > > This topic seems to be almost completely undocumented in PyXML, 4Suite and > Python documentation. > > Any pointers greatly appreciated. TIA. http://uche.ogbuji.net/tech/akara/pyxml/python-xslt/ http://www.xml.com/pub/a/2002/10/16/py-xml.html http://uche.ogbuji.net/tech/akara/pyxml/ http://uche.ogbuji.net/tech/akara/4suite/ In particular, xml.xslt in recent PyXML releases is broken. Download 4Suite and use Ft.Xml.Xslt and make other adjustments. e.g. from the Python & XML book: from xml.xslt.Processor import Processor xsltproc = Processor() xsltproc.appendStylesheetUri("story.xsl") html = xsltproc.runUri("story.xml") becomes: from Ft.Xml.Xslt.Processor import Processor from Ft.Xml.InputSource import DefaultFactory xsltproc = Processor() xsltproc.appendStylesheet(DefaultFactory.fromUri("story.xsl")) html = xsltproc.run(DefaultFactory.fromUri("story.xml")) Good luck. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From uche.ogbuji@fourthought.com Mon Dec 9 15:40:42 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Mon, 09 Dec 2002 08:40:42 -0700 Subject: [XML-SIG] RE: Transformation using XSLT In-Reply-To: Message from Amarsh Movva of "Fri, 29 Nov 2002 19:51:28 PST." <20021130035128.59590.qmail@web12208.mail.yahoo.com> Message-ID: > I was looking for any information on XML transformation using XSLT, something like XALAN . Xalan supports Java and C++, does python have any modules that do the same. If yes can you please help me with some information about it. 4Suite comes with 4XSLT, which implements full XSLT 1.0 + much of EXSLT. It is very easy to extend in Python, and use from a Python API. http://www.4suite.org http://uche.ogbuji.net/tech/akara/pyxml/python-xslt/ http://www.xml.com/pub/a/2002/10/16/py-xml.html http://uche.ogbuji.net/tech/akara/pyxml/ -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From dev-xml@smartology.nl Tue Dec 10 13:34:44 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Tue, 10 Dec 2002 14:34:44 +0100 Subject: [XML-SIG] How to stop parser Message-ID: <200212101434.44026.dev-xml@smartology.nl> My xmlproc parser checks if files mentioned in an xml file exists on the system ... when the files are not present, an error is written to the error handler. So far so good, but I want the parser to stop parsing and return without raising an error so that the program exits. Using return just returns the current function is it not ? Regards, Remy Cool From Alexandre.Fayolle@logilab.fr Tue Dec 10 14:30:40 2002 From: Alexandre.Fayolle@logilab.fr (Alexandre) Date: Tue, 10 Dec 2002 15:30:40 +0100 Subject: [XML-SIG] How to stop parser In-Reply-To: <200212101434.44026.dev-xml@smartology.nl> References: <200212101434.44026.dev-xml@smartology.nl> Message-ID: <20021210143040.GK21976@calvin.fayauffre.org> On Tue, Dec 10, 2002 at 02:34:44PM +0100, Remy C. Cool wrote: > My xmlproc parser checks if files mentioned in an xml file exists on > the system ... when the files are not present, an error is written to > the error handler. So far so good, but I want the parser to stop > parsing and return without raising an error so that the program > exits. Using return just returns the current function is it not ? The right way to do that is to raise a SAXException in your ErrorHandler callback. This will cause the parser to call endDocument and to return. -- Alexandre Fayolle LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org Développement logiciel avancé - Intelligence Artificielle - Formations From dev-xml@smartology.nl Tue Dec 10 14:55:23 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Tue, 10 Dec 2002 15:55:23 +0100 Subject: [XML-SIG] How to stop parser In-Reply-To: <20021210143040.GK21976@calvin.fayauffre.org> References: <200212101434.44026.dev-xml@smartology.nl> <20021210143040.GK21976@calvin.fayauffre.org> Message-ID: <200212101555.23536.dev-xml@smartology.nl> On Tuesday 10 December 2002 15:30, Alexandre wrote: > On Tue, Dec 10, 2002 at 02:34:44PM +0100, Remy C. Cool wrote: > > My xmlproc parser checks if files mentioned in an xml file exists > > on the system ... when the files are not present, an error is > > written to the error handler. So far so good, but I want the > > parser to stop parsing and return without raising an error so > > that the program exits. Using return just returns the current > > function is it not ? > > The right way to do that is to raise a SAXException in your > ErrorHandler callback. This will cause the parser to call > endDocument and to return. Thanks, but how can I do that. Warnings, errors and fatalErrors are handled by my own defined functions in the parser. They append the warning/error to a list which can be read by the main program when the parser returns. How can I raise an SAXException so that the parser will return without halting the program ? From fdrake@acm.org Tue Dec 10 15:33:15 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 10 Dec 2002 10:33:15 -0500 Subject: [XML-SIG] How to stop parser In-Reply-To: <200212101555.23536.dev-xml@smartology.nl> References: <200212101434.44026.dev-xml@smartology.nl> <20021210143040.GK21976@calvin.fayauffre.org> <200212101555.23536.dev-xml@smartology.nl> Message-ID: <15862.2363.283315.685927@grendel.zope.com> Remy C. Cool writes: > Warnings, errors and fatalErrors are handled by my own defined > functions in the parser. They append the warning/error to a list > which can be read by the main program when the parser returns. How > can I raise an SAXException so that the parser will return without > halting the program ? Raise the exception in your handler using a raise statement, then catch it using a try/except statement where you call the parser. Your application can then examine the accululated state as it sees fit. -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From dev-xml@smartology.nl Tue Dec 10 16:11:50 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Tue, 10 Dec 2002 17:11:50 +0100 Subject: [XML-SIG] How to stop parser In-Reply-To: <15862.2363.283315.685927@grendel.zope.com> References: <200212101434.44026.dev-xml@smartology.nl> <200212101555.23536.dev-xml@smartology.nl> <15862.2363.283315.685927@grendel.zope.com> Message-ID: <200212101711.06468.dev-xml@smartology.nl> Thanks, I was looking for an answer useable inside the handler, but this will do nicely :) Remy On Tuesday 10 December 2002 16:33, Fred L. Drake, Jr. wrote: > Remy C. Cool writes: > > Warnings, errors and fatalErrors are handled by my own defined > > functions in the parser. They append the warning/error to a list > > which can be read by the main program when the parser returns. > > How can I raise an SAXException so that the parser will return > > without halting the program ? > > Raise the exception in your handler using a raise statement, then > catch it using a try/except statement where you call the parser. > Your application can then examine the accululated state as it sees > fit. > > > -Fred From th@hbsn.de Thu Dec 12 01:14:12 2002 From: th@hbsn.de (Tobias Hintze) Date: Thu, 12 Dec 2002 02:14:12 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 Message-ID: <20021212011412.GA14136@hbsn.de> i just updated my PyXML installation to 0.8.1. i'm using apache 1.3.27 with mod_python-2.7.8. within mod_python i can't get a simple hello-world to work which works fine outside mod_python and worked fine with prior versions of PyXML. =====[.htaccess]===== AddHandler python-program .py PythonHandler handler::Handler.dispatch PythonDebug On ===== =====[handler.py]===== from xml.dom.ext.reader import Sax2 from mod_python import apache class Handler: def __init__(self, req): self.xml_reader = Sax2.Reader() def dispatch(self, req): req.content_type = "text/plain" req.send_http_header() req.write("hello world\n\n") req.write("handler %s\n" % str(self.xml_reader.handler)) req.write("parser %s\n" % str(self.xml_reader.parser)) req.write("sys.path %s\n" % str(sys.path)) doc = self.xml_reader.fromString("spam") req.write("\nparsed document: %s\n" % str(doc)) return apache.OK ===== output i get from mod_python: =====[output]===== hello world handler parser sys.path ['/opt/w3/default/xmltest/', '/usr/lib/python2.2', '/usr/lib/python2.2/plat-linux2', '/usr/lib/python2.2/lib-tk', '/usr/lib/python2.2/lib-dynload', '/usr/lib/python2.2/site-packages'] parsed document: None ===== i get a NoneObject from fromString() where i get a outside mod_python. any hints how to use PyXML-0.8.1 within mod_python-2.7.8? regards, th -- Tobias Hintze http://hbs-solutions.de HBS solutions GbR - Network & Information Systems From martin@v.loewis.de Thu Dec 12 06:32:44 2002 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 12 Dec 2002 07:32:44 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: <20021212011412.GA14136@hbsn.de> References: <20021212011412.GA14136@hbsn.de> Message-ID: Tobias Hintze writes: > any hints how to use PyXML-0.8.1 within mod_python-2.7.8? I have no idea, but I would put print statements into Sax2.py, to see how it proceeds. Regards, Martin From uche.ogbuji@fourthought.com Thu Dec 12 14:50:02 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Thu, 12 Dec 2002 07:50:02 -0700 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: Message from Tobias Hintze of "Thu, 12 Dec 2002 02:14:12 +0100." <20021212011412.GA14136@hbsn.de> Message-ID: > i just updated my PyXML installation to 0.8.1. > > i'm using apache 1.3.27 with mod_python-2.7.8. > > within mod_python i can't get a simple hello-world to work which works > fine outside mod_python and worked fine with prior versions of PyXML. [snip] > i get a NoneObject from fromString() where i get a > outside mod_python. > > any hints how to use PyXML-0.8.1 within mod_python-2.7.8? I'm not sure what is going on here, but unless you have to use 4DOM, I would recommend using minidom (much faster). Rather than from xml.dom.ext.reader import Sax2 ... doc = self.xml_reader.fromString("spam") Use from xml.dom import minidom ... doc = minidom.parse("spam") And update the initializer accordingly. In any case, we'll need more data to help debug. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From th@hbsn.de Thu Dec 12 15:51:45 2002 From: th@hbsn.de (Tobias Hintze) Date: Thu, 12 Dec 2002 16:51:45 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: References: <20021212011412.GA14136@hbsn.de> Message-ID: <20021212155145.GA2058@hbsn.de> On Thu, Dec 12, 2002 at 07:50:02AM -0700, Uche Ogbuji wrote: > I'm not sure what is going on here, but unless you have to use 4DOM, I would > recommend using minidom (much faster). > [snip] that's what i did before. > doc = minidom.parse("spam") (but i use parseString() as parse seems to be for files) > > And update the initializer accordingly. > > In any case, we'll need more data to help debug. see updated test case below. what data should i send to help debug? current test case: =====[handler.py]===== from xml.dom import minidom from mod_python import apache class Handler: def __init__(self, req): pass def dispatch(self, req): req.content_type = "text/plain" req.send_http_header() req.write("minidom test\n\n") doc = minidom.parseString("spam") req.write("\nparsed document: %s\n" % str(doc)) return apache.OK ===== =====[output]===== minidom test Mod_python error: "PythonHandler handler::Handler.dispatch" Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 193, in Dispatch result = object(req) File "/opt/w3/default/xmltest/handler.py", line 19, in dispatch doc = minidom.parseString("spam") File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py", line 1605, in parseString return expatbuilder.parseString(string) File "/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", line 943, in parseString return builder.parseString(string) File "/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", line 189, in parseString parser.Parse(string, True) File "/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py", line 231, in character_data_handler_cdata childNodes = self.curNode.childNodes AttributeError: ExpatBuilderNS instance has no attribute 'curNode' ===== using minidom "parseString" raises exception which doesn't happen without mod_python. regards, th -- Tobias Hintze http://hbs-solutions.de HBS solutions GbR - Network & Information Systems From martin@v.loewis.de Thu Dec 12 17:16:30 2002 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 12 Dec 2002 18:16:30 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: <20021212155145.GA2058@hbsn.de> References: <20021212011412.GA14136@hbsn.de> <20021212155145.GA2058@hbsn.de> Message-ID: Tobias Hintze writes: > see updated test case below. what data should i send to help debug? I assume this works when not run inside mod_python? Regards, Martin From th@hbsn.de Thu Dec 12 18:07:19 2002 From: th@hbsn.de (Tobias Hintze) Date: Thu, 12 Dec 2002 19:07:19 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: References: <20021212011412.GA14136@hbsn.de> <20021212155145.GA2058@hbsn.de> Message-ID: <20021212180719.GA2420@hbsn.de> On Thu, Dec 12, 2002 at 06:16:30PM +0100, Martin v. L?wis wrote: > Tobias Hintze writes: > > > see updated test case below. what data should i send to help debug? > > I assume this works when not run inside mod_python? ack. th -- > > Regards, > Martin -- Tobias Hintze http://hbs-solutions.de HBS solutions GbR - Network & Information Systems From martin@v.loewis.de Thu Dec 12 18:37:28 2002 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 12 Dec 2002 19:37:28 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: <20021212180719.GA2420@hbsn.de> References: <20021212011412.GA14136@hbsn.de> <20021212155145.GA2058@hbsn.de> <20021212180719.GA2420@hbsn.de> Message-ID: Tobias Hintze writes: > > > see updated test case below. what data should i send to help debug? > > > > I assume this works when not run inside mod_python? In that case, I can only wish you good luck, as you will need quite a lot of debugging to understand this. My initial thought is that you may be calling the wrong Expat copy, assuming multiple copies of Expat functions live inside Apache. This could be verified by setting breakpoints on the various Expat functions, to see which of them are invoked; adding printf statements inside PyXML's copy of Expat may also help. Of course, should not happen, as Python should use RTLD_LOCAL (BTW: what operating system?) If it is not that, you will have to perform step-by-step debugging, first on the Python level, e.g. by printing to a file in /tmp. If the ExpatBuilder loses its curNode attribute, print the contents of self.__dict__ in each callback function (i.e. *_handler); printing the keys might be sufficient. If that ever changes in an unreasonable way, then check whether the identity of the dict changes. If the dictionary loses the key, find the latest point where it is still there, and the earliest point where it is gone. This either points to the source of the problem, or you find that there are no Python statements in-between (i.e. in one callback, it was there until the end, and in the next callback, it is gone). Then you will have to use a C debugger. HTH, Martin From fdrake@acm.org Thu Dec 12 18:44:02 2002 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Thu, 12 Dec 2002 13:44:02 -0500 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: References: <20021212011412.GA14136@hbsn.de> <20021212155145.GA2058@hbsn.de> <20021212180719.GA2420@hbsn.de> Message-ID: <15864.55538.489905.56046@grendel.zope.com> Martin v. L=F6wis writes: > My initial thought is that you may be calling the wrong Expat copy, > assuming multiple copies of Expat functions live inside Apache. This= > could be verified by setting breakpoints on the various Expat > functions, to see which of them are invoked; adding printf statement= s > inside PyXML's copy of Expat may also help. Recent versions of Apache 1.3 do not have this problem. -Fred --=20 Fred L. Drake, Jr. PythonLabs at Zope Corporation From th@hbsn.de Thu Dec 12 18:46:15 2002 From: th@hbsn.de (Tobias Hintze) Date: Thu, 12 Dec 2002 19:46:15 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: <15864.55538.489905.56046@grendel.zope.com> References: <20021212011412.GA14136@hbsn.de> <20021212155145.GA2058@hbsn.de> <20021212180719.GA2420@hbsn.de> <15864.55538.489905.56046@grendel.zope.com> Message-ID: <20021212184615.GA2656@hbsn.de> On Thu, Dec 12, 2002 at 01:44:02PM -0500, Fred L. Drake, Jr. wrote: > > Martin v. L?wis writes: > > My initial thought is that you may be calling the wrong Expat copy, > > assuming multiple copies of Expat functions live inside Apache. This > > could be verified by setting breakpoints on the various Expat > > functions, to see which of them are invoked; adding printf statements > > inside PyXML's copy of Expat may also help. > > Recent versions of Apache 1.3 do not have this problem. problem appears on apache-1.3.27 on linux (glibc-2.2.5). th -- > > > -Fred > > -- > Fred L. Drake, Jr. > PythonLabs at Zope Corporation -- Tobias Hintze http://hbs-solutions.de HBS solutions GbR - Network & Information Systems From th@hbsn.de Thu Dec 12 19:04:45 2002 From: th@hbsn.de (Tobias Hintze) Date: Thu, 12 Dec 2002 20:04:45 +0100 Subject: [XML-SIG] pyxml fails in mod_python-2.7.8 In-Reply-To: <15864.55538.489905.56046@grendel.zope.com> References: <20021212011412.GA14136@hbsn.de> <20021212155145.GA2058@hbsn.de> <20021212180719.GA2420@hbsn.de> <15864.55538.489905.56046@grendel.zope.com> Message-ID: <20021212190445.GA2784@hbsn.de> On Thu, Dec 12, 2002 at 01:44:02PM -0500, Fred L. Drake, Jr. wrote: > > Martin v. L?wis writes: > > My initial thought is that you may be calling the wrong Expat copy, > > assuming multiple copies of Expat functions live inside Apache. This > > could be verified by setting breakpoints on the various Expat > > functions, to see which of them are invoked; adding printf statements > > inside PyXML's copy of Expat may also help. > > Recent versions of Apache 1.3 do not have this problem. and problem fades away with PyXML-0.7.1. and 0.8.0 does not raise exception but seems to sys.exit or do any other no-return. th -- > > > -Fred > > -- > Fred L. Drake, Jr. > PythonLabs at Zope Corporation -- Tobias Hintze http://hbs-solutions.de HBS solutions GbR - Network & Information Systems From bill@rfa.org Fri Dec 13 00:04:22 2002 From: bill@rfa.org (Bill Eldridge) Date: Thu, 12 Dec 2002 19:04:22 -0500 Subject: [XML-SIG] Disabling entity expansion Message-ID: <3DF92406.5090706@rfa.org> I have an element v_function referencing external entities &vf1; &vf2; and &vf3; Sometimes I'd like to expand these entities as normal, but other times I'd like to select &vf1; and get &vf1; or vf3 returned or even ??? Is there a simple way to disable the entity expansion? from xml.dom.ext.reader.Sax2 import FromXmlStream, FromXmlFile, Reader from xml.sax import xmlreader, make_parser from xml.sax.handler import feature_external_ges, feature_external_pes p = make_parser() #p.setFeature(feature_external_ges, 0) #p.setFeature(feature_external_pes, 0) #doc = FromXmlFile("test.xml", parser=p, validate=0) doc = FromXmlFile("test.xml", parser=p) for library in doc.getElementsByTagName("v_function"): library.normalize() if library.firstChild: print library.firstChild.data From anders@bruun-olsen.net Fri Dec 13 00:24:19 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Fri, 13 Dec 2002 01:24:19 +0100 Subject: [XML-SIG] 4Suite problems Message-ID: <20021213002419.GA24891@eddie.local> Hi, I am not 100% sure that this is the right place to seek help - please direct me to the right place if I am off-topic. I am trying to make an app that amongst other things applies an XSLT to an XML file to produce HTML. I have made the XSLT and the following code: def ProcessFile(input, output): XSLT = open("ujds.xslt", "r").read() XML = open(input, "r").read() xsltprocessor = Processor() transform = InputSource.DefaultFactory.fromString(XSLT) document = InputSource.DefaultFactory.fromString(XML) xsltprocessor.appendStylesheet(transform) result = xsltprocessor.run(document) if result: open(output, "w").write(result) Whenever I run the app and try to run the ProcessFile function I get this crash: ./print.py:64: RuntimeWarning: Creation of InputSource without an URI transform = InputSource.DefaultFactory.fromString(XSLT) /usr/lib/python2.2/site-packages/Ft/Xml/InputSource.py:147: RuntimeWarning: Creation of InputSource without an URI return apply(self.fromStream, (stream,uri)+v_args, kw_args) ./print.py:65: RuntimeWarning: Creation of InputSource without an URI source = InputSource.DefaultFactory.fromString(XML) Traceback (most recent call last): File "./print.py", line 119, in ? app = IndeksApp(0) File "/usr/lib/python2.2/site-packages/wxPython/wx.py", line 1581, in __init__ _wxStart(self.OnInit) File "./print.py", line 108, in OnInit self.mainframe = MainFrame(NULL, -1, "UJDS Indeks") File "./print.py", line 89, in __init__ if ProcessFile(inputfile, outputfile): File "./print.py", line 68, in ProcessFile result = xsltprocessor.run(document) File "/usr/lib/python2.2/site-packages/Ft/Xml/Xslt/Processor.py", line 150, in run raise XsltException(Error.SOURCE_PARSE_ERROR, iSrc.uri or '', e) Ft.Xml.Xslt.XsltException: Source document (urn:uuid:303010c-b08-503-20b-f050b09309): Invalid base URI: urn:uuid:303010c-b08-503-20b-f050b09309 What am I doing wrong here? -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From ninti@ninti.com Fri Dec 13 02:57:53 2002 From: ninti@ninti.com (Michael Hall) Date: Fri, 13 Dec 2002 13:57:53 +1100 Subject: [XML-SIG] 4Suite problems Message-ID: <1039748273.3df94cb1b9e0a@anchor.net.au> Quoting Anders Bruun Olsen : Warning: I am a relative newbie to Python, 4Suite and XSLT, I may easily have missed something obvious in your example, and you may be trying to do something I'm not even aware of. That said, however ... Do you need to explicitly open the XML and XSL files? Normally, you would simply supply filepaths to the processor: > def ProcessFile(input, output): stylesheet = "/path/to/somesheet.xsl" > xsltprocessor = Processor() > > xsltprocessor.appendStylesheetUri(stylesheet) > result = xsltprocessor.runUri(input) > if result: > open(output, "w").write(result) This works for me creating dynamically generating HTML web pages with a Python CGI script, except that I do this with the result: if result: print "Content-type: text/html\n\n" print result Sorry if I've misunderstood what you're trying to do. Mick > Hi, > > I am not 100% sure that this is the right place to seek help - please > direct me to the right place if I am off-topic. > > I am trying to make an app that amongst other things applies an XSLT to > an XML file to produce HTML. I have made the XSLT and the following > code: > > def ProcessFile(input, output): > XSLT = open("ujds.xslt", "r").read() > > XML = open(input, "r").read() > > xsltprocessor = Processor() > > transform = InputSource.DefaultFactory.fromString(XSLT) > document = InputSource.DefaultFactory.fromString(XML) > > xsltprocessor.appendStylesheet(transform) > result = xsltprocessor.run(document) > if result: > open(output, "w").write(result) > > Whenever I run the app and try to run the ProcessFile function I get > this crash: > > ./print.py:64: RuntimeWarning: Creation of InputSource without an URI > transform = InputSource.DefaultFactory.fromString(XSLT) > /usr/lib/python2.2/site-packages/Ft/Xml/InputSource.py:147: RuntimeWarning: > Creation of InputSource without an URI > return apply(self.fromStream, (stream,uri)+v_args, kw_args) > ./print.py:65: RuntimeWarning: Creation of InputSource without an URI > source = InputSource.DefaultFactory.fromString(XML) > Traceback (most recent call last): > File "./print.py", line 119, in ? > app = IndeksApp(0) > File "/usr/lib/python2.2/site-packages/wxPython/wx.py", line 1581, in > __init__ > _wxStart(self.OnInit) > File "./print.py", line 108, in OnInit > self.mainframe = MainFrame(NULL, -1, "UJDS Indeks") > File "./print.py", line 89, in __init__ > if ProcessFile(inputfile, outputfile): > File "./print.py", line 68, in ProcessFile > result = xsltprocessor.run(document) > File "/usr/lib/python2.2/site-packages/Ft/Xml/Xslt/Processor.py", line 150, > in run > raise XsltException(Error.SOURCE_PARSE_ERROR, iSrc.uri or ' string>', e) > Ft.Xml.Xslt.XsltException: Source document > (urn:uuid:303010c-b08-503-20b-f050b09309): Invalid base URI: > urn:uuid:303010c-b08-503-20b-f050b09309 > > What am I doing wrong here? > > -- > Anders > -----BEGIN GEEK CODE BLOCK----- > Version: 3.12 > GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V > PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? > ------END GEEK CODE BLOCK------ > PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig > ---------------------------------------------------- MICHAEL HALL Web Development Officer Batchelor Institute of Indigenous Tertiary Education W: mick.hall@nt.gov.au (08) 8951 8352 H: ninti@ninti.com (08) 8953 1442 ---------------------------------------------------- From anders@bruun-olsen.net Fri Dec 13 13:36:18 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Fri, 13 Dec 2002 14:36:18 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: <1039748273.3df94cb1b9e0a@anchor.net.au> References: <1039748273.3df94cb1b9e0a@anchor.net.au> Message-ID: <20021213133618.GA9794@eddie.local> n Fri, Dec 13, 2002 at 01:57:53PM +1100, Michael Hall wrote: > Warning: I am a relative newbie to Python, 4Suite and XSLT, I may > easily have > missed something obvious in your example, and you may be trying to do > something > I'm not even aware of. That said, however ... I looks like you have caught on to the idea :) > Do you need to explicitly open the XML and XSL files? Normally, you > would > simply supply filepaths to the processor: Uhmm.. probably not, but take a look below.. > > def ProcessFile(input, output): > stylesheet = "/path/to/somesheet.xsl" > > xsltprocessor = Processor() > > xsltprocessor.appendStylesheetUri(stylesheet) > > result = xsltprocessor.runUri(input) > > if result: > > open(output, "w").write(result) > This works for me creating dynamically generating HTML web pages with > a Python > CGI script, except that I do this with the result: > if result: > print "Content-type: text/html\n\n" > print result This results in the following error: xsltprocessor.appendStylesheetUri("ujds.xslt") AttributeError: Processor instance has no attribute 'appendStylesheetUri' I forgot to mention that I am using 4Suite 0.11.1 -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From uche.ogbuji@fourthought.com Fri Dec 13 15:41:59 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Fri, 13 Dec 2002 08:41:59 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Fri, 13 Dec 2002 01:24:19 +0100." <20021213002419.GA24891@eddie.local> Message-ID: > Hi, > > I am not 100% sure that this is the right place to seek help - please > direct me to the right place if I am off-topic. > > I am trying to make an app that amongst other things applies an XSLT to > an XML file to produce HTML. I have made the XSLT and the following > code: > > def ProcessFile(input, output): > XSLT = open("ujds.xslt", "r").read() > > XML = open(input, "r").read() > > xsltprocessor = Processor() > > transform = InputSource.DefaultFactory.fromString(XSLT) > document = InputSource.DefaultFactory.fromString(XML) I always strongly suggest that you still use URIs here. For example transform = InputSource.DefaultFactory.fromString(XSLT, "ujds.xslt") This avoids errors if you try to do something later that performs resolution against a relative URI. Note that you can just write: xsltprocessor = Processor() transform = InputSource.DefaultFactory.fromUri("ujds.xslt") document = InputSource.DefaultFactory.fromUri(input) Which will eliminate the error and will have the additional advantage of being a tad faster. > xsltprocessor.appendStylesheet(transform) > result = xsltprocessor.run(document) > if result: > open(output, "w").write(result) > > Whenever I run the app and try to run the ProcessFile function I get > this crash: > > ./print.py:64: RuntimeWarning: Creation of InputSource without an URI > transform = InputSource.DefaultFactory.fromString(XSLT) > /usr/lib/python2.2/site-packages/Ft/Xml/InputSource.py:147: RuntimeWarning: Creation of InputSource without an URI > return apply(self.fromStream, (stream,uri)+v_args, kw_args) > ./print.py:65: RuntimeWarning: Creation of InputSource without an URI > source = InputSource.DefaultFactory.fromString(XML) > Traceback (most recent call last): > File "./print.py", line 119, in ? > app = IndeksApp(0) > File "/usr/lib/python2.2/site-packages/wxPython/wx.py", line 1581, in __init__ > _wxStart(self.OnInit) > File "./print.py", line 108, in OnInit > self.mainframe = MainFrame(NULL, -1, "UJDS Indeks") > File "./print.py", line 89, in __init__ > if ProcessFile(inputfile, outputfile): > File "./print.py", line 68, in ProcessFile > result = xsltprocessor.run(document) > File "/usr/lib/python2.2/site-packages/Ft/Xml/Xslt/Processor.py", line 150, in run > raise XsltException(Error.SOURCE_PARSE_ERROR, iSrc.uri or '', e) > Ft.Xml.Xslt.XsltException: Source document (urn:uuid:303010c-b08-503-20b-f050b09309): Invalid base URI: urn:uuid:303010c-b08-503-20b-f050b09309 > > What am I doing wrong here? This exception does mask the real problem, unfortunately, but I'm about 90% sure that you're doing something (XSLT document() call, XInclude resolution, xsl:import or something) that tries to resolve a relative URI. The problem is that you haven't provided a base URI, so 4Suite rightly complains (though in an obfuscated way: I'll look into that). I pointed to the likely solution above. You may also want to browse my article on 4Suite: http://www.xml.com/pub/a/2002/10/16/py-xml.html Which gives a fuller example and some discussion. A fuller discussion on 4Suite's pickiness about URIs is in the following: http://uche.ogbuji.net/tech/akara/pyxml/domlettes/ -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From uche.ogbuji@fourthought.com Fri Dec 13 15:44:39 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Fri, 13 Dec 2002 08:44:39 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Fri, 13 Dec 2002 14:36:18 +0100." <20021213133618.GA9794@eddie.local> Message-ID: > > Uhmm.. probably not, but take a look below.. > > > > def ProcessFile(input, output): > > stylesheet = "/path/to/somesheet.xsl" > > > xsltprocessor = Processor() > > > xsltprocessor.appendStylesheetUri(stylesheet) > > > result = xsltprocessor.runUri(input) > > > if result: > > > open(output, "w").write(result) > > This works for me creating dynamically generating HTML web pages with > > a Python > > CGI script, except that I do this with the result: > > if result: > > print "Content-type: text/html\n\n" > > print result > > This results in the following error: > > xsltprocessor.appendStylesheetUri("ujds.xslt") > AttributeError: Processor instance has no attribute 'appendStylesheetUri' There is no more 'appendStylesheetUri'. You replace it with from Ft.Xml.InputSource import DefaultFactory xsltprocessor.appendStylesheet(DefaultFactory.fromUri(xsl_uri)) html = xsltproc.run(DefaultFactory.fromUri(src_uri)) > I forgot to mention that I am using 4Suite 0.11.1 You mean 0.12.0, right? -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-pyth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-debugxs.html From anders@bruun-olsen.net Fri Dec 13 16:02:01 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Fri, 13 Dec 2002 17:02:01 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: References: <20021213002419.GA24891@eddie.local> Message-ID: <20021213160201.GC9794@eddie.local> On Fri, Dec 13, 2002 at 08:41:59AM -0700, Uche Ogbuji wrote: > > def ProcessFile(input, output): > > XSLT = open("ujds.xslt", "r").read() > > XML = open(input, "r").read() > > xsltprocessor = Processor() > > transform = InputSource.DefaultFactory.fromString(XSLT) > > document = InputSource.DefaultFactory.fromString(XML) > I always strongly suggest that you still use URIs here. For example > transform = InputSource.DefaultFactory.fromString(XSLT, "ujds.xslt") > This avoids errors if you try to do something later that performs resolution > against a relative URI. > Note that you can just write: > xsltprocessor = Processor() > transform = InputSource.DefaultFactory.fromUri("ujds.xslt") > document = InputSource.DefaultFactory.fromUri(input) > Which will eliminate the error and will have the additional advantage of being > a tad faster. Thanks, it works now! I have one more thing though - As I already have the XML file parsed to a DOM instance, it would be a nice thing if I could use that DOM instance instead of reading the whole XML file again from disk. I have tried this approach: def ProcessFile(dom, input, output): xsltprocessor = Processor() transform = InputSource.DefaultFactory.fromUri("ujds.xslt") xsltprocessor.appendStylesheet(transform) result = xsltprocessor.runNode(dom, input) if result: open(output, "w").write(result) Which results in a file with this line only: I am trying to output as HTML, which now works nicely through the other way. How can I (if possible/feasible at all) just use the DOM instance instead of loading the file? > I pointed to the likely solution above. You may also want to browse my > article on 4Suite: > http://www.xml.com/pub/a/2002/10/16/py-xml.html > Which gives a fuller example and some discussion. A fuller discussion on > 4Suite's pickiness about URIs is in the following: > http://uche.ogbuji.net/tech/akara/pyxml/domlettes/ Thanks, I'll look into those articles! -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From anders@bruun-olsen.net Fri Dec 13 16:03:42 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Fri, 13 Dec 2002 17:03:42 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: References: <20021213133618.GA9794@eddie.local> Message-ID: <20021213160342.GD9794@eddie.local> On Fri, Dec 13, 2002 at 08:44:39AM -0700, Uche Ogbuji wrote: > > xsltprocessor.appendStylesheetUri("ujds.xslt") > > AttributeError: Processor instance has no attribute 'appendStylesheetUri' > There is no more 'appendStylesheetUri'. You replace it with > from Ft.Xml.InputSource import DefaultFactory > xsltprocessor.appendStylesheet(DefaultFactory.fromUri(xsl_uri)) > html = xsltproc.run(DefaultFactory.fromUri(src_uri)) Okay, good to know :) > > I forgot to mention that I am using 4Suite 0.11.1 > You mean 0.12.0, right? I am running Gentoo and have installed 4Suite using ebuild script they have in Portage which claims to be 0.11.1.. -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From uche.ogbuji@fourthought.com Fri Dec 13 20:37:58 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Fri, 13 Dec 2002 13:37:58 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Fri, 13 Dec 2002 17:03:42 +0100." <20021213160342.GD9794@eddie.local> Message-ID: > On Fri, Dec 13, 2002 at 08:44:39AM -0700, Uche Ogbuji wrote: > > > xsltprocessor.appendStylesheetUri("ujds.xslt") > > > AttributeError: Processor instance has no attribute 'appendStylesheetUri' > > There is no more 'appendStylesheetUri'. You replace it with > > from Ft.Xml.InputSource import DefaultFactory > > xsltprocessor.appendStylesheet(DefaultFactory.fromUri(xsl_uri)) > > html = xsltproc.run(DefaultFactory.fromUri(src_uri)) > > Okay, good to know :) > > > > I forgot to mention that I am using 4Suite 0.11.1 > > You mean 0.12.0, right? > > I am running Gentoo and have installed 4Suite using ebuild script they > have in Portage which claims to be 0.11.1.. Wow. That packaging is very confused. Everything you're doing here pertains strictly to 0.12.0. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From uche.ogbuji@fourthought.com Fri Dec 13 20:50:41 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Fri, 13 Dec 2002 13:50:41 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Fri, 13 Dec 2002 17:02:01 +0100." <20021213160201.GC9794@eddie.local> Message-ID: > On Fri, Dec 13, 2002 at 08:41:59AM -0700, Uche Ogbuji wrote: > > > def ProcessFile(input, output): > > > XSLT = open("ujds.xslt", "r").read() > > > XML = open(input, "r").read() > > > xsltprocessor = Processor() > > > transform = InputSource.DefaultFactory.fromString(XSLT) > > > document = InputSource.DefaultFactory.fromString(XML) > > I always strongly suggest that you still use URIs here. For example > > transform = InputSource.DefaultFactory.fromString(XSLT, "ujds.xslt") > > This avoids errors if you try to do something later that performs resolution > > against a relative URI. > > Note that you can just write: > > xsltprocessor = Processor() > > transform = InputSource.DefaultFactory.fromUri("ujds.xslt") > > document = InputSource.DefaultFactory.fromUri(input) > > Which will eliminate the error and will have the additional advantage of being > > a tad faster. > > Thanks, it works now! > > I have one more thing though - As I already have the XML file parsed to > a DOM instance, it would be a nice thing if I could use that DOM > instance instead of reading the whole XML file again from disk. I have > tried this approach: > > def ProcessFile(dom, input, output): > > xsltprocessor = Processor() > > transform = InputSource.DefaultFactory.fromUri("ujds.xslt") > > xsltprocessor.appendStylesheet(transform) > result = xsltprocessor.runNode(dom, input) > if result: > open(output, "w").write(result) > > Which results in a file with this line only: > > > > I am trying to output as HTML, which now works nicely through the other > way. How can I (if possible/feasible at all) just use the DOM instance > instead of loading the file? Hmm. Works for me. Try this script and tell me what you get: TRANSFORM = """ """ SOURCE = """I don't like spam""" from Ft.Xml.Xslt import Processor processor = Processor.Processor() from Ft.Xml.Domlette import NonvalidatingReader #Create a DOM for the transform transform = NonvalidatingReader.parseString(TRANSFORM, "http://spam.com/identity.xslt") #Create a DOM for the source document source = NonvalidatingReader.parseString(SOURCE, "http://spam.com/doc.xml") processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") result = processor.runNode(source, "http://spam.com/doc.xml") print result I get: $ python domxslt.py I don't like spam -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From anders@bruun-olsen.net Fri Dec 13 21:03:15 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Fri, 13 Dec 2002 22:03:15 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: References: <20021213160342.GD9794@eddie.local> Message-ID: <20021213210314.GH9794@eddie.local> On Fri, Dec 13, 2002 at 01:37:58PM -0700, Uche Ogbuji wrote: > > Okay, good to know :) > > > > I forgot to mention that I am using 4Suite 0.11.1 > > > You mean 0.12.0, right? > > I am running Gentoo and have installed 4Suite using ebuild script they > > have in Portage which claims to be 0.11.1.. > Wow. That packaging is very confused. Everything you're doing here pertains > strictly to 0.12.0. Is there a way to check directly in the installed files which version it is?.. -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From anders@bruun-olsen.net Fri Dec 13 21:07:37 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Fri, 13 Dec 2002 22:07:37 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: References: <20021213160201.GC9794@eddie.local> Message-ID: <20021213210737.GI9794@eddie.local> On Fri, Dec 13, 2002 at 01:50:41PM -0700, Uche Ogbuji wrote: > Hmm. Works for me. Try this script and tell me what you get: > TRANSFORM = """ version="1.0"> > > > > > > > """ > SOURCE = """I don't like spam""" > processor = Processor.Processor() > from Ft.Xml.Domlette import NonvalidatingReader > #Create a DOM for the transform > transform = NonvalidatingReader.parseString(TRANSFORM, > "http://spam.com/identity.xslt") > #Create a DOM for the source document > source = NonvalidatingReader.parseString(SOURCE, "http://spam.com/doc.xml") > processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") > result = processor.runNode(source, "http://spam.com/doc.xml") > print result > I get: > $ python domxslt.py > > I don't like spam I get: Traceback (most recent call last): File "test.py", line 23, in ? processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") AttributeError: Processor instance has no attribute 'appendStylesheetNode' -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From uche.ogbuji@fourthought.com Fri Dec 13 22:41:25 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Fri, 13 Dec 2002 15:41:25 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Fri, 13 Dec 2002 22:03:15 +0100." <20021213210314.GH9794@eddie.local> Message-ID: > On Fri, Dec 13, 2002 at 01:37:58PM -0700, Uche Ogbuji wrote: > > > Okay, good to know :) > > > > > I forgot to mention that I am using 4Suite 0.11.1 > > > > You mean 0.12.0, right? > > > I am running Gentoo and have installed 4Suite using ebuild script they > > > have in Portage which claims to be 0.11.1.. > > Wow. That packaging is very confused. Everything you're doing here pertains > > strictly to 0.12.0. > > Is there a way to check directly in the installed files which version it > is?.. Yes. You could use the command line tool: $ 4xslt -V 4XSLT, from 4Suite 0.12.0b1 Or you could find the library dir and look for Xml/__packageInfo__.py $ grep "version " /usr/lib/python2.2/site-packages/Ft/Xml/__packageInfo__.py version = '0.12.0b1' However, I think this is different in 0.11.1, where it's in a file called __version__. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From uche.ogbuji@fourthought.com Fri Dec 13 22:44:32 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Fri, 13 Dec 2002 15:44:32 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Fri, 13 Dec 2002 22:07:37 +0100." <20021213210737.GI9794@eddie.local> Message-ID: > On Fri, Dec 13, 2002 at 01:50:41PM -0700, Uche Ogbuji wrote: > > Hmm. Works for me. Try this script and tell me what you get: > > TRANSFORM = """ > version="1.0"> > > > > > > > > > > > > > > """ > > SOURCE = """I don't like spam""" > > processor = Processor.Processor() > > from Ft.Xml.Domlette import NonvalidatingReader > > #Create a DOM for the transform > > transform = NonvalidatingReader.parseString(TRANSFORM, > > "http://spam.com/identity.xslt") > > #Create a DOM for the source document > > source = NonvalidatingReader.parseString(SOURCE, "http://spam.com/doc.xml") > > processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") > > result = processor.runNode(source, "http://spam.com/doc.xml") > > print result > > I get: > > $ python domxslt.py > > > > I don't like spam > > I get: > > Traceback (most recent call last): > File "test.py", line 23, in ? > processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") > AttributeError: Processor instance has no attribute 'appendStylesheetNode' Oh. I now remember that appendStylesheetNode was only re-introduced in the latest alpha release. You'll need 4Suite 0.12.0a3 or a recent CVS snapshot to use it. This might, in general, be a good idea because of this versioning confusion. That way you can be sure of what you have :-) Installing released version: http://4suite.org/docs/howto/UNIX.xml Installing CVS version: http://4suite.org/docs/4SuiteCVS.xml -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From anders@bruun-olsen.net Fri Dec 13 23:00:18 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sat, 14 Dec 2002 00:00:18 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: References: <20021213210314.GH9794@eddie.local> Message-ID: <20021213230018.GO9794@eddie.local> On Fri, Dec 13, 2002 at 03:41:25PM -0700, Uche Ogbuji wrote: > > Is there a way to check directly in the installed files which version it > > is?.. > Yes. You could use the command line tool: > $ 4xslt -V > 4XSLT, from 4Suite 0.12.0b1 > Or you could find the library dir and look for Xml/__packageInfo__.py > $ grep "version " /usr/lib/python2.2/site-packages/Ft/Xml/__packageInfo__.py > version = '0.12.0b1' > However, I think this is different in 0.11.1, where it's in a file called > __version__. $ grep "version " /usr/lib/python2.2/site-packages/Ft/Xml/__packageInfo__.py version = '0.12.0a3' So I am running 0.12.0 .. I actually think I installed that manually.. hmm... At least that settles what version I am using :) -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From anders@bruun-olsen.net Fri Dec 13 23:03:56 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sat, 14 Dec 2002 00:03:56 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: References: <20021213210737.GI9794@eddie.local> Message-ID: <20021213230356.GP9794@eddie.local> On Fri, Dec 13, 2002 at 03:44:32PM -0700, Uche Ogbuji wrote: > > I get: > > Traceback (most recent call last): > > File "test.py", line 23, in ? > > processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") > > AttributeError: Processor instance has no attribute 'appendStylesheetNode' > Oh. I now remember that appendStylesheetNode was only re-introduced in the > latest alpha release. You'll need 4Suite 0.12.0a3 or a recent CVS snapshot to > use it. As you can read in another post I _DO_ have 0.12.0a3, so I think my versions might be mixed up, so now I am uninstalling 4Suite completely, downloading 0.12.0a3 and installing that manually :) > This might, in general, be a good idea because of this versioning confusion. > That way you can be sure of what you have :-) > Installing released version: http://4suite.org/docs/howto/UNIX.xml > Installing CVS version: http://4suite.org/docs/4SuiteCVS.xml -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From anders@bruun-olsen.net Fri Dec 13 23:36:23 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sat, 14 Dec 2002 00:36:23 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: <20021213230356.GP9794@eddie.local> References: <20021213210737.GI9794@eddie.local> <20021213230356.GP9794@eddie.local> Message-ID: <20021213233622.GS9794@eddie.local> On Sat, Dec 14, 2002 at 12:03:56AM +0100, Anders Bruun Olsen wrote: > > > I get: > > > Traceback (most recent call last): > > > File "test.py", line 23, in ? > > > processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") > > > AttributeError: Processor instance has no attribute 'appendStylesheetNode' > > Oh. I now remember that appendStylesheetNode was only re-introduced in the > > latest alpha release. You'll need 4Suite 0.12.0a3 or a recent CVS snapshot to > > use it. > As you can read in another post I _DO_ have 0.12.0a3, so I think my > versions might be mixed up, so now I am uninstalling 4Suite completely, > downloading 0.12.0a3 and installing that manually :) I have now removed all traces of 4Suite and installed 0.12.0a3 "manually" but I still get the above traceback, so I guess appendStyleSheetNode wasn't re-introduced until later version. Well never mind, I'll just apply stylesheets on the files, it's not that much longer it takes... Thanks for your help. -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From mike@skew.org Sat Dec 14 00:48:02 2002 From: mike@skew.org (Mike Brown) Date: Fri, 13 Dec 2002 17:48:02 -0700 (MST) Subject: [XML-SIG] 4Suite problems In-Reply-To: <20021213233622.GS9794@eddie.local> "from Anders Bruun Olsen at Dec 14, 2002 00:36:23 am" Message-ID: <200212140048.gBE0m2uX024163@chilled.skew.org> Anders Bruun Olsen wrote: > On Sat, Dec 14, 2002 at 12:03:56AM +0100, Anders Bruun Olsen wrote: > > > > I get: > > > > Traceback (most recent call last): > > > > File "test.py", line 23, in ? > > > > processor.appendStylesheetNode(transform, "http://spam.com/identity.xslt") > > > > AttributeError: Processor instance has no attribute 'appendStylesheetNode' > > > Oh. I now remember that appendStylesheetNode was only re-introduced in the > > > latest alpha release. You'll need 4Suite 0.12.0a3 or a recent CVS snapshot to > > > use it. > > As you can read in another post I _DO_ have 0.12.0a3, so I think my > > versions might be mixed up, so now I am uninstalling 4Suite completely, > > downloading 0.12.0a3 and installing that manually :) > > I have now removed all traces of 4Suite and installed 0.12.0a3 > "manually" but I still get the above traceback, so I guess > appendStyleSheetNode wasn't re-introduced until later version. Yup. See http://cvs.4suite.org/cgi-bin/viewcvs.cgi/4Suite/Ft/Xml/Xslt/Processor.py ... appendStylesheetNode() arrived on Oct 2. > Well never mind, I'll just apply stylesheets on the files, it's not that > much longer it takes... You could use a current CVS snapshot from ftp://ftp.4suite.org/cvs-snapshots/ if you really want... Mike -- Mike J. Brown | http://skew.org/~mike/resume/ Denver, CO, USA | http://skew.org/xml/ From anders@bruun-olsen.net Sat Dec 14 01:50:21 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sat, 14 Dec 2002 02:50:21 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: <200212140048.gBE0m2uX024163@chilled.skew.org> References: <20021213233622.GS9794@eddie.local> <200212140048.gBE0m2uX024163@chilled.skew.org> Message-ID: <20021214015020.GT9794@eddie.local> On Fri, Dec 13, 2002 at 05:48:02PM -0700, Mike Brown wrote: > > Well never mind, I'll just apply stylesheets on the files, it's not that > > much longer it takes... > You could use a current CVS snapshot from ftp://ftp.4suite.org/cvs-snapshots/ > if you really want... Nah.. the future users of my app are not exactly computer experts, so they need something that is easily installable under windows. With a wellwritten guide they should be able to handle installing python, wxPython, 4Suite and PyXML. I have tried using py2exe to make a standalone program, but I can't really get it to work correctly... -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From uche.ogbuji@fourthought.com Sat Dec 14 03:31:21 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Fri, 13 Dec 2002 20:31:21 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Sat, 14 Dec 2002 02:50:21 +0100." <20021214015020.GT9794@eddie.local> Message-ID: > On Fri, Dec 13, 2002 at 05:48:02PM -0700, Mike Brown wrote: > > > Well never mind, I'll just apply stylesheets on the files, it's not that > > > much longer it takes... > > You could use a current CVS snapshot from ftp://ftp.4suite.org/cvs-snapshots/ > > if you really want... > > Nah.. the future users of my app are not exactly computer experts, so > they need something that is easily installable under windows. With a > wellwritten guide they should be able to handle installing python, > wxPython, 4Suite and PyXML. > I have tried using py2exe to make a standalone program, but I can't > really get it to work correctly... I'll be interested in following your progress on the py2exe stuff. I know some folks had trouble with freeze at one point. I'd like to be able to offer a recipe for distributing 4Suite in a self-contained way. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From anders@bruun-olsen.net Sat Dec 14 12:03:24 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sat, 14 Dec 2002 13:03:24 +0100 Subject: [XML-SIG] 4Suite problems In-Reply-To: References: <20021214015020.GT9794@eddie.local> Message-ID: <20021214120324.GV9794@eddie.local> On Fri, Dec 13, 2002 at 08:31:21PM -0700, Uche Ogbuji wrote: > > > > Well never mind, I'll just apply stylesheets on the files, it's not that > > > > much longer it takes... > > > You could use a current CVS snapshot from ftp://ftp.4suite.org/cvs-snapshots/ > > > if you really want... > > Nah.. the future users of my app are not exactly computer experts, so > > they need something that is easily installable under windows. With a > > wellwritten guide they should be able to handle installing python, > > wxPython, 4Suite and PyXML. > > I have tried using py2exe to make a standalone program, but I can't > > really get it to work correctly... > I'll be interested in following your progress on the py2exe stuff. I know > some folks had trouble with freeze at one point. > I'd like to be able to offer a recipe for distributing 4Suite in a > self-contained way. I will start trying really hard to get py2exe to work once the program has reached a somewhat finished state (only 2 things more to fix). Should I mail you directly or should I mail the list upon interesting progress (or lack of same)? -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From Mike.Olson@fourthought.com Sat Dec 14 22:34:17 2002 From: Mike.Olson@fourthought.com (Mike Olson) Date: 14 Dec 2002 15:34:17 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: <20021214120324.GV9794@eddie.local> References: <20021214015020.GT9794@eddie.local> <20021214120324.GV9794@eddie.local> Message-ID: <1039905261.15983.12.camel@penny> On Sat, 2002-12-14 at 05:03, Anders Bruun Olsen wrote: > On Fri, Dec 13, 2002 at 08:31:21PM -0700, Uche Ogbuji wrote: > > > > > Well never mind, I'll just apply stylesheets on the files, it's not that > > > > > much longer it takes... > > > > You could use a current CVS snapshot from ftp://ftp.4suite.org/cvs-snapshots/ > > > > if you really want... > > > Nah.. the future users of my app are not exactly computer experts, so > > > they need something that is easily installable under windows. With a > > > wellwritten guide they should be able to handle installing python, > > > wxPython, 4Suite and PyXML. > > > I have tried using py2exe to make a standalone program, but I can't > > > really get it to work correctly... > > I'll be interested in following your progress on the py2exe stuff. I know > > some folks had trouble with freeze at one point. > > I'd like to be able to offer a recipe for distributing 4Suite in a > > self-contained way. > > I will start trying really hard to get py2exe to work once the program > has reached a somewhat finished state (only 2 things more to fix). > > Should I mail you directly or should I mail the list upon interesting > progress (or lack of same)? I'd be interested in hearing about it. I just recently thought it would be cool to take a stylesheet and 4Sutie and create a standalone filtering application (using p2exe). Mike > > -- > Anders > -----BEGIN GEEK CODE BLOCK----- > Version: 3.12 > GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V > PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? > ------END GEEK CODE BLOCK------ > PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig -- Mike Olson Principal Consultant mike.olson@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 From uche.ogbuji@fourthought.com Sun Dec 15 02:23:10 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Sat, 14 Dec 2002 19:23:10 -0700 Subject: [XML-SIG] 4Suite problems In-Reply-To: Message from Anders Bruun Olsen of "Sat, 14 Dec 2002 13:03:24 +0100." <20021214120324.GV9794@eddie.local> Message-ID: > On Fri, Dec 13, 2002 at 08:31:21PM -0700, Uche Ogbuji wrote: > > > > > Well never mind, I'll just apply stylesheets on the files, it's not that > > > > > much longer it takes... > > > > You could use a current CVS snapshot from ftp://ftp.4suite.org/cvs-snapshots/ > > > > if you really want... > > > Nah.. the future users of my app are not exactly computer experts, so > > > they need something that is easily installable under windows. With a > > > wellwritten guide they should be able to handle installing python, > > > wxPython, 4Suite and PyXML. > > > I have tried using py2exe to make a standalone program, but I can't > > > really get it to work correctly... > > I'll be interested in following your progress on the py2exe stuff. I know > > some folks had trouble with freeze at one point. > > I'd like to be able to offer a recipe for distributing 4Suite in a > > self-contained way. > > I will start trying really hard to get py2exe to work once the program > has reached a somewhat finished state (only 2 things more to fix). > > Should I mail you directly or should I mail the list upon interesting > progress (or lack of same)? I think it would be best to send mail to the 4Suite list. http://lists.fourthought.com/mailman/listinfo/4suite If you don't wish to subscribe, let me know and I'll grant you permissions to post without subscribing. Thanks. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From anders@bruun-olsen.net Sun Dec 15 11:09:28 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sun, 15 Dec 2002 12:09:28 +0100 Subject: [XML-SIG] py2exe (Was: 4Suite problems) In-Reply-To: References: <20021214120324.GV9794@eddie.local> Message-ID: <20021215110928.GB9706@eddie.local> On Sat, Dec 14, 2002 at 07:23:10PM -0700, Uche Ogbuji wrote: > > I will start trying really hard to get py2exe to work once the program > > has reached a somewhat finished state (only 2 things more to fix). > > Should I mail you directly or should I mail the list upon interesting > > progress (or lack of same)? > I think it would be best to send mail to the 4Suite list. > http://lists.fourthought.com/mailman/listinfo/4suite > If you don't wish to subscribe, let me know and I'll grant you permissions to > post without subscribing. Okay, I have subscribed, but I think that this first problem I have run into is related to PyXML, not 4Suite. After having build an exe file and whatever other files py2exe has deemed necessary I run the exe file and get this output: Traceback (most recent call last): File "", line 26, in ? File "imputil.pyc", line 103, in _import_hook File "", line 52, in _import_top_module File "imputil.pyc", line 216, in import_top File "imputil.pyc", line 271, in _import_one File "", line 128, in _process_result File "backend.pyc", line 24, in ? File "imputil.pyc", line 132, in _import_hook File "", line 70, in _finish_import File "imputil.pyc", line 318, in _load_tail ImportError: No module named _xmlplus.dom I am pretty sure _xmlplus.dom is something in the PyXML package (which I also use in my program), right? I really have no idea what to do about this. Please note that I am running it on the same machine I have built it on, which means that all the Python stuff is installed there. -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From anders@bruun-olsen.net Sun Dec 15 11:40:49 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sun, 15 Dec 2002 12:40:49 +0100 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite Message-ID: <20021215114049.GA21192@eddie.local> Hi, As you all know I am trying to figure out how to package up my python app with py2exe and as it seems to be having problems with PyXML specific stuff I thought it might be an idea to try and see if I could port all of my code to use only 4Suite specific stuff. I read http://uche.ogbuji.net:8080/uche.ogbuji.net/tech/akara/pyxml/domlettes/ where I can see that Domlette should be able to do the work that I am currently using minidom for. I can see that the return result of NonvalidatingReader.parseUri is a cDocument instance which does not offer the same methods as dom instances from minidom. This is not a big problem as long as there are something similar available, however I can't seem to find any documentation about what methods are available for cDocument objects, not even google could come up with anything useful, so could somebody direct me to the documentation I am seeking, if such does indeed exist? -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From mike@skew.org Sun Dec 15 12:03:03 2002 From: mike@skew.org (Mike Brown) Date: Sun, 15 Dec 2002 05:03:03 -0700 (MST) Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: <20021215114049.GA21192@eddie.local> "from Anders Bruun Olsen at Dec 15, 2002 12:40:49 pm" Message-ID: <200212151203.gBFC34Jd034204@chilled.skew.org> Anders Bruun Olsen wrote: > I can't seem to find any documentation about what methods are available > for cDocument objects I don't think there is any yet. But don't forget about Python's introspection capabilities. % python Python 2.2.1 (#1, Jul 1 2002, 19:51:59) [GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> from Ft.Xml.Domlette import NonvalidatingReader >>> doc = NonvalidatingReader.parseUri('file:///opus/home/mike/xml/test/dummy.xml') >>> dir(doc) ['appendChild', 'cloneNode', 'createAttributeNS', 'createComment', 'createDocumentFragment', 'createElementNS', 'createNodeIterator', 'createProcessingInstruction', 'createTextNode', 'hasChildNodes', 'importNode', 'insertBefore', 'isSameNode', 'normalize', 'removeChild', 'replaceChild'] >>> for attr in dir(doc): ... print attr,":", ... if eval('doc.' + attr + '.__doc__'): ... print eval('doc.' + attr + '.__doc__') ... appendChild : Add a new child to the child list cloneNode : Make a copy of a node from this document createAttributeNS : Create a new attribute createComment : Create a new comment node createDocumentFragment : Create a new document fragment node createElementNS : Create a new element createNodeIterator : Create a new node iterator createProcessingInstruction : Create a new processing instruction node createTextNode : Create a new text node hasChildNodes : Return True if the node has children importNode : Make a copy of a node from any document insertBefore : insert a new child to the child list isSameNode : true if this node instance is the same as another normalize : Combine all neighboring text child nodes removeChild : Remove a node from a child list replaceChild : replace a child in the child list From anders@bruun-olsen.net Sun Dec 15 12:29:25 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Sun, 15 Dec 2002 13:29:25 +0100 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: <200212151203.gBFC34Jd034204@chilled.skew.org> References: <20021215114049.GA21192@eddie.local> <200212151203.gBFC34Jd034204@chilled.skew.org> Message-ID: <20021215122925.GB21192@eddie.local> On Sun, Dec 15, 2002 at 05:03:03AM -0700, Mike Brown wrote: > > I can't seem to find any documentation about what methods are available > > for cDocument objects > I don't think there is any yet. > But don't forget about Python's introspection capabilities. Ahh.. didn't know about those, thanks. > appendChild : Add a new child to the child list > cloneNode : Make a copy of a node from this document > createAttributeNS : Create a new attribute > createComment : Create a new comment node > createDocumentFragment : Create a new document fragment node > createElementNS : Create a new element > createNodeIterator : Create a new node iterator > createProcessingInstruction : Create a new processing instruction node > createTextNode : Create a new text node > hasChildNodes : Return True if the node has children > importNode : Make a copy of a node from any document > insertBefore : insert a new child to the child list > isSameNode : true if this node instance is the same as another > normalize : Combine all neighboring text child nodes > removeChild : Remove a node from a child list > replaceChild : replace a child in the child list And now, how would I then do the equivalent of dom.documentElement.getElementsByTagName("tagname") with cDocument instead? -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From uche.ogbuji@fourthought.com Sun Dec 15 15:27:09 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Sun, 15 Dec 2002 08:27:09 -0700 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: Message from Anders Bruun Olsen of "Sun, 15 Dec 2002 13:29:25 +0100." <20021215122925.GB21192@eddie.local> Message-ID: > On Sun, Dec 15, 2002 at 05:03:03AM -0700, Mike Brown wrote: > > > I can't seem to find any documentation about what methods are available > > > for cDocument objects > > I don't think there is any yet. > > But don't forget about Python's introspection capabilities. > > Ahh.. didn't know about those, thanks. > > > appendChild : Add a new child to the child list > > cloneNode : Make a copy of a node from this document > > createAttributeNS : Create a new attribute > > createComment : Create a new comment node > > createDocumentFragment : Create a new document fragment node > > createElementNS : Create a new element > > createNodeIterator : Create a new node iterator > > createProcessingInstruction : Create a new processing instruction node > > createTextNode : Create a new text node > > hasChildNodes : Return True if the node has children > > importNode : Make a copy of a node from any document > > insertBefore : insert a new child to the child list > > isSameNode : true if this node instance is the same as another > > normalize : Combine all neighboring text child nodes > > removeChild : Remove a node from a child list > > replaceChild : replace a child in the child list > > And now, how would I then do the equivalent of > dom.documentElement.getElementsByTagName("tagname") with cDocument > instead? We didn't add a getElementsByTagName *method* to cDomlette, as I warn in http://www.xml.com/pub/a/2002/12/11/py-xml.html "There is also at least one warning to attach to my suggestions to use Domlette. The book makes frequent use of the DOM method getElementsByTagName, which is not supported in Domlette, for simplicity. An equivalent function is very easy to write for yourself. I would suggest an implementation that uses Python generators and I will present just such an implementation in a forthcoming article." Because you're such a nice guy, I'll ditch the tease for you :-) from __future__ import generators from xml.dom import Node def doc_order_iterator(node): yield node for child in node.childNodes: for cn in doc_order_iterator(child): yield cn return def doc_order_iterator_filter(node, filter_func): if filter_func(node): yield node for child in node.childNodes: for cn in doc_order_iterator_filter(child, filter_func): yield cn return def get_elements_by_tag_name(node, name): return doc_order_iterator_filter(node, lambda n: n.nodeType == \ Node.ELEMENT_NODE and n.nodeName == name) def get_elements_by_tag_name_ns(node, ns, local): return doc_order_iterator_filter(node, lambda n: n.nodeType == \ Node.ELEMENT_NODE and n.namespaceURI == ns and n.localName == local) def get_first_element_by_tag_name_ns(node, ns, local): return get_elements_by_tag_name_ns(node, ns, local).next() #etc. For a fuller discussion of the basic techniques I use here, see: http://www-106.ibm.com/developerworks/xml/library/x-tipgenr.html As you can see, many of the things one needs to know about PyXML and 4Suite are documented, but the documents are quite poorly organized. I've put a lot of work into at least making the info available, and we are be putting some work into getting it organized in our push towards 4SUite 1.0. Don't hesitate to ask, in the meantime. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From uche.ogbuji@fourthought.com Sun Dec 15 17:15:23 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Sun, 15 Dec 2002 10:15:23 -0700 Subject: [XML-SIG] Article: "A Python & XML Companion" Message-ID: http://www.xml.com/pub/a/2002/12/11/py-xml.html I offers updates and notes on Python & XML, by Jones and Drake. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p yth11.html Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb ugxs.html From Mike.Olson@fourthought.com Sun Dec 15 20:00:02 2002 From: Mike.Olson@fourthought.com (Mike Olson) Date: 15 Dec 2002 13:00:02 -0700 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: References: Message-ID: <1039982404.15983.17.camel@penny> > > Because you're such a nice guy, I'll ditch the tease for you :-) You can also do these much more easily using XPath... from Ft.Xml import XPath def getElementsByTagName(node,name) return XPath.evaluate(node,".//" + name) It really does not need to be a function in this case, just inline it where ever you need it. Mike > > from __future__ import generators > from xml.dom import Node > > > def doc_order_iterator(node): > yield node > for child in node.childNodes: > for cn in doc_order_iterator(child): > yield cn > return > > > def doc_order_iterator_filter(node, filter_func): > if filter_func(node): > yield node > for child in node.childNodes: > for cn in doc_order_iterator_filter(child, filter_func): > yield cn > return > > > def get_elements_by_tag_name(node, name): > return doc_order_iterator_filter(node, lambda n: n.nodeType == \ > Node.ELEMENT_NODE and n.nodeName == name) > > > def get_elements_by_tag_name_ns(node, ns, local): > return doc_order_iterator_filter(node, lambda n: n.nodeType == \ > Node.ELEMENT_NODE and n.namespaceURI == ns and n.localName == local) > > > def get_first_element_by_tag_name_ns(node, ns, local): > return get_elements_by_tag_name_ns(node, ns, local).next() > > #etc. > > > For a fuller discussion of the basic techniques I use here, see: > > http://www-106.ibm.com/developerworks/xml/library/x-tipgenr.html > > As you can see, many of the things one needs to know about PyXML and 4Suite > are documented, but the documents are quite poorly organized. I've put a lot > of work into at least making the info available, and we are be putting some > work into getting it organized in our push towards 4SUite 1.0. Don't hesitate > to ask, in the meantime. > > > -- > Uche Ogbuji Fourthought, Inc. > http://uche.ogbuji.net http://4Suite.org http://fourthought.com > Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html > Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html > RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p > yth11.html > Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb > ugxs.html > > > > _______________________________________________ > XML-SIG maillist - XML-SIG@python.org > http://mail.python.org/mailman/listinfo/xml-sig -- Mike Olson Principal Consultant mike.olson@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 From uche.ogbuji@fourthought.com Sun Dec 15 21:25:04 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Sun, 15 Dec 2002 14:25:04 -0700 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: Message from Mike Olson of "15 Dec 2002 13:00:02 MST." <1039982404.15983.17.camel@penny> Message-ID: > > > > Because you're such a nice guy, I'll ditch the tease for you :-) > > You can also do these much more easily using XPath... > > from Ft.Xml import XPath > > > def getElementsByTagName(node,name) > return XPath.evaluate(node,".//" + name) I think my generator approach would be faster, but this XPath approach has the advantage of working in Python 2.0 and 2.1. Mine is 2.2+. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html XML class warfare - http://www.adtmag.com/article.asp?id=6965 MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi nk14.html From anders@bruun-olsen.net Mon Dec 16 06:04:14 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Mon, 16 Dec 2002 07:04:14 +0100 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: References: <1039982404.15983.17.camel@penny> Message-ID: <20021216060413.GD900@eddie.local> On Sun, Dec 15, 2002 at 02:25:04PM -0700, Uche Ogbuji wrote: > > > Because you're such a nice guy, I'll ditch the tease for you :-) > > You can also do these much more easily using XPath... > > from Ft.Xml import XPath > > def getElementsByTagName(node,name) > > return XPath.evaluate(node,".//" + name) > I think my generator approach would be faster, but this XPath approach has the > advantage of working in Python 2.0 and 2.1. Mine is 2.2+. Okay, I have now read up on iterators and generator - WOW! that's so cool!.. I immediately rewrote the search part of my program that had been giving me problems - with generators it just works perfectly and the code is so much simpler! I have implemented Uche's generators now and the function that loads an XML file into my programs internal format has now gone from 6-7 seconds load time to 1-2 second for the 219Kb XML file I am using for testing on my Athlon XP 1800+. Now - my program also saves it's data to disk by creating a dom and filling it with the right nodes and then writing it to disk with PrettyPrint (which takes over 20 seconds on my machine with the 219Kb file). I am sure this can be done much faster with 4Suite somehow, but how? right now I use xml.dom.implementation to create the empty dom, I am betting it is possible to do the same using domlette, I just can't grok how without a little helping hand :) Also it would be great if there was a way to ditch PrettyPrint as I would then be completely rid of PyXML, which seems to be giving py2exe some problems. Once again, thanks for the help so far, you guys are great! :) -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From uche.ogbuji@fourthought.com Mon Dec 16 13:55:59 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Mon, 16 Dec 2002 06:55:59 -0700 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: Message from Anders Bruun Olsen of "Mon, 16 Dec 2002 07:04:14 +0100." <20021216060413.GD900@eddie.local> Message-ID: > On Sun, Dec 15, 2002 at 02:25:04PM -0700, Uche Ogbuji wrote: > > > > Because you're such a nice guy, I'll ditch the tease for you :-) > > > You can also do these much more easily using XPath... > > > from Ft.Xml import XPath > > > def getElementsByTagName(node,name) > > > return XPath.evaluate(node,".//" + name) > > I think my generator approach would be faster, but this XPath approach has the > > advantage of working in Python 2.0 and 2.1. Mine is 2.2+. > > Okay, I have now read up on iterators and generator - WOW! that's so > cool!.. I immediately rewrote the search part of my program that had > been giving me problems - with generators it just works perfectly and > the code is so much simpler! > > I have implemented Uche's generators now and the function that loads an > XML file into my programs internal format has now gone from 6-7 seconds > load time to 1-2 second for the 219Kb XML file I am using for testing on > my Athlon XP 1800+. Generators do absolutely rock. I'm glad you got a good opportunity to learn them as a side effect of trying to figure out Python/XML. > Now - my program also saves it's data to disk by creating a dom and > filling it with the right nodes and then writing it to disk with > PrettyPrint (which takes over 20 seconds on my machine with the 219Kb > file). I am sure this can be done much faster with 4Suite somehow, > but how? Rather than from xml.dom.ext import PrettyPrint use from Ft.Xml.Domlette import PrettyPrint Domlette's PrettyPrint is written in C (with Python fall-back), and is much faster. > right now I use xml.dom.implementation to create the empty dom, I am > betting it is possible to do the same using domlette, I just can't grok > how without a little helping hand :) Ouch. So you're using 4DOM, not Domlette, which is probably a bigger reason for slow performance than PrettyPrint Instead of xml.dom.implementation Use from Ft.Xml.Domlette import implementation Again I must warn you that Domlette approximates DOM and is not a full DOM. You already found the lack of getElementsByTagName. There are other subtle differences. That having been said, I have not run into a situation where Domlette is not a suitable DOM substitute. > Also it would be great if there was a way to ditch PrettyPrint as I > would then be completely rid of PyXML, which seems to be giving py2exe > some problems. Well, the above would remove dependency from PyXML. However, I think we would all like at least a report of the problems py2exe is having with PyXML, since it would be nice if that combo worked. > Once again, thanks for the help so far, you guys are great! :) I'm glad we've been of help. We would in turn be grateful at some point if you were to write up some of your experiences and techniques in order to help others through the same issues. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html XML class warfare - http://www.adtmag.com/article.asp?id=6965 MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi nk14.html From dev-xml@smartology.nl Mon Dec 16 16:02:49 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Mon, 16 Dec 2002 17:02:49 +0100 Subject: [XML-SIG] xmlproc relative dirs for DTD Message-ID: <200212161702.49250.dev-xml@smartology.nl> This is not a real xmlproc problem, but maybe someone has run into the same or similar problem. I have a script that gets xml data via a command line argument. The xml data gets stored as a fileobject using StringIO .. so far so good. But then xmlproc complains that it can't resolve the relative URI. Is it possible to 'give' the StringIO fileobject a virtual path so that DTD's can be resolved? Regards, Remy Cool From michael.l.schneider@eds.com Mon Dec 16 17:48:28 2002 From: michael.l.schneider@eds.com (Michael Schneider) Date: Mon, 16 Dec 2002 12:48:28 -0500 Subject: [XML-SIG] Re: XML-SIG digest, Vol 1 #1505 - 6 msgs References: <20021216170004.27718.82288.Mailman@mail.python.org> Message-ID: <02a901c2a52b$570e31c0$d8277a92@sdrc.com> http://pdweb.sdrc.com/users/scmikes/Compiler/DefineCompileLinkFlags.xml ----- Original Message ----- From: To: Sent: Monday, December 16, 2002 12:00 PM Subject: XML-SIG digest, Vol 1 #1505 - 6 msgs > Send XML-SIG mailing list submissions to > xml-sig@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/xml-sig > or, via email, send a message with subject or body 'help' to > xml-sig-request@python.org > > You can reach the person managing the list at > xml-sig-admin@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of XML-SIG digest..." > > > Today's Topics: > > 1. Article: "A Python & XML Companion" (Uche Ogbuji) > 2. Re: py2exe and switching from PyXML 4Suite (Mike Olson) > 3. Re: py2exe and switching from PyXML 4Suite (Uche Ogbuji) > 4. Re: py2exe and switching from PyXML 4Suite (Anders Bruun Olsen) > 5. Re: py2exe and switching from PyXML 4Suite (Uche Ogbuji) > 6. xmlproc relative dirs for DTD (Remy C. Cool) > > --__--__-- > > Message: 1 > To: 4suite@lists.fourthought.com, xml-sig@python.org > From: Uche Ogbuji > Date: Sun, 15 Dec 2002 10:15:23 -0700 > Subject: [XML-SIG] Article: "A Python & XML Companion" > > http://www.xml.com/pub/a/2002/12/11/py-xml.html > > I offers updates and notes on Python & XML, by Jones and Drake. > > > -- > Uche Ogbuji Fourthought, Inc. > http://uche.ogbuji.net http://4Suite.org http://fourthought.com > Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html > Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html > RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p > yth11.html > Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb > ugxs.html > > > > > --__--__-- > > Message: 2 > Subject: Re: [XML-SIG] py2exe and switching from PyXML 4Suite > From: Mike Olson > To: Uche Ogbuji > Cc: xml-sig@python.org > Date: 15 Dec 2002 13:00:02 -0700 > > > > > Because you're such a nice guy, I'll ditch the tease for you :-) > > You can also do these much more easily using XPath... > > from Ft.Xml import XPath > > > def getElementsByTagName(node,name) > return XPath.evaluate(node,".//" + name) > > > It really does not need to be a function in this case, just inline it > where ever you need it. > > Mike > > > > > > from __future__ import generators > > from xml.dom import Node > > > > > > def doc_order_iterator(node): > > yield node > > for child in node.childNodes: > > for cn in doc_order_iterator(child): > > yield cn > > return > > > > > > def doc_order_iterator_filter(node, filter_func): > > if filter_func(node): > > yield node > > for child in node.childNodes: > > for cn in doc_order_iterator_filter(child, filter_func): > > yield cn > > return > > > > > > def get_elements_by_tag_name(node, name): > > return doc_order_iterator_filter(node, lambda n: n.nodeType == \ > > Node.ELEMENT_NODE and n.nodeName == name) > > > > > > def get_elements_by_tag_name_ns(node, ns, local): > > return doc_order_iterator_filter(node, lambda n: n.nodeType == \ > > Node.ELEMENT_NODE and n.namespaceURI == ns and n.localName == local) > > > > > > def get_first_element_by_tag_name_ns(node, ns, local): > > return get_elements_by_tag_name_ns(node, ns, local).next() > > > > #etc. > > > > > > For a fuller discussion of the basic techniques I use here, see: > > > > http://www-106.ibm.com/developerworks/xml/library/x-tipgenr.html > > > > As you can see, many of the things one needs to know about PyXML and 4Suite > > are documented, but the documents are quite poorly organized. I've put a lot > > of work into at least making the info available, and we are be putting some > > work into getting it organized in our push towards 4SUite 1.0. Don't hesitate > > to ask, in the meantime. > > > > > > -- > > Uche Ogbuji Fourthought, Inc. > > http://uche.ogbuji.net http://4Suite.org http://fourthought.com > > Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html > > Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html > > RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-p > > yth11.html > > Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb > > ugxs.html > > > > > > > > _______________________________________________ > > XML-SIG maillist - XML-SIG@python.org > > http://mail.python.org/mailman/listinfo/xml-sig > -- > Mike Olson Principal Consultant > mike.olson@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 > > > > --__--__-- > > Message: 3 > From: Uche Ogbuji > To: Mike Olson > cc: xml-sig@python.org > Subject: Re: [XML-SIG] py2exe and switching from PyXML 4Suite > Date: Sun, 15 Dec 2002 14:25:04 -0700 > > > > > > > Because you're such a nice guy, I'll ditch the tease for you :-) > > > > You can also do these much more easily using XPath... > > > > from Ft.Xml import XPath > > > > > > def getElementsByTagName(node,name) > > return XPath.evaluate(node,".//" + name) > > I think my generator approach would be faster, but this XPath approach has the > advantage of working in Python 2.0 and 2.1. Mine is 2.2+. > > > -- > Uche Ogbuji Fourthought, Inc. > http://uche.ogbuji.net http://4Suite.org http://fourthought.com > A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html > XML class warfare - http://www.adtmag.com/article.asp?id=6965 > MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi > nk14.html > > > > > --__--__-- > > Message: 4 > Date: Mon, 16 Dec 2002 07:04:14 +0100 > From: Anders Bruun Olsen > To: xml-sig@python.org > Subject: Re: [XML-SIG] py2exe and switching from PyXML 4Suite > > On Sun, Dec 15, 2002 at 02:25:04PM -0700, Uche Ogbuji wrote: > > > > Because you're such a nice guy, I'll ditch the tease for you :-) > > > You can also do these much more easily using XPath... > > > from Ft.Xml import XPath > > > def getElementsByTagName(node,name) > > > return XPath.evaluate(node,".//" + name) > > I think my generator approach would be faster, but this XPath approach has the > > advantage of working in Python 2.0 and 2.1. Mine is 2.2+. > > Okay, I have now read up on iterators and generator - WOW! that's so > cool!.. I immediately rewrote the search part of my program that had > been giving me problems - with generators it just works perfectly and > the code is so much simpler! > > I have implemented Uche's generators now and the function that loads an > XML file into my programs internal format has now gone from 6-7 seconds > load time to 1-2 second for the 219Kb XML file I am using for testing on > my Athlon XP 1800+. > > Now - my program also saves it's data to disk by creating a dom and > filling it with the right nodes and then writing it to disk with > PrettyPrint (which takes over 20 seconds on my machine with the 219Kb > file). I am sure this can be done much faster with 4Suite somehow, > but how? > > right now I use xml.dom.implementation to create the empty dom, I am > betting it is possible to do the same using domlette, I just can't grok > how without a little helping hand :) > > Also it would be great if there was a way to ditch PrettyPrint as I > would then be completely rid of PyXML, which seems to be giving py2exe > some problems. > > Once again, thanks for the help so far, you guys are great! :) > > -- > Anders > -----BEGIN GEEK CODE BLOCK----- > Version: 3.12 > GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V > PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? > ------END GEEK CODE BLOCK------ > PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 > > > --__--__-- > > Message: 5 > From: Uche Ogbuji > To: xml-sig@python.org > Subject: Re: [XML-SIG] py2exe and switching from PyXML 4Suite > Date: Mon, 16 Dec 2002 06:55:59 -0700 > > > On Sun, Dec 15, 2002 at 02:25:04PM -0700, Uche Ogbuji wrote: > > > > > Because you're such a nice guy, I'll ditch the tease for you :-) > > > > You can also do these much more easily using XPath... > > > > from Ft.Xml import XPath > > > > def getElementsByTagName(node,name) > > > > return XPath.evaluate(node,".//" + name) > > > I think my generator approach would be faster, but this XPath approach has the > > > advantage of working in Python 2.0 and 2.1. Mine is 2.2+. > > > > Okay, I have now read up on iterators and generator - WOW! that's so > > cool!.. I immediately rewrote the search part of my program that had > > been giving me problems - with generators it just works perfectly and > > the code is so much simpler! > > > > I have implemented Uche's generators now and the function that loads an > > XML file into my programs internal format has now gone from 6-7 seconds > > load time to 1-2 second for the 219Kb XML file I am using for testing on > > my Athlon XP 1800+. > > Generators do absolutely rock. I'm glad you got a good opportunity to learn > them as a side effect of trying to figure out Python/XML. > > > > Now - my program also saves it's data to disk by creating a dom and > > filling it with the right nodes and then writing it to disk with > > PrettyPrint (which takes over 20 seconds on my machine with the 219Kb > > file). I am sure this can be done much faster with 4Suite somehow, > > but how? > > Rather than > > from xml.dom.ext import PrettyPrint > > use > > from Ft.Xml.Domlette import PrettyPrint > > Domlette's PrettyPrint is written in C (with Python fall-back), and is much > faster. > > > right now I use xml.dom.implementation to create the empty dom, I am > > betting it is possible to do the same using domlette, I just can't grok > > how without a little helping hand :) > > Ouch. So you're using 4DOM, not Domlette, which is probably a bigger reason > for slow performance than PrettyPrint > > Instead of > > xml.dom.implementation > > Use > > from Ft.Xml.Domlette import implementation > > Again I must warn you that Domlette approximates DOM and is not a full DOM. > You already found the lack of getElementsByTagName. There are other subtle > differences. That having been said, I have not run into a situation where > Domlette is not a suitable DOM substitute. > > > > Also it would be great if there was a way to ditch PrettyPrint as I > > would then be completely rid of PyXML, which seems to be giving py2exe > > some problems. > > Well, the above would remove dependency from PyXML. However, I think we would > all like at least a report of the problems py2exe is having with PyXML, since > it would be nice if that combo worked. > > > Once again, thanks for the help so far, you guys are great! :) > > I'm glad we've been of help. > > We would in turn be grateful at some point if you were to write up some of > your experiences and techniques in order to help others through the same > issues. > > > -- > Uche Ogbuji Fourthought, Inc. > http://uche.ogbuji.net http://4Suite.org http://fourthought.com > A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html > XML class warfare - http://www.adtmag.com/article.asp?id=6965 > MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi > nk14.html > > > > > --__--__-- > > Message: 6 > From: "Remy C. Cool" > Reply-To: dev-xml@smartology.nl > Organization: Smartology > To: xml-sig@python.org > Date: Mon, 16 Dec 2002 17:02:49 +0100 > Subject: [XML-SIG] xmlproc relative dirs for DTD > > This is not a real xmlproc problem, but maybe someone has run into the > same or similar problem. > > I have a script that gets xml data via a command line argument. The > xml data gets stored as a fileobject using StringIO .. so far so > good. But then xmlproc complains that it can't resolve the relative > URI. Is it possible to 'give' the StringIO fileobject a virtual path > so that DTD's can be resolved? > > Regards, > Remy Cool > > > > > > End of XML-SIG Digest From anders@bruun-olsen.net Mon Dec 16 19:23:04 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Mon, 16 Dec 2002 20:23:04 +0100 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: References: <20021216060413.GD900@eddie.local> Message-ID: <20021216192304.GI900@eddie.local> On Mon, Dec 16, 2002 at 06:55:59AM -0700, Uche Ogbuji wrote: > Generators do absolutely rock. I'm glad you got a good opportunity to learn > them as a side effect of trying to figure out Python/XML. Yeah, I have learned so much during the last week or so - it's been great :) > > Now - my program also saves it's data to disk by creating a dom and > > filling it with the right nodes and then writing it to disk with > > PrettyPrint (which takes over 20 seconds on my machine with the 219Kb > > file). I am sure this can be done much faster with 4Suite somehow, > > but how? > Rather than > from xml.dom.ext import PrettyPrint > use > from Ft.Xml.Domlette import PrettyPrint > Domlette's PrettyPrint is written in C (with Python fall-back), and is much > faster. > > right now I use xml.dom.implementation to create the empty dom, I am > > betting it is possible to do the same using domlette, I just can't grok > > how without a little helping hand :) > Ouch. So you're using 4DOM, not Domlette, which is probably a bigger reason > for slow performance than PrettyPrint WOW! From a save-time of 25-30 seconds to 2-3 seconds!.. now my app is starting to look like something :) > Again I must warn you that Domlette approximates DOM and is not a full DOM. > You already found the lack of getElementsByTagName. There are other subtle > differences. That having been said, I have not run into a situation where > Domlette is not a suitable DOM substitute. It did what I needed, which is just creating elements and setting attributes.. > > Also it would be great if there was a way to ditch PrettyPrint as I > > would then be completely rid of PyXML, which seems to be giving py2exe > > some problems. > Well, the above would remove dependency from PyXML. However, I think we would > all like at least a report of the problems py2exe is having with PyXML, since > it would be nice if that combo worked. I'll definitely report back my findings - right now I am having a struggle of getting wxPython to work correctly, so until those problems are worked out I can't use py2exe.. I'll post on the list once I have gotten wxPython to behave.. > > Once again, thanks for the help so far, you guys are great! :) > I'm glad we've been of help. > We would in turn be grateful at some point if you were to write up some of > your experiences and techniques in order to help others through the same > issues. I'm not much of a writer, but I should be able to make a collection of links and comment upon those so that my mistakes can be avoided by others who use it to learn Python+XML. -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From uche.ogbuji@fourthought.com Mon Dec 16 21:44:15 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Mon, 16 Dec 2002 14:44:15 -0700 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: Message from Anders Bruun Olsen of "Mon, 16 Dec 2002 20:23:04 +0100." <20021216192304.GI900@eddie.local> Message-ID: > On Mon, Dec 16, 2002 at 06:55:59AM -0700, Uche Ogbuji wrote: > > > Once again, thanks for the help so far, you guys are great! :) > > I'm glad we've been of help. > > We would in turn be grateful at some point if you were to write up some of > > your experiences and techniques in order to help others through the same > > issues. > > I'm not much of a writer, but I should be able to make a collection of > links and comment upon those so that my mistakes can be avoided by > others who use it to learn Python+XML. That would be perfect. I'd be happy to add the required fluff and post it somewhere (perhaps my O'Reilly blog), with full credit to you, of course. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html XML class warfare - http://www.adtmag.com/article.asp?id=6965 MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi nk14.html From anders@bruun-olsen.net Mon Dec 16 23:31:24 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Tue, 17 Dec 2002 00:31:24 +0100 Subject: [XML-SIG] py2exe and switching from PyXML 4Suite In-Reply-To: References: <20021216192304.GI900@eddie.local> Message-ID: <20021216233123.GK900@eddie.local> On Mon, Dec 16, 2002 at 02:44:15PM -0700, Uche Ogbuji wrote: > > I'm not much of a writer, but I should be able to make a collection of > > links and comment upon those so that my mistakes can be avoided by > > others who use it to learn Python+XML. > That would be perfect. I'd be happy to add the required fluff and post it > somewhere (perhaps my O'Reilly blog), with full credit to you, of course. That would be great.. as soon as I solve the problems at hand I'll do something about it :) -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From dev-xml@smartology.nl Tue Dec 17 07:03:03 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Tue, 17 Dec 2002 08:03:03 +0100 Subject: [XML-SIG] xmlproc relative dirs for DTD In-Reply-To: References: <200212161702.49250.dev-xml@smartology.nl> Message-ID: <200212170803.03989.dev-xml@smartology.nl> On Monday 16 December 2002 20:43, Jürgen Hermann wrote: > On Mon, 16 Dec 2002 17:02:49 +0100 "Remy C. Cool" > wrote: > > RCC> I have a script that gets xml data via a command line > argument. The RCC> xml data gets stored as a fileobject using > StringIO .. so far so RCC> good. But then xmlproc complains that it > can't resolve the relative RCC> URI. Is it possible to 'give' the > StringIO fileobject a virtual path RCC> so that DTD's can be > resolved? > > Wrap it into an InputSource object. Thanks From bill@rfa.org Tue Dec 17 15:32:20 2002 From: bill@rfa.org (Bill Eldridge) Date: Tue, 17 Dec 2002 10:32:20 -0500 Subject: [XML-SIG] Repost - disabling entity expansion Message-ID: <3DFF4384.8000408@rfa.org> I have an element v_function referencing external entities &vf1; &vf2; and &vf3; Sometimes I'd like to expand these entities as normal, but other times I'd like to select &vf1; and get &vf1; or vf3 returned or even ??? Is there a simple way to disable the entity expansion? I'm able to do this in libxml2-python but haven't found a way to do this in pyxml from xml.dom.ext.reader.Sax2 import FromXmlStream, FromXmlFile, Reader from xml.sax import xmlreader, make_parser from xml.sax.handler import feature_external_ges, feature_external_pes p = make_parser() #p.setFeature(feature_external_ges, 0) #p.setFeature(feature_external_pes, 0) #doc = FromXmlFile("test.xml", parser=p, validate=0) doc = FromXmlFile("test.xml", parser=p) for library in doc.getElementsByTagName("v_function"): library.normalize() if library.firstChild: print library.firstChild.data From uche.ogbuji@fourthought.com Tue Dec 17 15:22:53 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Tue, 17 Dec 2002 08:22:53 -0700 Subject: [XML-SIG] Repost - disabling entity expansion In-Reply-To: Message from Bill Eldridge of "Tue, 17 Dec 2002 10:32:20 EST." <3DFF4384.8000408@rfa.org> Message-ID: > > I have an element v_function referencing external > entities &vf1; &vf2; and &vf3; > > > > > > > Sometimes I'd like to expand these entities > as normal, but other times I'd like to select > &vf1; > and get &vf1; or vf3 returned or > even ??? > > > Is there a simple way to disable the entity expansion? > I'm able to do this in libxml2-python but haven't found a way > to do this in pyxml I didn't respond to this because I don't know the answer. I don't think there is a simple way to disable entity expansion from the internal subset, because I don't know of any XML parsers that offer this option. Maybe Xerces does? After all, DOM does keep entity ref stuff around and I think Xerces is the strictest DOM implementation out there, which means the undrlying parser probably reports all lexical entities, rather than just those that need resolution. I don't know that there is an easy solution for you, though. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html XML class warfare - http://www.adtmag.com/article.asp?id=6965 MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi nk14.html From scjuonline@web.de Tue Dec 17 15:54:30 2002 From: scjuonline@web.de (JS) Date: Tue, 17 Dec 2002 16:54:30 +0100 Subject: [XML-SIG] PrettyPrint Message-ID: <200212171654.30453.scjuonline@web.de> Hello, I've got the following problem: If I save the following xml file using PrettyPrint() bar I get: ##################PrettyPrint bar Now next time I read in the xml, a new text node is created in the DOM tr= ee=20 due to the indent an newline behind the first element. I could use Print since it doesn't add any additional data. But Pretty is= more=20 pretty ;-) I'm not sure about ignorable whitespace in xml, but I think, it is not=20 correct. Shouldn't the output be ......? thx for your help, regards Juergen =20 From bill@rfa.org Tue Dec 17 16:16:30 2002 From: bill@rfa.org (Bill Eldridge) Date: Tue, 17 Dec 2002 11:16:30 -0500 Subject: [XML-SIG] Repost - disabling entity expansion In-Reply-To: References: Message-ID: <3DFF4DDE.4070807@rfa.org> Okay, as I slipped in a note in the repost, I do have a solution in libxml2-python that follows, so I guess I'll live with that, thanks. #!/usr/bin/python2 import libxml2 import sys import string ctxt = libxml2.createFileParserCtxt("efd_1.xml") ctxt.validate(1) ctxt.parseDocument() doc=ctxt.doc() valid=ctxt.isValid() print "VF1:",doc.docEntity("vf1").serialize() atts=doc.docEntity("vf1").serialize().split() ent,entfull=atts[1],string.join(atts[2:]) print "ENTITY %s: %s" % (ent,entfull) sys.exit() Uche Ogbuji wrote: >>I have an element v_function referencing external >>entities &vf1; &vf2; and &vf3; >> >> >> >> >> >> >>Sometimes I'd like to expand these entities >>as normal, but other times I'd like to select >>&vf1; >>and get &vf1; or vf3 returned or >>even ??? >> >> >>Is there a simple way to disable the entity expansion? >>I'm able to do this in libxml2-python but haven't found a way >>to do this in pyxml >> >> > >I didn't respond to this because I don't know the answer. I don't think there >is a simple way to disable entity expansion from the internal subset, because >I don't know of any XML parsers that offer this option. Maybe Xerces does? >After all, DOM does keep entity ref stuff around and I think Xerces is the >strictest DOM implementation out there, which means the undrlying parser >probably reports all lexical entities, rather than just those that need >resolution. > >I don't know that there is an easy solution for you, though. > > > > From uche.ogbuji@fourthought.com Tue Dec 17 15:53:21 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Tue, 17 Dec 2002 08:53:21 -0700 Subject: [XML-SIG] PrettyPrint In-Reply-To: Message from JS of "Tue, 17 Dec 2002 16:54:30 +0100." <200212171654.30453.scjuonline@web.de> Message-ID: > Hello, > > I've got the following problem: > If I save the following xml file using PrettyPrint() > > > bar > > I get: > ##################PrettyPrint > > > > > > bar > > > Now next time I read in the xml, a new text node is created in the DOM tree > due to the indent an newline behind the first element. > > I could use Print since it doesn't add any additional data. But Pretty is more > pretty ;-) > > I'm not sure about ignorable whitespace in xml, but I think, it is not > correct. > > Shouldn't the output be ......? No. A pretty printer is expected to produce output that may have different white space usage from a plain printer. This is the whole point of a pretty printer. If you don't like that effect, then you should use a plain printer. Can't really have it both ways unless you design a pretty printer specific to your own format. I think you may be able to get closer to what you want with PrettyPrint(root, preserveElements=["raw"]) But I'm not sure that it gets you all the way. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html XML class warfare - http://www.adtmag.com/article.asp?id=6965 MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi nk14.html From anders@bruun-olsen.net Tue Dec 17 16:31:50 2002 From: anders@bruun-olsen.net (Anders Bruun Olsen) Date: Tue, 17 Dec 2002 17:31:50 +0100 Subject: [XML-SIG] PrettyPrint In-Reply-To: <200212171654.30453.scjuonline@web.de> References: <200212171654.30453.scjuonline@web.de> Message-ID: <20021217163149.GA1556@eddie.local> On Tue, Dec 17, 2002 at 04:54:30PM +0100, JS wrote: > I've got the following problem: > If I save the following xml file using PrettyPrint() > > bar > I get: > ##################PrettyPrint > > > > > > bar > > Now next time I read in the xml, a new text node is created in the DOM tree > due to the indent an newline behind the first element. > I could use Print since it doesn't add any additional data. But Pretty is more > pretty ;-) > I'm not sure about ignorable whitespace in xml, but I think, it is not > correct. > Shouldn't the output be ......? I haven't tried this myself, but it sounds like what you are looking for is a normalize function - that way you should be able to rid yourself of the extra whitespace and linebreaks. Please correct me if I am wrong :) -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ $UL+++ P++ L+++ E- W+ N(+) o K? w O- M-- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b+ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 From martin@v.loewis.de Tue Dec 17 16:36:57 2002 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 17 Dec 2002 17:36:57 +0100 Subject: [XML-SIG] PrettyPrint In-Reply-To: <200212171654.30453.scjuonline@web.de> References: <200212171654.30453.scjuonline@web.de> Message-ID: JS writes: > I could use Print since it doesn't add any additional data. But > Pretty is more pretty ;-) > > I'm not sure about ignorable whitespace in xml, but I think, it is not > correct. What do you mean, "not correct"? If you mean that the printed document is not the same (for some definition of "same") as the original document. However, I can't see how you derive specific expectations for the CDATA node from that. *Any* added white space changes the output, so it if adding white space means that the document won't be correct, it is impossible to make a print function that is simultaneously pretty and correct. Regards, Martin From dev-xml@smartology.nl Tue Dec 17 16:35:59 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Tue, 17 Dec 2002 17:35:59 +0100 Subject: [XML-SIG] problem with parser.setFeature(feature_validation, 1) Message-ID: <200212171735.59490.dev-xml@smartology.nl> I have the following code: from xml.sax import make_parser from xml.sax.handler import feature_namespaces, feature_validation from xml.sax.handler import ContentHandler, ErrorHandler, DTDHandler class validation(ContentHandler): ... ... # create a parser parser = make_parser('xml.sax.drivers2.drv_xmlproc') # tell parser we are not interested in XML namespaces parser.setFeature(feature_namespaces, 0) # tell parser to enable validation parser.setFeature(feature_validation, 1) # create the handler valxml = validator() # tell the parser to use our handler parser.setContentHandler(valxml) parser.setErrorHandler(valxml) parser.setDTDHandler(valxml) # Parse the input parser.parse(xml_file) When I use this ... the parser validates, but closing tags are not processed with the endElement(self, name) function in the class validator. When I remove the feature_validation line or set it to 0 ... I don't get a validation error: Element 'tag' not declared when I use the following xml This is a test Is this normal behaviour ? Regards, Remy Cool From molson@fourthought.com Tue Dec 17 16:39:29 2002 From: molson@fourthought.com (Mike.Olson) Date: Tue, 17 Dec 2002 09:39:29 -0700 (MST) Subject: [XML-SIG] PrettyPrint In-Reply-To: <20021217163149.GA1556@eddie.local> Message-ID: On Tue, 17 Dec 2002, Anders Bruun Olsen wrote: > On Tue, Dec 17, 2002 at 04:54:30PM +0100, JS wrote: > > I've got the following problem: > > If I save the following xml file using PrettyPrint() > > > > bar > > I get: > > ##################PrettyPrint > > > > > > > > > > > > bar > > > > Now next time I read in the xml, a new text node is created in the DOM tree > > due to the indent an newline behind the first element. > > I could use Print since it doesn't add any additional data. But Pretty is more > > pretty ;-) > > I'm not sure about ignorable whitespace in xml, but I think, it is not > > correct. > > Shouldn't the output be ......? > > I haven't tried this myself, but it sounds like what you are looking for > is a normalize function - that way you should be able to rid yourself of > the extra whitespace and linebreaks. > > Please correct me if I am wrong :) normalize will not get rid of extra white space and line breaks, it will combine adjacent ones into a single text node. This won't fix this problem as there still will be a text node before the "raw" element. Mike > > -- Mike Olson Principal Consultant mike.olson@fourthought.com +1 303 583 9900 Fourthought, Inc. http://Fourthought.com PO Box 270590, http://4Suite.org Louisville, CO 80027-5009, USA XML strategy, XML tools, knowledge management From scjuonline@web.de Tue Dec 17 16:53:22 2002 From: scjuonline@web.de (JS) Date: Tue, 17 Dec 2002 17:53:22 +0100 Subject: [XML-SIG] PrettyPrint In-Reply-To: References: Message-ID: <200212171753.22210.scjuonline@web.de> What I thought of is: Don't add whitespace to elements which content model is mixed or PCDATA. This wouldn't be as nice as Pretty but would only add ignorable whitespac= e=20 elsewhere.=20 thx, JS > No. A pretty printer is expected to produce output that may have diffe= rent > white space usage from a plain printer. This is the whole point of a > pretty printer. If you don't like that effect, then you should use a p= lain > printer. Can't really have it both ways unless you design a pretty prin= ter > specific to your own format. > > I think you may be able to get closer to what you want with > > PrettyPrint(root, preserveElements=3D["raw"]) > > But I'm not sure that it gets you all the way. From uche.ogbuji@fourthought.com Tue Dec 17 16:26:23 2002 From: uche.ogbuji@fourthought.com (Uche Ogbuji) Date: Tue, 17 Dec 2002 09:26:23 -0700 Subject: [XML-SIG] PrettyPrint In-Reply-To: Message from "Mike.Olson" of "Tue, 17 Dec 2002 09:39:29 MST." Message-ID: > On Tue, 17 Dec 2002, Anders Bruun Olsen wrote: > > > On Tue, Dec 17, 2002 at 04:54:30PM +0100, JS wrote: > > > I've got the following problem: > > > If I save the following xml file using PrettyPrint() > > > > > > bar > > > I get: > > > ##################PrettyPrint > > > > > > > > > > > > > > > > > > bar > > > > > > Now next time I read in the xml, a new text node is created in the DOM tree > > > due to the indent an newline behind the first element. > > > I could use Print since it doesn't add any additional data. But Pretty is more > > > pretty ;-) > > > I'm not sure about ignorable whitespace in xml, but I think, it is not > > > correct. > > > Shouldn't the output be ......? > > > > I haven't tried this myself, but it sounds like what you are looking for > > is a normalize function - that way you should be able to rid yourself of > > the extra whitespace and linebreaks. > > > > Please correct me if I am wrong :) > > normalize will not get rid of extra white space and line breaks, it will > combine adjacent ones into a single text node. This won't fix this > problem as there still will be a text node before the "raw" element. I think he means XPath normalize, which removes leading & trailing white space, as well as combining internal whitespace. This used to be a stand-alone function in Ft/Xml/Xslt/XmlWriter.py as well, but I think Jeremy or I merged it into TranslateCdataAttr. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://4Suite.org http://fourthought.com A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html XML class warfare - http://www.adtmag.com/article.asp?id=6965 MusicBrainz metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi nk14.html From dev-xml@smartology.nl Tue Dec 17 18:22:05 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Tue, 17 Dec 2002 19:22:05 +0100 Subject: [XML-SIG] problem with parser.setFeature(feature_validation, 1) In-Reply-To: <200212171735.59490.dev-xml@smartology.nl> References: <200212171735.59490.dev-xml@smartology.nl> Message-ID: <200212171922.05118.dev-xml@smartology.nl> Working example: When parser.setFeature(feature_validation, 1) is set ... the DTD is checked against the XML file but closing tags are not being printed. When parser.setFeature(feature_validation, 0) is set or the line is commented out, closing tags are printed but the xml file is not validated against the DTD. How can I get both ... a working endElement handler and DTD validation? Remy // CODE // #!/usr/bin/python # # XML validator # import sys from xml.sax import make_parser from xml.sax.handler import feature_namespaces, feature_validation from xml.sax.handler import ContentHandler, ErrorHandler, DTDHandler class validator(ContentHandler): def __init__(self): # initialize self.warnings = [] self.errors = [] def endElement(self, name): print name def warning(self, exception): self.warnings.append(exception) def error(self, exception): self.errors.append(exception) def fatalError(self, exception): self.errors.append(exception) if __name__ == '__main__': # get arguments arguments = sys.argv if len(arguments) > 1: xml_file = arguments[1] # create a parser parser = make_parser('xml.sax.drivers2.drv_xmlproc') # tell parser we are not interested in XML namespaces parser.setFeature(feature_namespaces, 0) # tell parser to enable validation parser.setFeature(feature_validation, 1) # create the handler valxml = validator() # tell the parser to use our handler parser.setContentHandler(valxml) parser.setErrorHandler(valxml) parser.setDTDHandler(valxml) # Parse the input parser.parse(xml_file) # create report print '='*30 print 'RESULTS: %s' % xml_file print '='*30 print 'Warnings:', len(valxml.warnings) print 'Errors :', len(valxml.errors) print if valxml.warnings: for warning in valxml.warnings: print 'Warning: %s' % str(warning) if valxml.errors: for error in valxml.errors: print 'Error : %s' % str(error) else: # no xml file given print 'Usage: xml_validate.py [xml-file]' From dev-xml@smartology.nl Tue Dec 17 20:25:18 2002 From: dev-xml@smartology.nl (Remy C. Cool) Date: Tue, 17 Dec 2002 21:25:18 +0100 Subject: [XML-SIG] What does: Expected type or alternative list mean? Message-ID: <200212172125.18449.dev-xml@smartology.nl> When I validate my xml file with xmlproc ... I get the error: xpdf.xml:2:34: Expected type or alternative list My xml file starts like this: