parsing XML - getting lots of white space
Tom wright
thomas.wright1 at ntlworld.REMOVETHIS.com
Wed Nov 1 14:22:30 EST 2000
hi all,
when parsing the following message
<?xml version="1.0"?>
<ServerMessage>
<Command fromDirection="North">AddUser</Command>
<User>
<UserName>$userName</UserName>
<UserId>$userId</UserId>
</User>
</ServerMessage>
using the example code from the refereence guide, i get the following
>>> reload( xmlExample )
Start element: ServerMessage {}
Character data: u'\012'
Character data: u' '
Start element: Command {u'fromDirection': u'North'}
Character data: u'AddUser'
End element: Command
Character data: u'\012'
Character data: u' '
Start element: User {}
Character data: u'\012'
Character data: u' '
Start element: UserName {}
Character data: u'$userName'
End element: UserName
Character data: u'\012'
Character data: u' '
Start element: UserId {}
Character data: u'$userId'
End element: UserId
Character data: u'\012'
Character data: u' '
End element: User
Character data: u'\012'
End element: ServerMessage
<module 'xmlExample' from 'xmlExample.py'>
Is there a way to loose the '\012' strings and the space filled string ?
and why is everything in unicode ??
I have RTFM, but i cant find anything, any help appreciated
regards
Tom
More information about the Python-list
mailing list