[XML-SIG] Re: XML-SIG digest, Vol 1 #331 - 3 msgs

Thomas B. Passin tpassin@idsonline.com
Thu, 15 Jul 1999 08:26:28 -0400


-----Original Message-----
From: xml-sig-admin@python.org <xml-sig-admin@python.org>
To: xml-sig@python.org <xml-sig@python.org>
Date: Wednesday, July 14, 1999 3:11 AM
Subject: XML-SIG digest, Vol 1 #331 - 3 msgs


>
>Send XML-SIG mailing list submissions to
> xml-sig@python.org
>
>To subscribe or unsubscribe via the web, visit
> http://www.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. XML-DOM slow? (Mordy Ovits)
>  2. "&"  and "<" within a string (wask@mcc.com)
>  3. Re: "&"  and "<" within a string (Lars Marius Garshol)
>
>--__--__--
>
>Message: 1
>Date: Tue, 13 Jul 1999 12:23:56 -0400
>From: Mordy Ovits <movits@lockstar.com>
>Organization: LockStar
>To: xml-sig@python.org
>Subject: [XML-SIG] XML-DOM slow?
>
>I've been playing around with the XML libraries, to great effect.  I
>can't believe how useful it is.   However, it seems to be very slow. 
>The (short) program at the bottom of this email takes about 10 seconds
>to run!
>What am I doing wrong?  Am I defaulting to a slow parser?
>Thanks!
>Mordy
>-----------------------------------------
>#!/usr/bin/python
>                   
>from xml.dom.html_builder import HtmlBuilder
>import urllib
>from sys import argv
>
>s = urllib.urlopen(argv[1])
>
>htmlstr = s.read()
>
>b = HtmlBuilder()
>
>b.ignore_mismatched_end_tags = 1
>b.feed(htmlstr)  
>doc = b.document
>
>anchors = doc.getElementsByTagName('A')
>for a in anchors:
>    if a._node.attributes.has_key("HREF"):
>        href = a._node.attributes["HREF"]
>        print "Title: ", a._node.children[0].value
>        print "Link: ", href.children[0].value
>        print
>    else:
>        print "error in <A> (?)"
>        print a._node.attributes
>-------------------
>-- 
>o Mordy Ovits
>o Cryptographic Engineer
>o LockStar Inc.
>---------------------------------------------------------------------------
>#!/usr/local/bin/python 
>from sys import*;from string import*;a=argv;[s,p,q]=filter(lambda
>x:x[:1]!=
>'-',a);d='-d'in
>a;e,n=atol(p,16),atol(q,16);l=(len(q)+1)/2;o,inb=l-d,l-1+d
>while s:s=stdin.read(inb);s and map(stdout.write,map(lambda
>i,b=pow(reduce(
>lambda x,y:(x<<8L)+y,map(ord,s)),e,n):chr(b>>8*i&255),range(o-1,-1,-1)))
>
>--__--__--
>
>Message: 2
>From: wask@mcc.com
>Reply-To: <wask@mcc.com>
>To: "'XML SIG'" <xml-sig@python.org>
>Date: Tue, 13 Jul 1999 14:32:30 -0500
>charset="iso-8859-1"
>Subject: [XML-SIG] "&"  and "<" within a string
>
>saxlib is throwing exceptions when I use "&" and "<" literally within an
>attribute value of type string, as it should.
>
>For example,
>
> <tag> name= "R&D library" value="<ROOT>/lib" />
>
>The XML spec says to use "&amp;" and "&lt;" when used literally in string.
>However, if I define
>
> <tag> name= "R&amp;D library" value="&lt;ROOT>/lib" />
>
>I still get an exception (apparently, the parser accepts the ">" and "/").
>
>Am I interpreting the spec correctly? Any suggestions?
>
>Thanks,
>
>Fred
>
>
>--__--__--
>
>Message: 3
>To: "'XML SIG'" <xml-sig@python.org>
>Subject: Re: [XML-SIG] "&"  and "<" within a string
>From: Lars Marius Garshol <larsga@ifi.uio.no>
>Date: 13 Jul 1999 21:47:43 +0200
>
>
>* wask@mcc.com
>|
>| saxlib is throwing exceptions when I use "&" and "<" literally
>| within an attribute value of type string, as it should.
>
>The first thing to realize is that it's not saxlib that does this, but
>whichever parser you are using.
> 
>| However, if I define
>| 
>| <tag> name= "R&amp;D library" value="&lt;ROOT>/lib" />
>| 
>| I still get an exception (apparently, the parser accepts the ">" and
>| "/").
>| 
>| Am I interpreting the spec correctly? Any suggestions?
>
>What is the exact error message? Where in the document is it thrown?
>And what does your document really look like? (The example above seems
>to have some non-fatal typos.)
>
>Sorry to be so unhelpful, but I found this message impossible to
>decipher.
>
>--Lars M.
>
>
>
>
>End of XML-SIG Digest