/usr/include/GNUstep/Foundation/NSXMLNode.h is in libgnustep-base-dev 1.22.1-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | /* Interface for NSXMLNode for GNUStep
Copyright (C) 2008 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
Created: September 2008
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef __NSXMLNode_h_GNUSTEP_BASE_INCLUDE
#define __NSXMLNode_h_GNUSTEP_BASE_INCLUDE
#import <GNUstepBase/GSVersionMacros.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSXMLNodeOptions.h>
#if defined(__cplusplus)
extern "C" {
#endif
@class NSArray;
@class NSDictionary;
@class NSError;
@class NSString;
@class NSURL;
@class NSXMLDocument;
@class NSXMLElement;
enum {
NSXMLInvalidKind = 0,
NSXMLDocumentKind,
NSXMLElementKind,
NSXMLAttributeKind,
NSXMLNamespaceKind,
NSXMLProcessingInstructionKind,
NSXMLCommentKind,
NSXMLTextKind,
NSXMLDTDKind,
NSXMLEntityDeclarationKind,
NSXMLAttributeDeclarationKind,
NSXMLElementDeclarationKind,
NSXMLNotationDeclarationKind
};
typedef NSUInteger NSXMLNodeKind;
// initWithKind options
// NSXMLNodeOptionsNone
// NSXMLNodePreserveAll
// NSXMLNodePreserveNamespaceOrder
// NSXMLNodePreserveAttributeOrder
// NSXMLNodePreserveEntities
// NSXMLNodePreservePrefixes
// NSXMLNodeIsCDATA
// NSXMLNodeExpandEmptyElement
// NSXMLNodeCompactEmptyElement
// NSXMLNodeUseSingleQuotes
// NSXMLNodeUseDoubleQuotes
// Output options
// NSXMLNodePrettyPrint
/**
* The most primitive unit in an XML document.
*/
@interface NSXMLNode : NSObject <NSCopying>
{
#if GS_EXPOSE(NSXMLNode)
@protected
void *_handle;
NSXMLNodeKind _kind;
NSXMLNode *_parent;
NSUInteger _index;
id _objectValue;
#endif
#if GS_NONFRAGILE
#else
/* Pointer to private additional data used to avoid breaking ABI
* when we don't have the non-fragile ABI available.
* Use this mechanism rather than changing the instance variable
* layout (see Source/GSInternal.h for details).
*/
@private id _internal GS_UNUSED_IVAR;
#endif
}
/**
* Creates and returns an attribute node with the specified name and value.
*/
+ (id) attributeWithName: (NSString*)name stringValue: (NSString*)stringValue;
/**
* Creates and returns an attribute node with the specified
* (fully qualified) name, namespace URI, and value.
*/
+ (id) attributeWithName: (NSString*)name
URI: (NSString*)URI
stringValue: (NSString*)stringValue;
/**
* Creates and returns a comment node with the supplied text.
*/
+ (id) commentWithStringValue: (NSString*)stringValue;
/** Creates and returns an empty document ... convenience method.
*/
+ (id) document;
/**
* Creates and returns a new document intialised with the supplied root
* node.
*/
+ (id) documentWithRootElement: (NSXMLElement*)element;
/**
* Creates and returns a DTD node from the supplied string.
* The node might describe element, attribute, entity, or notation.
*/
+ (id) DTDNodeWithXMLString: (NSString*)string;
/**
* Creates and returns a node node with the specified name.
*/
+ (id) elementWithName: (NSString*)name;
/**
* Creates and returns a node containing the supplied child nodes and with
* the attribute nodes from the supplied array.
*/
+ (id) elementWithName: (NSString*)name
children: (NSArray*)children
attributes: (NSArray*)attributes;
/**
* Creates and returns a node with the supplied (fully qualified name)
* an namespace URI.
*/
+ (id) elementWithName: (NSString*)name URI: (NSString*)URI;
/**
* Creates and returns a node with the pecified name and with a single
* text node (containing string) as its content.
*/
+ (id) elementWithName: (NSString*)name stringValue: (NSString*)string;
/** Strips any leading namespace prefix from name and returns the result.
*/
+ (NSString*) localNameForName: (NSString*)name;
/**
* Creates and returns a node mapping the supplkied namespace name to
* the string value (URI).
*/
+ (id) namespaceWithName: (NSString*)name stringValue: (NSString*)stringValue;
/** Returns the namespace node corresponding to a predefined namespace names
* (one of xml, xs, or xsi)
*/
+ (NSXMLNode*) predefinedNamespaceForPrefix: (NSString*)name;
/** Returns the namespace prefix of name.
*/
+ (NSString*) prefixForName: (NSString*)name;
/**
* Creates and return a processinc insruction node with th specified name
* and textual value.
*/
+ (id) processingInstructionWithName: (NSString*)name
stringValue: (NSString*)stringValue;
/**
* Creates and returns a simple text node.
*/
+ (id) textWithStringValue: (NSString*)stringValue;
/** Returns the canonical form (see http://www.w3.org/TR/xml-c14n) of the
* receiveri as long as the NSXMLNodePreserveWhitespace has been set.
* If the option as not been set, return the same without white space
* preserved.
*/
- (NSString*) canonicalXMLStringPreservingComments: (BOOL)comments;
/** Returns the child node if the receiver at the specified index.
*/
- (NSXMLNode*) childAtIndex: (NSUInteger)index;
/** Returns the number of immediate child nodes of the receiver.<br />
* This method is more efficient than getting the array of children
* and counting it.
*/
- (NSUInteger) childCount;
/** Returns n array containing the immediate child nodes of the receiver.
*/
- (NSArray*) children;
/** Detaches the receiver from its parent node.
*/
- (void) detach;
/** Return the index of the receiver within its parent node.
*/
- (NSUInteger) index;
/** Initialises the receiver as a specific kind of node.<br />
* Calls -initWithKind:options: using NSXMLNodeOptionsNone and
* returns the result.
*/
- (id) initWithKind: (NSXMLNodeKind)kind;
/** <init />
* Initialises the receiver as the specified kind of node and with the
* specified options.
*/
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)options;
/** Return the level of the receiver within the tree of nodes.<br />
* A document or a node which is not inside another is at level 0.
*/
- (NSUInteger) level;
/** Returns the name of the receiver without any namespace prefix.
*/
- (NSString*) localName;
/**
* Returns the kind of node represented by the receiver.
*/
- (NSXMLNodeKind) kind;
/** Returns the name of the receiver.
*/
- (NSString*) name;
/** Returns the next node in the tree.
*/
- (NSXMLNode*) nextNode;
/** Returns the next sibling of the receiver
*/
- (NSXMLNode*) nextSibling;
/** Returns the nodes resulting from applying xpath to the receiver.<br />
* Before using xpath on a tree, you must call the
* -normalizeAdjacentTextNodesPreservingCDATA: with NO as the argument,
* in order to avoid problems where the xpath syntax cannot cope with
* multiple text nodes.
*/
- (NSArray*) nodesForXPath: (NSString*)xpath error: (NSError**)error;
/** Returns the data resulting from calling the query on the receiver.<br />
* The same as objectsForXQuery:constants:error: without the constants.
*/
- (NSArray*) objectsForXQuery: (NSString*)xquery error: (NSError**)error;
/** Returns the data resulting from calling the query on the receiver.<br />
* Before using xpath on a tree, you must call the
* -normalizeAdjacentTextNodesPreservingCDATA: with NO as the argument,
* in order to avoid problems where the xpath syntax cannot cope with
* multiple text nodes.<br />
* The value of constants is a dictionary of constants declared
* to be "external" in the query.<br />
* The resulting array amy contain array, data, date, number, string,
* and URL objects as well as nodes.
*/
- (NSArray*) objectsForXQuery: (NSString*)xquery
constants: (NSDictionary*)constants
error: (NSError**)error;
/**
* Returns the object value of the receiver (as set using -setObjectValue:)
* or nil if there is none.
*/
- (id) objectValue;
/**
* Returns the parent node of the receiver or nil if the receiver is not
* within another node.
*/
- (NSXMLNode*) parent;
/** Returns the namepsace prefix for the receiver or nil if there is no
* namespace prefix.
*/
- (NSString*) prefix;
/** Returns the previous node in the tree ... stepping through the tree
* backwards.
*/
- (NSXMLNode*) previousNode;
/* Returns the previous sibling of the receiver.
*/
- (NSXMLNode*) previousSibling;
/** Returns the document containing the receiver, or nil if the receiver
* does not lie within a document.
*/
- (NSXMLDocument*) rootDocument;
/** Sets the name of the receiver.
*/
- (void) setName: (NSString*)name;
/** Sets the content of the receiver, removing any existing children
* (including comments and processing instructions).<br />
* For an element node, this sets text contetn within the node.
*/
- (void) setObjectValue: (id)value;
/**
* Sets the content of the receiver to be the supplied string value ...
* which involves removing existing content, comments,
* and processing instructions.<br />
* If the receiver is an element node, this creates a text node containing
* the string value as the sole child of the receiver.
*/
- (void) setStringValue: (NSString*)string;
/**
* Sets the string content of the receiver.<br />
* if the resolve flag is YES then any entities which can be resolved are
* replaced by the resolved versions.
*/
- (void) setStringValue: (NSString*)string resolvingEntities: (BOOL)resolve;
/** Sets the URI of the receiver.
*/
- (void) setURI: (NSString*)URI;
/** Returns the string value of the receiver. For kinds of node which have
* direct string content, this simply returns that content. For elements
* this recursively traverses the children of the receiver appending the
* text of each child to a single string result.
*/
- (NSString*) stringValue;
/** Returns the URI of the receiver.
*/
- (NSString*) URI;
/** Returns the XPath string to access the receiver with the document.
*/
- (NSString*) XPath;
/**
* Returns the text of the receiver as XML (ie in the form it would have
* in an XML document).
*/
- (NSString*) XMLString;
/**
* Returns the text of the receiver as XML (ie in the form it would have
* in an XML document), with the specified options controlling it.
*/
- (NSString*) XMLStringWithOptions: (NSUInteger)options;
@end
#if defined(__cplusplus)
}
#endif
#endif /*__NSXMLNode_h_GNUSTEP_BASE_INCLUDE */
|