473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

new to python, looking for streams clues

Hello peoples,

As I said, I'm new to python, and particularly to XML generation in
python.
Using the 4suite XML package, I have been able to produce XML, but
only directly to STDOUT.

Refering to the 4suite markupWriter refrence, the class needs a stream
to output the generated XML, and if none is specified, it's the STDOUT
stream that is used.

What I would like, would be to store the generated XML into a python
object which implement the stream interface to be able to transform it
via XSLT if needed (it's in a web based project).

But, I've read the python doc for the last 12 hours without finding
anything about an existing object that implements that interface.
Am I missing something, or should I really create that object myself ?

I mean, I just need something that I can write into and read
thereafter.
It should already exists, no ?
Jun 27 '08 #1
3 804
Thierry wrote:
Hello peoples,

As I said, I'm new to python, and particularly to XML generation in
python.
Using the 4suite XML package, I have been able to produce XML, but
only directly to STDOUT.

Refering to the 4suite markupWriter refrence, the class needs a stream
to output the generated XML, and if none is specified, it's the STDOUT
stream that is used.

What I would like, would be to store the generated XML into a python
object which implement the stream interface to be able to transform it
via XSLT if needed (it's in a web based project).

But, I've read the python doc for the last 12 hours without finding
anything about an existing object that implements that interface.
Am I missing something, or should I really create that object myself ?

I mean, I just need something that I can write into and read
thereafter.
It should already exists, no ?
See the modules StringIO and cStringIO - which are mentioned on

http://docs.python.org/lib/lib.html

with the words:

4.5 StringIO -- Read and write strings as files

HTH,

Diez
Jun 27 '08 #2
Thierry a écrit :
Hello peoples,

As I said, I'm new to python, and particularly to XML generation in
python.
Using the 4suite XML package, I have been able to produce XML, but
only directly to STDOUT.

Refering to the 4suite markupWriter refrence, the class needs a stream
to output the generated XML, and if none is specified, it's the STDOUT
stream that is used.

What I would like, would be to store the generated XML into a python
object which implement the stream interface to be able to transform it
via XSLT if needed (it's in a web based project).

But, I've read the python doc for the last 12 hours without finding
anything about an existing object that implements that interface.
Am I missing something, or should I really create that object myself ?

I mean, I just need something that I can write into and read
thereafter.
It should already exists, no ?
It does, it's named StringIO (or cStringIO for the faster C
implementation), and it's part of the standard lib. AFAICT, it should
fit your needs.
Jun 27 '08 #3
On Jun 4, 1:50*pm, Bruno Desthuilliers <bruno.
42.desthuilli...@websiteburo.invalidwrote:
Thierry a écrit :
Hello peoples,
As I said, I'm new to python, and particularly to XML generation in
python.
Using the 4suite XML package, I have been able to produce XML, but
only directly to STDOUT.
Refering to the 4suite markupWriter refrence, the class needs a stream
to output the generated XML, and if none is specified, it's the STDOUT
stream that is used.
What I would like, would be to store the generated XML into a python
object which implement the stream interface to be able to transform it
via XSLT if needed (it's in a web based project).
But, I've read the python doc for the last 12 hours without finding
anything about an existing object that implements that interface.
Am I missing something, or should I really create that object myself ?
I mean, I just need something that I can write into and read
thereafter.
It should already exists, no ?

It does, it's named StringIO (or cStringIO for the faster C
implementation), and it's part of the standard lib. AFAICT, it should
fit your needs.
Thanks everyone.

I had seen it, but understood that you had to give it an already
existing string to operate on that one.
I feel a bit stupid. Time to get back to those lost sleep hours, I
presume.

But again, thanks everyone.
Jun 27 '08 #4

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

Similar topics

4
by: Carl | last post by:
Hi, I have this little code snippet that I use for recording audio streams. My problem is that I want to schedule my recordings with crontab. This does not work, however. I cannot figure out...
5
by: Cappy2112 | last post by:
I've just started a job which has a massive python2.3.4-centric tools installation and configuration. I know what you're going to say, but I can't upgrade and be the only one with a newer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.