Welcome, guest | Sign In | My Account | Store | Cart

Alternative way of extracting text from a WF XML source.

Python, 9 lines
1
2
3
4
5
6
7
8
9
from sgmllib import SGMLParser

class XMLJustText ( SGMLParser ) :
    def handle_data ( self, data ) :
        print data

XMLJustText  ( ) . feed ( 
"<items><item>text 1</item><item>text 2</item></items>" 
)

Warning: I have not experimented with this approach sufficiently to know anything about it.