00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #import "OFObject.h"
00013 #import "OFString.h"
00014
00015 extern int _OFXMLParser_reference;
00016
00017 @class OFXMLParser;
00018 @class OFArray;
00019 @class OFMutableArray;
00020
00024 @protocol OFXMLParserDelegate
00034 - (void)xmlParser: (OFXMLParser*)parser
00035 didStartTagWithName: (OFString*)name
00036 prefix: (OFString*)prefix
00037 namespace: (OFString*)ns
00038 attributes: (OFArray*)attrs;
00039
00048 - (void)xmlParser: (OFXMLParser*)parser
00049 didEndTagWithName: (OFString*)name
00050 prefix: (OFString*)prefix
00051 namespace: (OFString*)ns;
00052
00059 - (void)xmlParser: (OFXMLParser*)parser
00060 foundString: (OFString*)string;
00061
00068 - (void)xmlParser: (OFXMLParser*)parser
00069 foundComment: (OFString*)comment;
00070
00081 - (OFString*)xmlParser: (OFXMLParser*)parser
00082 foundUnknownEntityNamed: (OFString*)entity;
00083 @end
00084
00089 @protocol OFXMLUnescapingDelegate
00099 - (OFString*)foundUnknownEntityNamed: (OFString*)entity;
00100 @end
00101
00108 @interface OFXMLParser: OFObject <OFXMLUnescapingDelegate>
00109 {
00110 OFObject <OFXMLParserDelegate> *delegate;
00111 enum {
00112 OF_XMLPARSER_OUTSIDE_TAG,
00113 OF_XMLPARSER_TAG_OPENED,
00114 OF_XMLPARSER_IN_TAG_NAME,
00115 OF_XMLPARSER_IN_CLOSE_TAG_NAME,
00116 OF_XMLPARSER_IN_TAG,
00117 OF_XMLPARSER_IN_ATTR_NAME,
00118 OF_XMLPARSER_EXPECT_DELIM,
00119 OF_XMLPARSER_IN_ATTR_VALUE,
00120 OF_XMLPARSER_EXPECT_CLOSE,
00121 OF_XMLPARSER_EXPECT_SPACE_OR_CLOSE,
00122 OF_XMLPARSER_IN_COMMENT_1,
00123 OF_XMLPARSER_IN_COMMENT_2,
00124 OF_XMLPARSER_IN_COMMENT_3,
00125 OF_XMLPARSER_IN_COMMENT_4
00126 } state;
00127 OFMutableString *cache;
00128 OFString *name;
00129 OFString *prefix;
00130 OFString *ns;
00131 OFMutableArray *attrs;
00132 OFString *attrName;
00133 OFString *attrPrefix;
00134 char delim;
00135 OFMutableArray *previous;
00136 }
00137
00141 + xmlParser;
00142
00146 - (id)delegate;
00147
00153 - (void)setDelegate: (OFObject <OFXMLParserDelegate>*)delegate;
00154
00161 - (void)parseBuffer: (const char*)buf
00162 withSize: (size_t)size;
00163 @end
00164
00168 @interface OFString (OFXMLUnescaping)
00172 - (OFString*)stringByXMLUnescaping;
00173
00180 - (OFString*)stringByXMLUnescapingWithHandler:
00181 (OFObject <OFXMLUnescapingDelegate>*)h;
00182 @end
00183
00184 @interface OFObject (OFXMLParserDelegate) <OFXMLParserDelegate>
00185 @end