<s> import string <EOL> import os <EOL> import py_hypertable <EOL> import cgi <EOL> from xml . sax import make_parser <EOL> import xml <EOL> from xml . sax import parseString <EOL> from xml . sax . handler import feature_namespaces <EOL> from xml . sax import ContentHandler <EOL> from xml . sax import saxutils <EOL> from xml . sax . handler import ContentHandler <EOL> class xmlSchemaParser ( ContentHandler ) : <EOL> attributes = [ ] <EOL> def __init__ ( self , tag_name ) : <EOL> self . tag_name = tag_name <EOL> self . isName = <NUM_LIT:0> <EOL> def clear_attributes ( self ) : <EOL> xmlSchemaParser . attributes = [ ] <EOL> def startElement ( self , name , attrs ) : <EOL> if name == self . tag_name : <EOL> self . isName = <NUM_LIT:1> <EOL> def endElement ( self , name ) : <EOL> if name == self . tag_name : <EOL> self . isName = <NUM_LIT:0> <EOL> def characters ( self , ch ) : <EOL> if self . isName == <NUM_LIT:1> : <EOL> xmlSchemaParser . attributes . append ( ch ) <EOL> def getListFromXMLSchema ( table , tag ) : <EOL> dh = xmlSchemaParser ( tag ) <EOL> dh . clear_attributes ( ) <EOL> parser = make_parser ( ) <EOL> dh = xmlSchemaParser ( tag ) <EOL> parser . setContentHandler ( dh ) <EOL> schema = py_hypertable . get_schema ( table ) <EOL> xml . sax . parseString ( schema [ <NUM_LIT:1> ] , dh ) <EOL> for ii in range ( <NUM_LIT:0> , len ( xmlSchemaParser . attributes ) ) : <EOL> xmlSchemaParser . attributes [ ii ] = str ( xmlSchemaParser . attributes [ ii ] ) <EOL> return xmlSchemaParser . attributes </s>
