Re: xml SAX Parsing in python

2014-12-17 Thread Ian Kelly
On Tue, Dec 16, 2014 at 11:30 PM, Abubakar Roko wrote: > > Good day, > > Please I am new in using python to write program. I am trying to parse an XML document using sax parse and store the parsed result in a tree like defined > below. XNode class define an xml element which has an ID , a tag, a

Re: xml SAX Parsing in python

2014-12-17 Thread Stefan Behnel
Hi, Abubakar Roko schrieb am 17.12.2014 um 07:30: > Please I am new in using python to write program. I am trying to parse an XML > document using sax parse and store the parsed result in a tree like > definedbelow. XNode class define an xml element which has an ID , a tag, a > text value, chi

xml SAX Parsing in python

2014-12-16 Thread Abubakar Roko
Good day, Please I am new in using python to write program. I am trying to parse an XML document using sax parse  and store the parsed result in a tree like definedbelow. XNode class define an xml element which has an ID , a tag, a text value, children element and a parent element              

Re: Parsing XML: SAX, DOM, Expat, or Something Else?

2009-01-23 Thread Stefan Behnel
Chris Rebert wrote: > On Fri, Jan 23, 2009 at 11:19 AM, aha wrote: >> I've been charged with developing an XML configuration file format, >> for one of the applications that my company develops. >> [...] >> I am still trying to determine the >> best XML parser API to use. I would love to use XPAT

Re: Parsing XML: SAX, DOM, Expat, or Something Else?

2009-01-23 Thread Chris Rebert
On Fri, Jan 23, 2009 at 11:19 AM, aha wrote: > Hello All, > I've been charged with developing an XML configuration file format, > for one of the applications that my company develops. (Yes, I know it > would have been easier to just use the configuration file format as > described in RFC 822) W

Parsing XML: SAX, DOM, Expat, or Something Else?

2009-01-23 Thread aha
Hello All, I've been charged with developing an XML configuration file format, for one of the applications that my company develops. (Yes, I know it would have been easier to just use the configuration file format as described in RFC 822) While I am finally comfortable with the XML description

Re: xml sax

2008-03-19 Thread Timothy Wu
Oh right, why didn't I think of that. =) Many thanks. Timothy On Thu, Mar 20, 2008 at 1:45 AM, Robert Bossy <[EMAIL PROTECTED]> wrote: > Timothy Wu wrote: > > Hi, > > > > I am using xml.sax.handler.ContentHandler to parse some simple xml. > > > > I want to detect be able to parse the content

Re: xml sax

2008-03-19 Thread Robert Bossy
Timothy Wu wrote: > Hi, > > I am using xml.sax.handler.ContentHandler to parse some simple xml. > > I want to detect be able to parse the content of this tag embedded in > the XML. > 174 > > > Is the proper way of doing so involving finding the "Id" tag > from startElement(), setting flag when s

xml sax

2008-03-19 Thread Timothy Wu
Hi, I am using xml.sax.handler.ContentHandler to parse some simple xml. I want to detect be able to parse the content of this tag embedded in the XML. 174 Is the proper way of doing so involving finding the "Id" tag from startElement(), setting flag when seeing one, and in characters(), when s

XML-SAX parser problem

2008-03-11 Thread hitesh thakkar
Hello, Can any one help for error in following code. actually i want to map parent element with child element, but i am unable to do so. here is the code which i am trying for please do reply if iam not on right track. import xml.sax.handler class BookHandler(xml.sax.handler.ContentHandler):

Re: XML: SAX and XInclude

2007-09-11 Thread Laurent Pointal
Stefan Behnel a écrit : > Laurent Pointal wrote: >> does anybody know about an XML parser usable with the sax API (xml.sax) >> and with XInclude feature support (directly or via hacks). > > Try lxml.etree. > > http://codespeak.net/lxml/ > > http://codespeak.net/lxml/tutorial.html > http://codesp

Re: XML: SAX and XInclude

2007-09-10 Thread Stefan Behnel
Laurent Pointal wrote: > does anybody know about an XML parser usable with the sax API (xml.sax) > and with XInclude feature support (directly or via hacks). Try lxml.etree. http://codespeak.net/lxml/ http://codespeak.net/lxml/tutorial.html http://codespeak.net/lxml/api.html#xinclude-and-element

XML: SAX and XInclude

2007-09-10 Thread Laurent Pointal
[python 2.5, Linux Mandriva 2007.1] Hello, does anybody know about an XML parser usable with the sax API (xml.sax) and with XInclude feature support (directly or via hacks). With specifying nothing (default parser), it simply transmit xinclude elements (i tried to call parser on included file

Re: Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-07 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Is there a Pythonic way to read the file and identify any illegal XML > characters so I can strip them out? this would keep my program more > flexible - if the vendor is going to allow one illegal character in > their document, there's no way of knowing if another one w

Re: Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-07 Thread scott
Thanks, I'll work with the file on the file system, then parse it with SAX. Is there a Pythonic way to read the file and identify any illegal XML characters so I can strip them out? this would keep my program more flexible - if the vendor is going to allow one illegal character in their document,

Re: Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-06 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > My original posting has a funky line break character (it appears as an > ascii square) that blows up my program, but it may or may not show up > when you view my message. Looking at your document, it seems that this "funky line break character" is character \x1E, which

Re: Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-05 Thread scott
My original posting has a funky line break character (it appears as an ascii square) that blows up my program, but it may or may not show up when you view my message. I was afraid to use element tree, since my xml files can be very long, and I was concerned about using memory structures to hold al

Re: Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-05 Thread Chris Lambacher
What exactly is invalid about the XML fragment you provided? It seems to parse correctly with ElementTree: >>> from xml.etree import ElementTree as ET >>> e = ET.fromstring(""" ... ... ... Tampa ... A great city ^^ and place to live ... ... ... Clearwater ... Beautiful be

Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-05 Thread scott
I've got an XML feed from a vendor that is not well-formed, and having them change it is not an option. I'm trying to figure out how to create an error-handler that will ignore the invalid token and continue on. The file is large, so I'd prefer not to put it all in memory or save it off and strip

Re: XML SAX parser bug?

2006-02-07 Thread uche . ogbuji
[EMAIL PROTECTED] wrote: > Fredrik Lundh schreef: > > [EMAIL PROTECTED] wrote: > > > I think I ran into a bug in the XML SAX parser. > > > > > > part of my program consist of reading a rather large XML file (about > > > 10Mb) containing a few thousand

Re: Help with XML-SAX program ... it's driving me nuts ...

2006-01-31 Thread mitsura
Thanks for the feedback! I will certainly look at the elementtree stuff (I am new to Python so I still need to find my way around) -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with XML-SAX program ... it's driving me nuts ...

2006-01-31 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I need to read a simle XML file. For this I use the SAX parser. So far > so good. The XML file consist out of number of "Service" object with > each object a set of attributes. > The strange thing is that for some reason, the attributes for all the > objects are being u

Help with XML-SAX program ... it's driving me nuts ...

2006-01-31 Thread mitsura
Hi, I need to read a simle XML file. For this I use the SAX parser. So far so good. The XML file consist out of number of "Service" object with each object a set of attributes. I read through the XML file and for each "" entry I create a new service object. When I am in the "" part of the XML fil

Re: XML SAX parser bug?

2006-01-19 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > but how do I detect that the parser has split up the characters? I gues > I need to detect it in order to reconstruct the complete string Don't try to detect it. Instead, assume it always happens, and collect the strings in characters(), rather than processing them. Do s

Re: XML SAX parser bug?

2006-01-19 Thread mitsura
Fredrik Lundh schreef: > [EMAIL PROTECTED] wrote: > > > I think I ran into a bug in the XML SAX parser. > > > > part of my program consist of reading a rather large XML file (about > > 10Mb) containing a few thousand elements. > > I have the following problem

Re: XML SAX parser bug?

2006-01-19 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I think I ran into a bug in the XML SAX parser. > > part of my program consist of reading a rather large XML file (about > 10Mb) containing a few thousand elements. > I have the following problem. Sometimes that SAX parses misreads a > line. > Le

XML SAX parser bug?

2006-01-19 Thread mitsura
Hi, I think I ran into a bug in the XML SAX parser. part of my program consist of reading a rather large XML file (about 10Mb) containing a few thousand elements. I have the following problem. Sometimes that SAX parses misreads a line. Let me explain: the XML file contains a few thousand lines