Re: tuples within tuples

2007-10-27 Thread korovev76
On 26 Ott, 23:33, Stargaming [EMAIL PROTECTED] wrote:
  He certainly is -- *you* are misreading *him*. The nit he's picking
is
 the non-terminated string (quotation mark/apostrophe missing).

right, now i got it!

beside this, i'm trying to use the reduceXML function proposed by
Larry.. but I found out that sometimes pyrxp parses the newline too...
By now I guess it's not its fault, but it's becuase of the way the xml
file is written




-- 
http://mail.python.org/mailman/listinfo/python-list


tuples within tuples

2007-10-26 Thread korovev76
Hello everybody.

I'm wondering how to iterate over a tuple like this
[A,B,C,D]
while saving A and C in a list.

My problem is that C sometimes is a tuple of the same structure
itself...


thanks!
korovev

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tuples within tuples

2007-10-26 Thread korovev76

[cut]

 Without a better example or explanation of what you are trying to do it is
 difficult

You're right.
Actually i'm parsing an xml file using pyrxp, which returns something
like this:
(tagName, attributes, list_of_children, spare)
Where list_of_children might be a list with elements that are 4-
tuples or plain strings.

In other terms, if I have something like this:
('tagAtagBbobloblaw/tagB/tagA')
it's parsed like this:
('tagA', None, [('tagB', None, ['bobloblaw], None)], None)...

Fact is that my xml is much more deep... and I'm not sure how to
resolve it


thanx






-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tuples within tuples

2007-10-26 Thread korovev76

 Resolve *what*?  The problem isn't clear yet; at least to me.  Above you
 say what you get.  What exactly do you want?  Examples please.



Sorry for my poor english, but I meant: how can I obtain a list of A
and C starting from something like this?

(A,B,C,D)
that could be
('tagA', None, [('tagB', None, ['bobloblaw], None)], None)
but also
('tagA', None, description, None)
when I don't know if C is a tuple or not?

I guess that, at least,  within the cicle I may test if C is a tuple
or not.. And then apply the same cicle for C... and so on

Am i right?


ciao
korovev






ciao
korovev

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tuples within tuples

2007-10-26 Thread korovev76
On 26 Ott, 19:23, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
   (A,B,C,D)
  that could be
  ('tagA', None, [('tagB', None, ['bobloblaw], None)], None)

 C isn't a tuple in your example either. It is a one-element list
 (the single element INSIDE the list is a tuple whose third element is a
 list containing a non-terminated string -- so the entire structure is
 invalid)


i'm not sure what u mean with the entire structure is invalid...
that's exactly what I got while parsing...


-- 
http://mail.python.org/mailman/listinfo/python-list


Root element name not declared

2007-10-23 Thread korovev76
Hi guys, i'm using pyrxp to parse some xml like this one:

?xml version=1.0?
!DOCTYPE MyMessage SYSTEM mymessage.dtd
MyMessage release=2.0
Fromabc/From
Todef/To
.

where the dtd is defined like this:

!ENTITY % UsingLocalNames IGNORE 
![%UsingLocalNames;[
!ENTITY % MyMessage  
!ENTITY % FieldA  
!ENTITY % FieldB  
,


While parsing, I receive an error like this one: Root element name
MyMessage not declared
Being both the file and the dtd provided by the supplier, I believe
they're correct so I don't understand what's wrong. MyMessage IS
declared... isn't it sufficient?

Thanx
korovev

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ONYX

2007-09-20 Thread korovev76
On 19 Set, 21:02, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:


 I don't know what's onyx-style xml,

i'm not used to xml, so for me onyx is just a mess...
http://www.onyx.com/Products/xml.asp

 but if it's xml, any xml parser
 will parse it, and any validating parser should be able to validate it
 given the correct DTD.

For example?where do I find a good validating parser?


thanx again


-- 
http://mail.python.org/mailman/listinfo/python-list


I MEANT ONIX.... [it was Re: ONYX]

2007-09-20 Thread korovev76

i'm such a lame... i meant onix... not onyx...
http://xml.coverpages.org/onix.html

the questions remain the same ones...

thanx


On 20 Set, 12:01, [EMAIL PROTECTED] wrote:
 On 19 Set, 21:02, Bruno Desthuilliers

 [EMAIL PROTECTED] wrote:

  I don't know what's onyx-style xml,

 i'm not used to xml, so for meonyxis just a 
 mess...http://www.onyx.com/Products/xml.asp

  but if it's xml, any xml parser
  will parse it, and any validating parser should be able to validate it
  given the correct DTD.

 For example?where do I find a good validating parser?

 thanx again



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I MEANT ONIX.... [it was Re: ONYX]

2007-09-20 Thread korovev76
On 20 Set, 12:55, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:


 First question : do you *really* need a validating parser ?

that's what they told me (they being da boss)... I mean: i have to
validate and to parse... i guess you can't do it at the same time, can
you?


 Second question : did you try to google for
+Python +validating +XML +parser

I've already googled it, and found pyRXP... but  I was looking for
someone/something already experienced with onix...


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I MEANT ONIX.... [it was Re: ONYX]

2007-09-20 Thread korovev76
On 20 Set, 14:29, Diez B. Roggisch [EMAIL PROTECTED] wrote:
 
 lxml is a validating parser for python.

 Diez

thank u, i'll take a look


-- 
http://mail.python.org/mailman/listinfo/python-list


ONYX

2007-09-19 Thread korovev76
Hi everybody! Is there anything out there that can validate and parse
some onyx-style xml? I searched the web, but coulnd't find nothing
really interesting about it...


thank you!

korovev

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: parsing a dbIII file

2007-08-08 Thread korovev76
On 7 Ago, 17:47, Jerry Hill [EMAIL PROTECTED] wrote:
 On 8/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  I have to parse a file (that is a dbIII file) whose stucture look like
  this:
  |string|, |string|, |string that may contain commas inside|, 1, 2, 3, |
  other string|

 The CSV module is probably the easiest way to go:

  data = |string|, |string|, |string that may contain commas

 inside|, 1, 2, 3, |other string| import csv
  reader = csv.reader([data], quotechar=|, skipinitialspace=True)
  for row in reader:

 print row

 ['string', 'string', 'string that may contain commas inside', '1',
 '2', '3', 'other string']

 --
 Jerry


you all were right, I had to mention that I must put the datas in
mysql... So actually the best way to do it is with csv.reader: i tried
it and it works out!

thanx very much!

-- 
http://mail.python.org/mailman/listinfo/python-list


parsing a dbIII file

2007-08-07 Thread korovev76
Hello everybody, I'm new to python (...I work with cobol...)

I have to parse a file (that is a dbIII file) whose stucture look like
this:
|string|, |string|, |string that may contain commas inside|, 1, 2, 3, |
other string|

Is there anything in python that parses this stuff?


thanks a lot
korovev

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: parsing a dbIII file

2007-08-07 Thread korovev76
On 7 Ago, 09:21, Steve Holden [EMAIL PROTECTED] wrote:

 That's not a standard dBaseIII data file though, correct? It looks more
 like something that was produced *from* a dBaseIII file.
yeap... unfortunately it is not...



 Good luck with your escape from COBOL!

i'm not escaping by now... Actually I'd like to use cobol for the rest
of my life (as a programmer) ;-)
But thanx anyway!

korovev

-- 
http://mail.python.org/mailman/listinfo/python-list