473,732 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python or Perl for XML/XSL?

I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?

Feb 10 '06 #1
5 2427
James Owens wrote:
At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?


Look at your environment. What's already there ?
A Microsoft Windows environment has implications.
A Unix environment allows for cost effective options.

Why XSLT ? This has implications for CGI services.
How large are your files and how important is response time ?
Feb 10 '06 #2
James Owens wrote:
At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?


Of those two, Python. It's a lot cleaner and (I hate to say it)
"fashionabl e".

If you're building bigger tools, then Java. If you're looking for web
back ends, then Ruby is worth a look too.

It's still hard to say "You shouldn't learn Perl" though. There's just
too much of it already in existence and you will keep meeting it.

Feb 10 '06 #3
James Owens wrote:
I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?


Python is my preference over Perl. Its a pleasure to work with.
Where xslt seems under-powered or awkward, I normally work with Python,
which provides a comforfable front-end to several xml parsers. It also
has built-in unicode support.

However, it was when I first got 'Cocoon' working that the whole
xml thing suddenly made sense to me. It is my choice when the
main task can be achieved with xslt or a sequence of xslt
transformations . It is much less fiddly and robust than a typical cgi
script, unless you want to put a lot of time and effort into testing it.

Cocoon requires NO programming language at all. You can get a very long
way using just xslt, with data-base access using ESQL which is also
xml-based. You get a complete Web-publishing framework, which sound like
what you want for a technical library. PDF, Postscript, and (X)HTML from
the one source, which might be DOCBOOK or TEI, among others.

Beyond the basics, in Cocoon, you may need to learn Java. That's the stage
I've got to, but I have yet to make the serious plunge.

On-line, the coml.lang.pytho n newsgroup is very friendly to
beginners, by the way.
Unlike Cocoon, where your first steps are likely to be, shall we say,
'character building'.
Feb 10 '06 #4
James Owens wrote:
I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?


Python. Or Tcl. Or even PHP. Perl is just modem noise :-)

///Peter, ducking

Feb 10 '06 #5
James Owens wrote:
I anticipate working with XML and XSL a lot over the next few years (I'm
in technical documentation). I also happen to be looking for a new
scripting language for some CGI interfaces I'll be setting up on our
in-house library. Currently I use REXX for my scripting needs, but I
understand that Python and Perl are popular for XML work, and I know that
Perl is popular for CGI.

At the risk of starting some kind of religious war, which one should I
learn? Is there another choice I should know about?


Well here's my plug for Python, using the Amara XML Toolkit for Python
[1].

XML = """<?xml version="1.0" encoding="utf-8"?>
<monty>
<python spam="eggs">
What do you mean "bleh"
</python>
<python ministry="abuse ">
But I was looking for argument
</python>
</monty>"""

import amara
doc = amara.parse('mo nty.xml')
print doc.monty.pytho n.spam #prints "eggs"
print doc.monty.pytho n[1] #prints "But I was looking for argument"
doc.monty.pytho n.spam = u"changed" #changes the attribute value
print doc.xml_xpath(u "//python[@spam='changed']") #use XPath query
print doc.monty.xml() #re-serialize to XML

[1] http://uche.ogbuji.net/tech/4Suite/amara/

HTH

--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/

Feb 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2144
by: Roy Smith | last post by:
I'm working on a prototype of a new application in Python. At some point, if this ever turns into a product, the powers that be will almost certainly demand that it be done in Perl. My job will be to convince them otherwise. The basic design of the application is object oriented. I've never used Perl's OO features, so I'm not in a good position to make a comparison of the two languages from an OO point of view. Can somebody who's...
42
4101
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time. I'm not interested on which language is better in *general*, just for my purpose. My area of research is in CAD algorithms, and I'm sensing the need to resort to something more expedient than C++, bash scripting, or sed scripting.
46
3291
by: Reinhold Birkenfeld | last post by:
Hello, another Perl/Python question: the subject says it all. Perl is going to change dramatically to become a more powerful and easier to (read|write) language. Is Python taking a similar step (-> Python 3) some time in the near future? Reinhold
31
4800
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is great for pattern matching, text processing, and automated testing. Our company is really fixated on risk managnemt and the only way I can do enough testing without working overtime (which some people have ended up doing) is by automating my...
68
5876
by: Lad | last post by:
Is anyone capable of providing Python advantages over PHP if there are any? Cheers, L.
9
4519
by: Dieter Vanderelst | last post by:
Dear all, I'm currently comparing Python versus Perl to use in a project that involved a lot of text processing. I'm trying to determine what the most efficient language would be for our purposes. I have to admit that, although I'm very familiar with Python, I'm complete Perl noob (and I hope to stay one) which is reflected in my questions. I know that the web offers a lot of resources on Python/Perl differences. But I couldn't find a...
13
2099
by: squash | last post by:
I am a little annoyed at why such a simple program in Perl is causing so much difficulty for python, i.e: $a += 200000 * 140000; print $a;
12
2358
by: rurpy | last post by:
Is there an effcient way (more so than cgi) of using Python with Microsoft IIS? Something equivalent to Perl-ISAPI?
21
1932
by: Roy Smith | last post by:
I'm working on a product which for a long time has had a Perl binding for our remote access API. A while ago, I wrote a Python binding on my own, chatted it up a bit internally, and recently had a (large) customer enquire about getting access to it. I asked for permission to distribute the Python binding, and after a few weeks of winding its way through the corporate bureaucracy I got an email from a product manager who wants to meet...
8
2434
by: Palindrom | last post by:
Hi everyone ! I'd like to apologize in advance for my bad english, it's not my mother tongue... My girlfriend (who is a newbie in Python, but knows Perl quite well) asked me this morning why the following code snippets didn't give the same result : ### Python ###
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9234
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.