[Tutor] XML Parser

Praveen Pathiyil ppathiyi@cisco.com
Wed, 8 Aug 2001 11:20:03 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_03C5_01C11FFC.11E255F0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi All,

        I am trying out some basic stuff on XML with Python. But I am =
unable to get a parser instance on my system ( I have cut and pasted =
some code which i tried out for this.). Also the "drivers" modules under =
xml.sax and "pyexpat" is not installed. (Since i am working on the =
server of my company, I can't install these packages myself).
        How do I proceed to get a parser instance ?


Thanks in Advance,
Praveen.

*******************************************
Python 2.1 (#2, Jun 20 2001, 11:49:49)=20
[GCC 2.9-cisco-98r1] on sunos5
Type "copyright", "credits" or "license" for more information.
>>>=20
>>> from xml.sax import xmlreader
>>>=20
>>> parser =3D xmlreader.XMLReader()
>>>=20
>>> parser.parse("comic_books")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File =
"/sw/packages/python/2.1/sparc-sun-solaris2.5.1/lib/python2.1/xml/sax/xml=
reader.py", line 32, in parse
    raise NotImplementedError("This method must be implemented!")
NotImplementedError: This method must be implemented!

*******************************************

>>> from xml.sax.saxutils import xmlreader=20
>>>=20
>>> parser =3D xmlreader.XMLReader()
>>>=20
>>> parser.parse("comic_books")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File =
"/sw/packages/python/2.1/sparc-sun-solaris2.5.1/lib/python2.1/xml/sax/xml=
reader.py", line 32, in parse
    raise NotImplementedError("This method must be implemented!")
NotImplementedError: This method must be implemented!

*******************************************

------=_NextPart_000_03C5_01C11FFC.11E255F0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3103.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>Hi All,</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; I am trying out some basic =
stuff on=20
XML with Python. But I am unable to get a parser instance on my system ( =
I have=20
cut and pasted some code which i tried out for this.). Also the =
"drivers"=20
modules under xml.sax and "pyexpat" is not installed. (Since i am =
working on the=20
server of my company,&nbsp;I can't install these packages myself).</DIV>
<DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; How do&nbsp;I proceed to get =
a parser=20
instance ?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks in Advance,</DIV>
<DIV>Praveen.</DIV>
<DIV>&nbsp;</DIV>
<DIV>*******************************************</DIV>
<DIV>Python 2.1 (#2, Jun 20 2001, 11:49:49) <BR>[GCC 2.9-cisco-98r1] on=20
sunos5<BR>Type "copyright", "credits" or "license" for more=20
information.<BR>&gt;&gt;&gt; <BR>&gt;&gt;&gt; from xml.sax import=20
xmlreader<BR>&gt;&gt;&gt; <BR>&gt;&gt;&gt; parser =3D=20
xmlreader.XMLReader()<BR>&gt;&gt;&gt; <BR>&gt;&gt;&gt;=20
parser.parse("comic_books")<BR>Traceback (most recent call =
last):<BR>&nbsp; File=20
"&lt;stdin&gt;", line 1, in ?<BR>&nbsp; File=20
"/sw/packages/python/2.1/sparc-sun-solaris2.5.1/lib/python2.1/xml/sax/xml=
reader.py",=20
line 32, in parse<BR>&nbsp;&nbsp;&nbsp; raise NotImplementedError("This =
method=20
must be implemented!")<BR>NotImplementedError: This method must be=20
implemented!<BR></DIV>
<DIV>*******************************************</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; from xml.sax.saxutils import xmlreader =
<BR>&gt;&gt;&gt;=20
<BR>&gt;&gt;&gt; parser =3D xmlreader.XMLReader()<BR>&gt;&gt;&gt; =
<BR>&gt;&gt;&gt;=20
parser.parse("comic_books")<BR>Traceback (most recent call =
last):<BR>&nbsp; File=20
"&lt;stdin&gt;", line 1, in ?<BR>&nbsp; File=20
"/sw/packages/python/2.1/sparc-sun-solaris2.5.1/lib/python2.1/xml/sax/xml=
reader.py",=20
line 32, in parse<BR>&nbsp;&nbsp;&nbsp; raise NotImplementedError("This =
method=20
must be implemented!")<BR>NotImplementedError: This method must be=20
implemented!<BR></DIV>
<DIV>*******************************************</DIV></BODY></HTML>

------=_NextPart_000_03C5_01C11FFC.11E255F0--