Re: xml2schema

2005-09-23 Thread uche . ogbuji
""" Er, do you mean to generate a Relax NG (or possibly a DTD in fact) from some XML file?? If you do mean this then just think of that how you could generate grammar from some paragraphs of English text... Sorta non-trivial, if possible at all, isn't it? :-) """ Very well put. However, for REL

Re: xml2schema

2005-09-30 Thread uche . ogbuji
""" Er, do you mean to generate a Relax NG (or possibly a DTD in fact) from some XML file?? If you do mean this then just think of that how you could generate grammar from some paragraphs of English text... Sorta non-trivial, if possible at all, isn't it? :-) """ Very well put. However, for REL

Re: XML Tree Discovery (script, tool, __?)

2005-10-24 Thread uche . ogbuji
might want to be more specific. What sort of output do you want from this discovery? -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http://uche.

Re: XML Tree Discovery (script, tool, __?)

2005-10-26 Thread uche . ogbuji
arbitrary element I would know: 1) whether the element was in a document 2) where to find it (the chain of parents) """ This is easy to do in SAX. For some hints, see page 2 of my article: http://www.xml.com/pub/a/2004/11/24/py-xml.html -- Uche Ogbuji

Re: XML Tree Discovery (script, tool, __?)

2005-10-27 Thread uche . ogbuji
oin([n.nodeName for n in e.xml_xpath(u'ancestor::*')]) paths.add(u'/' + path) #Pretty-print output for name in elems: print name, '\n\t\t\t', '\n\t\t\t'.join(elems[name]) -- Uche Ogbuji Fourthought, Inc. http://uche.

Re: XML Tree Discovery (script, tool, __?)

2005-10-28 Thread uche . ogbuji
operworks/xml/library/x-xmptron/ It's XSLT rather than Python, but the good news is that XSLT is easy to invoke from Python using tools such as 4Suite. http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/python-xslt -- Uche Ogbuji Fourthought, Inc. http://uche.og

Re: XML Tree Discovery (script, tool, __?)

2005-10-30 Thread uche . ogbuji
(http://saxon.sourceforge.net/dtdgen.html), though as the original it has several limitations on the accuracy of the inferred DTD. " Ah. Cool. Got a link? -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://four

Re: XML DOM: XML/XHTML inside a text node

2005-11-04 Thread uche . ogbuji
cument or element object. Many short examples here: http://copia.ogbuji.net/blog/2005-09-21/Dare_s_XLI excerpt: Adding a element as a child of the element' contacts.xml_append_fragment('%s'%'206-555-0168' http://uche.ogbuji.net/tech/4suite/amara -- Uche Ogbuji

Re: Add attribute using pyxml

2005-11-04 Thread uche . ogbuji
"How do I add a new attribute to the existing xml Document tree??? " what do you mean by "using pyxml"? There are several pyxml modules. Do you mean minidom? If so that comes with stock Python as well (hint: element_node.setAttributeNS(ns, qnam

Re: Recommendation please: forming an XML toolkit

2005-11-11 Thread uche . ogbuji
u have initial impressions based on that. If you have specific outstanding questions, do ask. If not, I would just take a chance on whatever your present leaning may be. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com

Re: Writing big XML files where beginning depends on end.

2005-11-28 Thread uche . ogbuji
writer.xmlFragment method to stitch the inner subtrees to the outer shell. MarkupWriter operates in streaming mode, so you would not be holding much XML in memory at all. http://www.xml.com/pub/a/2005/04/20/py-xml.html -- Uche Ogbuji Fourthought, Inc. http:/

Re: BisonGen parser generator. Newbie question

2005-11-29 Thread uche . ogbuji
ou want to try a recent CVS version, grab the snapshot: ftp://ftp.fourthought.com/pub/cvs-snapshots/BisonGen-CVS.tar.gz (.zip also available). Also, you might want to ask BGen questions on the 4Suite mailing list, where other BGen developers hang out. http://lists.fourthought.com/pipermail/4sui

Re: Move xml.sax.saxutils.*?

2005-11-29 Thread uche . ogbuji
But as an alias, rather than a replacement for the current import. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http://uche.ogbuji.ne

Re: XMLSchema Parsing

2005-11-29 Thread uche . ogbuji
l2/Python lxml generateDS.py Good luck. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http://uche.ogbuji.net/tech/publications/ -- http://mail.pyth

Re: xpath support in python 2.4

2005-11-29 Thread uche . ogbuji
"And80": "Is [the xml.xpath module] still part of the standard library?" Alan Kennedy: "No, it's not. Not sure if it ever was. " It never was. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://four

Re: XML and namespaces

2005-11-30 Thread uche . ogbuji
=637355&group_id=6473&atid=106473 Different symptom, but also looks like a case of namespace ignorant code. Can anyone who's worked on minidom more recently let me know if I'm just blind to something? -- Uche Ogbuji Fourthought, Inc. h

Re: XML and namespaces

2005-12-02 Thread uche . ogbuji
L documents that aren't well-formed w.r.t. namespaces, I think.) """ Oh no. That only means that namespace declaration attributes are not created in the DOM data structure. However, output has to fix up namespaces in .namespaceURI properties as well as directly asserted "

Re: XML and namespaces

2005-12-02 Thread uche . ogbuji
diosyncracies. Andrew, for this reason I probably take the initiative to work up a patch for the issue. I'll do what I can to get to it tomorrow. If you help me with code review and maybe writing some tests, that would be a huge help. -- Uche Ogbuji

Re: XML and namespaces

2005-12-05 Thread uche . ogbuji
with you. It's currently a bug. It needs to be fixed. However, I have no time for this bewildering fight. If the consensus is to leave minidom the way it is, I'll just wash my hands of the matter, but I'll be sure to emphasize heavily to users that minidom is broken with res

Re: XML and namespaces

2005-12-05 Thread uche . ogbuji
ompleted their work until they also do: element.setAttributeNS(xml.dom.XMLNS_NAMESPACE, None, "DAV:") I'd love to hear how many actual minidom users would agree with you. """ Of course (FWIW) I meant element.setAttributeNS(xml.dom.XMLNS_NAMESPACE, "xmlns", &

Re: XML and namespaces

2005-12-05 Thread uche . ogbuji
wildering, not XML namespaces (well, they are confusing, but I have a good handle on all the nuances by now). Again, no skin off my back here: I write and use tools that are XML namespaces compliant. It doesn't hurt me that Minidom is not. I was hoping to help, but again I

Re: XML and namespaces

2005-12-05 Thread uche . ogbuji
ere an option to make it include namespaces? """ Getting back to the OP: PyXML's xml.dom.ext.Print does get things right, and based on discussion in this thread, the only way you can serialize correctly is to use that add-on with minidom, or to

Re: Any Python XML Data Binding Utilities Avaiable?

2005-01-01 Thread Uche Ogbuji
Sounds like generateDS is closest to what you want: http://www.rexx.com/~dkuhlman/generateDS.html If you can bind from instances only and don't need schema, see Amara Bindery: http://uche.ogbuji.net/tech/4Suite/amara/ Also consider Gnosis Utilities and ElementTree. -- Uche O

Re: XPath and XQuery in Python?

2005-01-14 Thread Uche Ogbuji
Interesting discussion. My own thoughts: http://www.oreillynet.com/pub/wlg/6224 http://www.oreillynet.com/pub/wlg/6225 Meanwhile, please don't make the mistake of bothering with XQuery. It's despicable crap. And a huge impedance mismatch with Python. --Uche -- http://mail.python.org/mailman/l

Re: Clarification on XML parsing & namespaces (xml.dom.minidom)

2005-01-27 Thread Uche Ogbuji
#x27;s a stretch to call it a bug. You problem is that you're mixing namespaced documents with the non-namespace DOM API. That means trouble and such odd quirks every time. Use getAttributeNS, createElementNS, setAttributeNS, etc. rather than getAttribute, createElement, setAttribute, etc.

Re: 4suite XSLT thread safe ?

2005-01-27 Thread Uche Ogbuji
d has its own instance, there are no state clashes. Therefore, you should be creating at least one processor object per thread. Note: the 4Suite server is a multi-threaded architecture that uses 4XSLT heavily using processor-per-thread. -- Uche OgbujiFourthought

Re: parsing WSDL

2005-01-27 Thread Uche Ogbuji
Just for completeness I wanted to mention that yes, you can use 4Suite to parse WSDL and get method signature information, but I do agree that it's better to do this at a higher level, if you can. WHy reinvent that wheel? SOAPpy has a decent WSDL class. -- Uche O

Re: forms, xslt and python

2005-02-04 Thread Uche Ogbuji
to do this? -- Uche OgbujiFourthought, Inc. http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com Use CSS to display XML - http://www.ibm.com/developerworks/edu/x-dw-x-xmlcss-i.html Introducing the Amara XML Toolkit - http://www.xml.com/pub/a/

Re: formatted xml output from ElementTree inconsistency

2005-06-26 Thread uche . ogbuji
Patrick Maupin wrote: """ Dennis Bieber wrote: > Off hand, I'd consider the non-binary nature to be because the > internet protocols are mostly designed for text, not binary. A document at http://www.w3.org/TR/REC-xml/ lists "the design goals for XML". One of the listed goals is "XML documents sh

Re: Differences between RDFlib - 4RDF and Redfoot - 4Suite?

2005-07-15 Thread uche . ogbuji
"I was wondering about the differences with the referred libs and servers. Since the documentation isn't so thorough(and a bit because of my laziness), I thought I'd make request for usage accounts etc. stating the pros and cons of the aforementioned. Any notes would be appreciated." RDFLib is a t

Re: Suggestions for Python XML library which can search and insert

2005-07-29 Thread uche . ogbuji
"I'm looking for a library that can search through an XML document tree, locate an element by attribute (ideally this can be done through XPath), and insert an element (as its child). Simple? Yes? ...but the code I've seen so far which does this uses 'nested for loops' for trees which are relative

Re: xml-object mapping

2005-07-29 Thread uche . ogbuji
"I am looking for an xml-object mapping tool ('XML Data Binding-design time product') where I can define the mapping rules in 'binding files' and the parser is generated automatically. Similar to the solution of Dave Kuhlman (http://www.rexx.com/~dkuhlman/ generateDS.html) where the mapping is def

Re: [XML-SIG] xml-object mapping

2005-07-30 Thread Uche Ogbuji
or existing object models")) Answered: http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/a63d0ad3fd23cb37/6ad0223c5b8f9946?lnk=st&q=python+xml&rnum=3&hl=en -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net

Re: PyXML and xml.dom

2005-08-17 Thread uche . ogbuji
> Is PyXML now part of the Python distribution, or is it still an add-on? Parts of PyXML have been migrated into Python core since Python 2.0, but there is still also a standalone PyXML package.,. See: http://www.xml.com/pub/a/2002/09/25/py.html -- Uche http://copia.ogbuji.net -- http://mail

Re: Limited XML tidy

2005-08-25 Thread uche . ogbuji
> The problem is that when the sax handler raises an exception, I can't see how to find out why. What I want to do is for DodgyErrorHandler to do something different depending on where we are in the course of parsing. Is there anyway to get that information back from xml.sax (or indeed from any oth

Re: What XML lib to use?

2005-09-13 Thread uche . ogbuji
""" I'm confused, I want to read/write XML files but I don't really understand what library to use. I've used DOM-based libraries in other languages, is PyXML the library to use? """ There are many options (some say too many): http://www.xml.com/pub/a/2004/10/13/py-xml.html Try out Amara Binder

Re: best XSLT processor?

2005-02-28 Thread uche . ogbuji
Who says 4Suite is buggy? Do they have any evidence to back that up? We have a huge test suite, and though 4Suite is by no means the fastest option, it's quite reliable for XSLT. The XSLT processor in PyXML is just a very old version of 4XSLT. --Uche -- http://mail.python.org/mailman/listinfo/

Re: best XSLT processor?

2005-02-28 Thread uche . ogbuji
Xalan is certainly faster, but it is almost certainly not more compliant than 4Suite. Xalan actually has a bit of a reputation among XSLT processors in its carelessness with compliance. But I suppoose in order to settle these counter-claims, one of us will have to come up with specific compliance

Re: best XSLT processor?

2005-02-28 Thread uche . ogbuji
This is a good way to kick off a tussle among interested parties, but hinestly, at this point, most packages work fine. In my opinion your rade-off right now is raw speed (e.g. libxslt) versus flexibility (e.g. 4Suite). All are bug-free enough that you'd have to be doing somethign *very* exotic t

Re: best XSLT processor?

2005-02-28 Thread uche . ogbuji
Actually, most of the compliant problems I can remember off-head with respect to Xalan have been regarding EXSLT 1.0, not base XSLT 1.0. Sorry for any misconstruction. --Uche -- http://mail.python.org/mailman/listinfo/python-list

Re: get textual content of a Xml element using 4DOM

2005-03-04 Thread uche . ogbuji
I suggest using minidom or pxdom [1] rather than 4DOM. If you insist on using 4DOM, xml.dom.ext.Print(node) or xml.dom.ext.PrettyPrint(node) does what you want. --Uche -- http://mail.python.org/mailman/listinfo/python-list

Re: get textual content of a Xml element using 4DOM

2005-03-04 Thread uche . ogbuji
I suggest using minidom or pxdom [1] rather than 4DOM. If you insist on using 4DOM, xml.dom.ext.Print(node) or xml.dom.ext.PrettyPrint(node) does what you want. [1] http://www.doxdesk.com/software/py/pxdom.html --Uche -- http://mail.python.org/mailman/listinfo/python-list

Re: best XSLT processor?

2005-03-04 Thread uche . ogbuji
Steve Holden: "I don't know what news reader you are using, but I wonder if I could ask you to retain just a little more context in your posts. If they were personal emails I would probably be able to follow the thread, but in a newsgroup it's always helpful when I see a comment such as your above

Re: xml.sax in Python 2.3.4

2004-12-04 Thread Uche Ogbuji
ld more examples hurt). See also my Akara page on Python/SAX http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/sax I have a lot on SAX in recent installments of my column: http://www.xml.com/pub/au/84 -- Uche OgbujiFourthought, Inc. http://uche.ogbuji.net

Re: Parse XML using Python

2004-12-10 Thread Uche Ogbuji
est/spam.xml') docfrag is now ready for processing using DOM methods. -- Uche OgbujiFourthought, Inc. http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com Use CSS to display XML - http://www.ibm.com/developerworks/edu/x-dw-x-xmlc

Re: editing XML via DOM

2004-12-24 Thread Uche Ogbuji
g like this available or can somebody give me some > example lines that creates and saves some XML data? Start with: http://www.xml.com/pub/a/2002/11/13/py-xml.html then see: http://www.xml.com/pub/a/2003/10/15/py-xml.html Overall, there is a lot on DOM throughout the series: http:

Re: SAX: Help on processing qualified attribute values

2005-03-22 Thread Uche Ogbuji
0989.html I also provide a useful mix-in class for this purpose in Amara's saxtools: http://www.xml.com/pub/a/2005/01/19/amara.html http://cvs.4suite.org/viewcvs/Amara/lib/saxtools.py?rev=1.9&view=markup In the latter link see class namespace_mixin, which you should be able

Re: SAX parsing problem

2005-03-22 Thread Uche Ogbuji
l/xml-sig/2005-March/011013.html -- Uche OgbujiFourthought, Inc. http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html Introducing the Amara XML Toolki

Re: Simple XML-to-Python conversion

2005-03-22 Thread Uche Ogbuji
ara discussion as well). I follow that list far more diligently than c.l.py. -- Uche OgbujiFourthought, Inc. http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xm

Re: Simple XML-to-Python conversion

2005-03-22 Thread Uche Ogbuji
gt; compiled, but I'll try it anyway. Actually, as I mentioned in my last message, we do have some success reports re: 4Suite + py2exe. See the March archives of the 4Suite list. I think it took some work from those of the 4Suite developers who are Windows-savvy, it did

Re: how to use structured markup tools

2005-03-22 Thread Uche Ogbuji
])) Same output, of course. I even tested it for you in Amara 0.9.4. And what the heck, while I was there, I added it to the demos. You can make things even more obfuscated^H^H^H^H^H^H^H^H^H^Hterse using further lambda or list comp tricks, but I leave that as an exercise for the perverse

Re: python modules in home dir

2005-04-16 Thread Uche Ogbuji
. > I cannot install pyvm (portable binary python machine) - have no such big > quota. > Any idea how can I solve it? To install 4Suite in the home dir, use an incantation such as: ./setup.py config --prefix=$HOME/lib ./setup.py install Note: I expect you also installed Python i

Re: python modules in home dir

2005-04-23 Thread Uche Ogbuji
On Sat, 2005-04-16 at 08:12 -0600, Uche Ogbuji wrote: > On Sat, 2005-04-09 at 14:09 -0700, dzieciou wrote: > > > I'm new-comer in Python. > > I want to install few Python modules (4Suite, RDFLib, Twisted and Racoon) > > in my home directory, since Python installatio

Re: XML file parsing with SAX

2005-04-23 Thread Uche Ogbuji
s"; true: Include all external general (text) entities. false: Do not include external general entities. access: (parsing) read-only; (not parsing) read/write """ Quote from: http://docs.python.org/lib/module-xml.sax.handler.html But you're on pre

Re: XML file parsing with SAX

2005-04-23 Thread Uche Ogbuji
cal filesystem. Problem, now that I think of it, is that I'm not sure you can specify an catalog in PySAX. You might instead have to override the method entityResolver in your handler (and be sure to ). See the example in listing 1 and and discussion here: http://www.xml.com/pub/a/

Re: Creating referenceable objects from XML

2005-12-11 Thread uche . ogbuji
one possible hybrid approach. xmltramp ( http://www.aaronsw.com/2002/xmltramp/ ) is another interesting hybrid. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http://uche.ogbuji.net/tech/publications/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Using XML w/ Python...

2005-12-11 Thread uche . ogbuji
[1] http://uche.ogbuji.net/tech/4suite/amara/ [2] http://uche.ogbuji.net/uche.ogbuji.net/tech/4suite/amara/manual-dev -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite

Re: Using XML w/ Python...

2005-12-11 Thread uche . ogbuji
at you guessed: >>> import amara >>> rssDigg = amara.parse("http://www.digg.com/rss/index.xml";) >>> print rssDigg.rss.channel.item.title Video: Conan O'Brien iPod Ad Parody -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net

Re: Using XML w/ Python...

2005-12-11 Thread uche . ogbuji
DId you run a WIndows installer? Next I'd check the library path for ActivePython. What is the output of python -c "import sys; print sys.path" Where you replace "python" abpve with whatever way you invoke ActivePython. -- Uche Ogbuji Fo

Re: Using XML w/ Python...

2005-12-11 Thread uche . ogbuji
#x27;__name__', '__path__', '__version__', 'bindery', 'binderytools', 'binderyxpath', 'create_document', 'dateutil_standins', 'domtools', 'os', 'parse', 'pushbind', 'pushdom', 'py

Re: Using XML w/ Python...

2005-12-12 Thread uche . ogbuji
""" >>> import amara >>> print dir(amara) ['__builtins__', '__doc__', '__file__', '__name__', '__path__', '__version__', 'binderytools', 'os', 'parse'] &q

Re: Using XML w/ Python...

2005-12-12 Thread uche . ogbuji
that you can perhaps try out any solutions we come up with? Thanks. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http://uche.ogbuji.net/tech/publ

Re: Using XML w/ Python...

2005-12-12 Thread uche . ogbuji
at right after waking up. And it shows :-) Should have been "print domtools.__file__" -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http:/

Re: Using XML w/ Python...

2005-12-12 Thread uche . ogbuji
Rick, thanks. Based on your clue I checked, and it seems those Amara packages are not being built rightly. I'll look to get those packages fixed and updated tomorrow. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthough

Re: Help designing reading/writing a xml-fileformat

2005-12-13 Thread uche . ogbuji
Jacob Kroon wrote: > I'm writing a block-diagram editor, and could use some tips about > writing/reading > diagrams to/from an xml file format. The basic layout of my code : > > class Diagram { > Blocks blocks[] > } > > class Block { > int x, y > } > > class Square(Block) { > int width,

Re: Amara (XML) problem on Solaris

2006-01-01 Thread uche . ogbuji
has no attribute 'create_document' > bash-2.03$ This came up when I was on vacation and incommunicado. What version of Amara are you using on both platforms? How did you install them? Thanks. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuj

Re: Rss/xml namespaces sgmllib, sax, minidom

2006-01-01 Thread uche . ogbuji
gt; in sax.handlers.contenthandler , is the namespace defined like domain > names on some website? Based on this question, I tend to think you might want to leave the XML processing to someone else's code. How about using Pilgrim's feedparser? http://feedparser.org/ -- Uche Ogbuji

Re: PyXML not supported, what to use next?

2006-10-06 Thread uche . ogbuji
[2] and Amara [3]. For many people these are now very easy to install. This is the case for some other third-party XML tools as well. [1] http://peak.telecommunity.com/DevCenter/EasyInstall [2] http://4suite.org/ [3] http://uche.ogbuji.net/tech/4suite/amara/ -- Uche Ogbuji

Re: File I/O

2006-10-06 Thread uche . ogbuji
ml.html Then add to that the fact that "" can legitimately appear in an XML comment, so that logic is even more brittle. The following code does this *safely* with Amara: import amara doc = amara.parse('test.xml') top = doc.xml_xpath('//Top')[0] top.xml_parent.xml_in

Re: Trying to find a elements Xpath and store it as a attribute

2006-10-06 Thread uche . ogbuji
em than you may think :-) Luckily it's a problem I've worked on. For discussion see: http://www.xml.com/pub/a/2004/11/24/py-xml.html For an updated solution see abs_path in Amara domtools. In most cases you can safely call that on an Amara bindery node. -- Uche Ogbuji

Re: WSGI - How Does It Affect Me?

2006-10-10 Thread uche . ogbuji
t; [1] and > <http://www.xml.com/lpt/a/1675> [2] And also the following article, by me, focusing on middleware: http://www.ibm.com/developerworks/library/wa-wsgi/ (cover Weblog entry: http://copia.ogbuji.net/blog/2006-08-23/_Mix_and_m ) -- Uche Ogbuji

Re: how to print newline in xml?

2006-06-04 Thread uche . ogbuji
create text nodes by using doc.createTextNode. * You can always remove text nodes (or any other kind) by using .removeChild * It's much easier to navigate if you use XPath. PyXML has an xml.xpath module you can use. Good luck. [1] http://www-128.ibm.com/developerworks/xml/

Re: 10GB XML Blows out Memory, Suggestions?

2006-06-11 Thread uche . ogbuji
only instantiating the chunks of interest one at a time. This allows for handling of huge files with a very simple programming idiom. http://uche.ogbuji.net/tech/4suite/amara/ -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthough

Re: xpath question

2006-07-02 Thread uche . ogbuji
ports regex in XPath using the EXSLT community standard's regex module [2]. It would be something like: [re:match(@class, 'fo.*'] With the re prefix set as required by the EXSLT module. [1] http://4Suite.org [2] http://www.exslt.org/regexp/ -- Uche Ogbuji

Re: beautifulsoup .vs tidy

2006-07-02 Thread uche . ogbuji
http://copia.ogbuji.net/blog/2005-07-22/Beyond_HTM Personally, I avoid Tidy. I've too often seen it crash or hang on really bad HTML. TagSoup seems to be built like a tank. I've also never seen BeautifulSoup choke, but I don't use it as much as TagSoup. -- Uche Ogbuji

Re: Amara: Where's my attribute?

2006-07-02 Thread uche . ogbuji
space declaration. So my guess is that you somehow got way off the rails in your problem-solving, and you'll need to provide mre background if you want help. BTW, I recommend upgrading to Amara 1.1.7. That branch will soon be 1.2, and I consider it more mature than 1.0 at this point.

Re: Amara: Where's my attribute?

2006-07-07 Thread uche . ogbuji
I don't get a crash on my system (Ubuntu), but I do get a legitimate error message because that DTD is broken. The W3C seems to like disseminating broken DTDs. Just yesterday I was helping someone around the infamous broken XHTML 1.1 DTDs. I do want to know why you're gettign a

Re: Need help in xml

2006-07-10 Thread uche . ogbuji
i have to compare 2 similar xml document and get the add, changed and > deleted files.and write it into acd.xml file. > can u help me with the python code for this. I am using SAX. Use the right tool and such problems tend to become much simpler. http://www.logilab.org/projects/xmldiff -- Uche Og

Re: XML parsing and writing

2006-08-28 Thread uche . ogbuji
d more such options. http://uche.ogbuji.net/tech/4suite/amara/ http://4Suite.org -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http://uche.ogbuji.ne

Re: XSLT speed comparisons

2006-09-29 Thread uche . ogbuji
print buildPage() -- % -- For what it's worth I just developed, and switched to WSGI middleware that only does the transform on the server side if the client doesn't understand XSLT. It's called applyxslt and is part of wsgi.xml [1]. That reduces server load, and with caching (via Mygh

Re: XSLT speed comparisons

2006-09-29 Thread uche . ogbuji
32com.client > > def buildPage(): [SNIP] Added to: http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/python-xslt -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net

Re: XSLT speed comparisons

2006-09-29 Thread uche . ogbuji
what's the XSLT processor in the case of Safari (only the most recent versions of Safari). But regardless, with that coverage you can write apps using XSLT, support the entire spectrum of browsers (and mobile apps, spiders, etc.) and yet rarely ever re

Re: lxml/ElementTree and .tail

2006-11-17 Thread Uche Ogbuji
In fact, I think it's clear that Infoset is not even the preeminent *data model* of the XML world. That distinction goes to the XPath data model, which is quite different from the Infoset. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net

Re: newbie: minidom

2006-11-17 Thread Uche Ogbuji
Paul Watson wrote: > Explicit [XML declaration] is better than implicit. Yes indeed. "Always use an XML declaration" http://www-128.ibm.com/developerworks/xml/library/x-tipdecl.html -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net

Re: lxml/ElementTree and .tail

2006-11-19 Thread Uche Ogbuji
Fredrik Lundh wrote: > Uche Ogbuji wrote: > > > I certainly have never liked the aspects of the ElementTree API under > > present discussion. But that's not as important as the fact that I > > think the above statement is misleading. There has always been a > &g

Re: lxml/ElementTree and .tail

2006-11-19 Thread Uche Ogbuji
ed to XML. Again, my take: http://www.ibm.com/developerworks/xml/library/x-namcar.html And yes, default namespaces are about 50% of the problem with namespace. QNames in content (which are of course an abuse of namespaces) are almost all of the other 50%. I call them "hidden namespaces":

Re: XML SAX parser bug?

2006-02-07 Thread uche . ogbuji
5881 Using this filter you can then write SAX code that assumes normalized text events. Also, 4Suite's SAX implementation, Saxlette, automatically does this text event merging for you at C speed: http://4suite.org/docs/CoreManual.xml#saxlette -- Uche Ogbuji F

Re: XML Writer in wxPython

2006-02-07 Thread uche . ogbuji
t "" Just be sure you're well aware of all the issues: http://www.xml.com/pub/a/2002/11/13/py-xml.html See also: http://www.ibm.com/developerworks/xml/library/x-think35.html -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net

Re: Large XML Document Processing

2006-02-07 Thread uche . ogbuji
tree-callback methods will give you the best speed. Fredrik already mentioned ElementTree's IterParse. Amara's pushbind and pushdom and 4Suite's Saxlette (which has some neat callback features) are other options. http://uche.ogbuji.net/tech/4suite/amara/ http://4suite.org/docs/Cor

Re: XML Writer in wxPython

2006-02-07 Thread uche . ogbuji
t "" Just be sure you're well aware of all the issues: http://www.xml.com/pub/a/2002/11/13/py-xml.html See also: http://www.ibm.com/developerworks/xml/library/x-think35.html -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net

Re: Fromatting an xml file

2006-02-07 Thread uche . ogbuji
good > solution? Thanks! That minidom behavior is fairly unsafe. 4Suite's PrettyPrinter is much safer: >>> from Ft.Xml import Parse >>> from Ft.Xml.Domlette import PrettyPrint >>> XML = "blabla" >>> doc = Parse(XML) >>> Pre

Re: only a simple xml reader value

2006-02-08 Thread uche . ogbuji
nt entity, because it has multiple elements at document level. It's also not well-formed according to XMLNS 1.0 unless you declare the "title" prefix. You will not be able to use a non XMLNS 1.0 document with most XML technologies, including XSLT

Re: only a simple xml reader value

2006-02-11 Thread uche . ogbuji
result.msg.xml() #to get the XML source for that element print doc.response.resData.appData.name print doc.response.resData.appData.name.xml() [1] http://uche.ogbuji.net/tech/4Suite/amara/ -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Articles: http://uche.ogbuji.net/tech/publications/ -- http://mail.python.org/mailman/listinfo/python-list

Re: XSLT and gettext?

2006-03-03 Thread uche . ogbuji
4Suite has some friendly gettext-based i18n extensions. See: http://copia.ogbuji.net/blog/2005-06-14/i18n_for_X -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Su

Re: Bug in Elementtree/Expat

2005-05-20 Thread uche . ogbuji
""" > Most examples in the book do not include such a declaration and yet are > properly rendered by Internet Explorer. > Is it mandatory and why is it that Expat crashes on it? It's not mandatory but it's probably good practice to make the document self-contained. The xlink prefix is defined in

Re: Newbie Python & XML

2005-06-04 Thread uche . ogbuji
1-01/general-section -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji.net http://4Suite.org Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcs

Re: Elementtree and CDATA handling

2005-06-04 Thread uche . ogbuji
TML serialiser. " Amara does provide for this, e.g.: from amara.binderytools import bind_string doc = bind_string(text) print doc.xml(method=u"html") Which automatically and transparently brings to bear the full power of the XSLT HTML output method. -- Uche Ogbuji

Re: Getting a DOM element's children by type (STUPID)

2005-06-10 Thread uche . ogbuji
In Amara[2], this task is trivial. To get all the images in an XHTML div, you'd simply do: for img in div.img: process_img(img) You access names directly as objects according to their element type name. [1] see, e.g., http://www.xml.com/pub/a/2003/01/08/py-xml.html [2] see http:

Re: ElementTree Namespace Prefixes

2005-06-17 Thread uche . ogbuji
Chris Spencer: """ Fredrik Lundh wrote: > Chris Spencer wrote: > > If an XML parser reads in and then writes out a document without having > > altered it, then the new document should be the same as the original. > says who? Good question. There is no One True Answer even within the XML standard

Re: Python version of XMLUnit?

2006-03-07 Thread uche . ogbuji
LogiLabs's app is that it can output XUpdate, which could be used with, say 4Suite's 4XUpdate to apply a patch to another document. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com http://copia.ogbuji

  1   2   >