# DOMParser.h

    00001 /*  -*-objc-*-
    00002  *
    00003  *  GNUstep RSS Kit
    00004  *  Copyright (C) 2006 Guenther Noack
    00005  *
    00006  *  This program is free software; you can redistribute it and/or modify
    00007  *  it under the terms of the GNU General Public License version 2 as
    00008  *  published by the Free Software Foundation.
    00009  *
    00010  *  This program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00018  */
    00019
    00020 #import <Foundation/Foundation.h>
    00021
    00022 @protocol XMLTextOrNode;
    00023 @class XMLNode;
    00024
    00025 @protocol XMLTextOrNode <NSObject>
    00026 -(NSString*) contentAndNextContents;
    00027 -(NSString*) content;
    00028 -(void) _setNext: (id<XMLTextOrNode>) node;
    00029 -(XMLNode*) nextElement;
    00030 @end
    00031
    00032 @interface XMLText : NSObject <XMLTextOrNode>
    00033 {
    00034   NSString* _content;
    00035   id<XMLTextOrNode> _next;
    00036 }
    00037
    00038 -(NSString*) contentAndNextContents;
    00039 -(NSString*) content;
    00040 -(void) _setNext: (id<XMLTextOrNode>) node;
    00041 -(XMLNode*) nextElement;
    00042
    00043 -(id)init;
    00044 -(id)initWithString: (NSString*) str;
    00045
    00046 -(void)dealloc;
    00047 @end
    00048
    00049
    00050 @interface XMLNode : NSObject <XMLTextOrNode>
    00051 {
    00052   NSString* _name;
    00053   NSString* _namespace;
    00054
    00055   XMLNode* _child;
    00056   id<XMLTextOrNode> _next;
    00057
    00058   id<XMLTextOrNode> _current;
    00059   XMLNode* _parent;
    00060
    00061   NSDictionary* _attributes;
    00062 }
    00063
    00064 -(XMLNode*) firstChildElement;
    00065
    00066 -(XMLNode*) nextElement;
    00067
    00068 -(NSString*) name;
    00069
    00070 -(NSString*) contentAndNextContents;
    00071 -(NSString*) content;
    00072
    00073 -(NSDictionary*) attributes;
    00074
    00075 -(NSString*) namespace;
    00076
    00077 -(id) initWithName: (NSString*) name
    00078          namespace: (NSString*) namespace
    00079         attributes: (NSDictionary*) attributes
    00080             parent: (XMLNode*) parent;
    00081
    00082 -(void) dealloc;
    00083
    00084 - (void) _setNext: (id <XMLTextOrNode>) node;
    00085
    00086 - (void) appendTextOrNode: (id<XMLTextOrNode>) aThing
    00087                fromParser: (NSXMLParser*) aParser;
    00088
    00089 @end
    00090
    00091 @interface XMLNode (NSXMLParserDelegateEventAdditions)
    00092 - (void) parser: (NSXMLParser*)aParser
    00093   didEndElement: (NSString*)anElementName
    00094    namespaceURI: (NSString*)aNamespaceURI
    00095   qualifiedName: (NSString*)aQualifierName;
    00096
    00097 - (void) parser: (NSXMLParser*)aParser
    00098 didStartElement: (NSString*)anElementName
    00099    namespaceURI: (NSString*)aNamespaceURI
    00100   qualifiedName: (NSString*)aQualifierName
    00101      attributes: (NSDictionary*)anAttributeDict;
    00102
    00103 - (void)    parser: (NSXMLParser*)aParser
    00104  parseErrorOccured: (NSError*)parseError;
    00105
    00106 - (void) parser: (NSXMLParser*)aParser
    00107 foundCharacters: (NSString*)aString;
    00108
    00109 @end