[XML-SIG] I am confused...

Mike Olson Mike.Olson@fourthought.com
Sun, 28 Jan 2001 13:50:10 -0700


Roman Suzi wrote:
> 
> 
> >- are Python XML tools (and which of them?) up to the task of facilitating
> >site-generation with bearable speed?


http://4suite.org is completly dynamic from XML.  Infact there is one
additionaly step we go from a set of RDF statements --> XML and then
render it with XSLT.  This is running on a Celeron 400, some times it
gets a bit slow, but usally it is acceptable.

> 
> I remember I was doing queries in the form
> "/article/author/name"
> - and it was so slow... (0.5 - 1 sec per query on Celeron 400)

If you didn;t use 4Suite, then what did you use?  I think there was an
XPath implementation in PyXML but I know little about it.  I know 4XPath
performs pretty well.  Going to the site again, there are hundreds of
XPath expressions, but we still get resonable times.

> 
> In my application I need many such queries to fill
> the template - that is why speed was unbearable.

What is you template?  XSLT?  If not have you thought of using it.  It
sounds like it was designed to do exactly what you need.

> 
> Please, tell me if I did it wrong:
> 
> - parsed xml-file
> - quered each variable in a template-file from the xml-file
> - filled template with values found to produce web-page
>   (some variables go to other pages, for example, content page)

Again, it sounds like your doing a lot by hand that is not needed.  You
can do this in XSLT with a simple template like

<xsl:template match='article'>
  <HTML><HEAD><TITLE>Article By <xsl:value-of
select='author/name'/></TITLE></HEAD></HTML>
</xsl:template>

The big advantage is that all of your XPath expressions can be relative
to the current context.  In the above example, the current context is
already the article so you don't need to match on it again.


> 
> I am trying to learn XML for 2 years already but am
> still a newbie in practice.
> 
> Anyway, before claiming XML tools for Python slow I need to recheck
> with new versions - if there are no objections to the
> above scheme. (And what is preferrable tool for queries?
> XPath?)

I'd definitly upgrade to latest versions.  I'd also consider XSLT.

> 
> Is there any on-line tutorial (?) or just example code
> to learn how to work efficiently with XML from Python?
> (Python is my favorite language while Java is not)
> I read code from xml.* but it doesn't give me clues
> for real usage.

Were working on them.  There are some demos that come with the code, but
no real beginners tutorial.

Hope this helps,

Mike

> 
> Sincerely yours, Roman Suzi
> --
> Vote for my design: http://silvermouse.onego.ru/gray.php3?id=0018
> _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd@onego.ru _/
> _/ Sunday, January 28, 2001 _/ Powered by Linux RedHat 6.2 _/
> _/ "Patience is a virtue, it's just not one of my better virtues" _/
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://mail.python.org/mailman/listinfo/xml-sig

-- 
Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python