@@ -10,10 +10,11 @@ */ #import "OFObject.h" @class OFString; +@class OFMutableString; @class OFMutableArray; @class OFMutableDictionary; @class OFXMLAttribute; @interface OFXMLElement: OFObject @@ -20,13 +21,14 @@ { OFString *name; OFString *namespace; OFString *defaultNamespace; OFMutableArray *attributes; - OFString *stringValue; OFMutableDictionary *namespaces; OFMutableArray *children; + OFString *text; + OFMutableString *comment; } /** * \param name The name for the element * \return A new autoreleased OFXMLElement with the specified element name @@ -60,10 +62,26 @@ */ + elementWithName: (OFString*)name namespace: (OFString*)ns stringValue: (OFString*)stringval; +/** + * Creates a new element, only consisting of the specified text. + * + * \param text The text the element represents + * \return A new autoreleased OFXMLElement consisting of the specified text + */ ++ elementWithText: (OFString*)text; + +/** + * Creates a new element, only consisting of the specified comment. + * + * \param comment The comment the element represents + * \return A new autoreleased OFXMLElement consisting of the specified comment + */ ++ elementWithComment: (OFString*)text; + /** * Initializes an already allocated OFXMLElement with the specified element * name. * * \param name The name for the element @@ -107,10 +125,28 @@ */ - initWithName: (OFString*)name namespace: (OFString*)ns stringValue: (OFString*)stringval; +/** + * Initializes an already allocated OFXMLElement so that it only consists of the + * specified text. + * + * \param text The text the element represents + * \return An initialized OFXMLElement consisting of the specified text + */ +- initWithText: (OFString*)text; + +/** + * Initializes an already allocated OFXMLElement so that it only consists of the + * specified comment. + * + * \param comment The comment the element represents + * \return An initialized OFXMLElement consisting of the specified comment + */ +- initWithComment: (OFString*)text; + /** * \return A new autoreleased OFString representing the OFXMLElement as an * XML string */ - (OFString*)string;