This file is indexed.

/usr/include/GNUstep/GNUstepBase/GSXML.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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
/** Interface for XML parsing classes

   Copyright (C) 2000-2005 Free Software Foundation, Inc.

   Written by:  Michael Pakhantsov  <mishel@berest.dp.ua> on behalf of
   Brainstorm computer solutions.

   Date: Jule 2000

   Integrated by Richard Frith-Macdonald <richard@brainstorm.co.uk>
   Date: September 2000
   GSXPath by Nicola Pero <nicola@brainstorm.co.uk>

   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 2 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.

   AutogsdocSource: Additions/GSXML.m

*/

#ifndef __GSXML_h_GNUSTEP_BASE_INCLUDE
#define __GSXML_h_GNUSTEP_BASE_INCLUDE
#import <GNUstepBase/GSVersionMacros.h>

#if	OS_API_VERSION(GS_API_NONE,GS_API_LATEST)

#ifndef NeXT_Foundation_LIBRARY
#import <Foundation/NSObject.h>
#import <Foundation/NSString.h>
#import <Foundation/NSDictionary.h>
#else
#import <Foundation/Foundation.h>
#endif

#if	defined(__cplusplus)
extern "C" {
#endif

@class GSXMLAttribute;
@class GSXMLDocument;
@class GSXMLNamespace;
@class GSXMLNode;
@class GSSAXHandler;

/**
 * Convenience methods for managing XML escape sequences in an NSString.
 */
@interface	NSString (GSXML)
/**
 * Deals with standard XML internal entities.<br />
 * Converts the five XML special characters in the receiver ('&gt;', '&lt;',
 * '&amp;', '&apos;' and '&quot;') to their escaped equivalents, and return
 * the escaped string.<br />
 * Also converts non-ascii characters to the corresponding numeric
 * entity escape sequences.<br />
 * You should perform any non-standard entity substitution you require
 * <em>after</em> you have called this method.
 */
- (NSString*) stringByEscapingXML;
/**
 * Deals with standard XML internal entities.<br />
 * Converts the five XML escape sequences ('&amp;gt;', '&amp;lt;', '&amp;amp;',
 * '&amp;apos;' and '&amp;quot;') to the unicode characters they represent,
 * and returns the unescaped string.<br />
 * Also converts numeric entity escape sequences to the corresponding unicode
 * characters.<br />
 * You should perform any non-standard entity substitution you require
 * <em>before</em> you have called this method.
 */
- (NSString*) stringByUnescapingXML;
@end

@interface GSXMLDocument : NSObject <NSCopying>
{
  void	*lib;	// pointer to xmllib pointer of xmlDoc struct
  BOOL	_ownsLib;
  id	_parent;
}
+ (GSXMLDocument*) documentWithVersion: (NSString*)version;

- (NSString*) description;
- (NSString*) encoding;

- (void*) lib;

- (GSXMLNode*) makeNodeWithNamespace: (GSXMLNamespace*)ns
				name: (NSString*)name
			     content: (NSString*)content;

- (GSXMLNode*) root;
- (GSXMLNode*) setRoot: (GSXMLNode*)node;

- (NSString*) version;

- (BOOL) writeToFile: (NSString*)filename atomically: (BOOL)useAuxilliaryFile;
- (BOOL) writeToURL: (NSURL*)url atomically: (BOOL)useAuxilliaryFile;

@end



@interface GSXMLNamespace : NSObject <NSCopying>
{
  void	*lib;          /* pointer to struct xmlNs in the gnome xmllib */
  id	_parent;
}

+ (NSString*) descriptionFromType: (NSInteger)type;
+ (NSInteger) typeFromDescription: (NSString*)desc;

- (NSString*) href;

- (void*) lib;
- (GSXMLNamespace*) next;
- (NSString*) prefix;
- (NSInteger) type;
- (NSString*) typeDescription;

@end

/* XML Node */

@interface GSXMLNode : NSObject <NSCopying>
{
  void  *lib;      /* pointer to struct xmlNode from libxml */
  id	_parent;
}

+ (NSString*) descriptionFromType: (NSInteger)type;
+ (NSInteger) typeFromDescription: (NSString*)desc;

- (NSDictionary*) attributes;
- (NSString*) content;
- (NSString*) description;
- (GSXMLDocument*) document;
- (NSString*) escapedContent;
- (GSXMLAttribute*) firstAttribute;
- (GSXMLNode*) firstChild;
- (GSXMLNode*) firstChildElement;
- (BOOL) isElement;
- (BOOL) isText;
- (void*) lib;
- (GSXMLAttribute*) makeAttributeWithName: (NSString*)name
				    value: (NSString*)value;
- (GSXMLNode*) makeChildWithNamespace: (GSXMLNamespace*)ns
				 name: (NSString*)name
			      content: (NSString*)content;
- (GSXMLNode*) makeComment: (NSString*)content;
- (GSXMLNamespace*) makeNamespaceHref: (NSString*)href
			       prefix: (NSString*)prefix;
- (GSXMLNode*) makePI: (NSString*)name
	      content: (NSString*)content;
- (GSXMLNode*) makeText: (NSString*)content;
- (NSString*) name;
- (GSXMLNamespace*) namespace;
- (GSXMLNamespace*) namespaceDefinitions;
- (GSXMLNode*) next;
- (GSXMLNode*) nextElement;
- (NSString*) objectForKey: (NSString*)key;
- (GSXMLNode*) parent;
- (GSXMLNode*) previous;
- (GSXMLNode*) previousElement;
- (NSMutableDictionary*) propertiesAsDictionaryWithKeyTransformationSel:
  (SEL)keyTransformSel;
- (void) setObject: (NSString*)value forKey:(NSString*)key;
- (NSInteger) type;
- (NSString*) typeDescription;
- (void) setNamespace: (GSXMLNamespace *)space;

@end

@interface GSXMLAttribute : GSXMLNode
- (NSString*) value;
@end

@interface GSXMLParser : NSObject
{
   id			src;		/* source for parsing	*/
   void			*lib;		/* parser context	*/
   GSSAXHandler		*saxHandler;	/* handler for parsing	*/
   NSMutableString	*messages;	/* append messages here	*/
}
+ (NSString*) loadEntity: (NSString*)publicId at: (NSString*)location;
+ (GSXMLParser*) parser;
+ (GSXMLParser*) parserWithContentsOfFile: (NSString*)path;
+ (GSXMLParser*) parserWithContentsOfURL: (NSURL*)url;
+ (GSXMLParser*) parserWithData: (NSData*)data;
+ (GSXMLParser*) parserWithSAXHandler: (GSSAXHandler*)handler;
+ (GSXMLParser*) parserWithSAXHandler: (GSSAXHandler*)handler
		   withContentsOfFile: (NSString*)path;
+ (GSXMLParser*) parserWithSAXHandler: (GSSAXHandler*)handler
		    withContentsOfURL: (NSURL*)url;
+ (GSXMLParser*) parserWithSAXHandler: (GSSAXHandler*)handler
			     withData: (NSData*)data;
+ (void) setDTDs: (NSString*)aPath;
+ (NSString*) xmlEncodingStringForStringEncoding: (NSStringEncoding)encoding;

- (void) abortParsing;
- (NSInteger) columnNumber;
- (GSXMLDocument*) document;
- (BOOL) doValidityChecking: (BOOL)yesno;
- (NSInteger) errNo;
- (BOOL) getWarnings: (BOOL)yesno;
- (id) initWithSAXHandler: (GSSAXHandler*)handler;
- (id) initWithSAXHandler: (GSSAXHandler*)handler
       withContentsOfFile: (NSString*)path;
- (id) initWithSAXHandler: (GSSAXHandler*)handler
	withContentsOfURL: (NSURL*)url;
- (id) initWithSAXHandler: (GSSAXHandler*)handler
		 withData: (NSData*)data;

- (BOOL) keepBlanks: (BOOL)yesno;
- (NSInteger) lineNumber;
- (NSString*) messages;
- (BOOL) parse;
- (BOOL) parse: (NSData*)data;
- (NSString*) publicID;
- (void) saveMessages: (BOOL)yesno;
- (BOOL) substituteEntities: (BOOL)yesno;
- (NSString*) systemID;

@end

@interface GSHTMLParser : GSXMLParser
{
}
@end

@interface GSSAXHandler : NSObject
{
  void		*lib;	// xmlSAXHandlerPtr
  GSXMLParser	*parser;
@protected
  BOOL		isHtmlHandler;
}
+ (GSSAXHandler*) handler;
- (void*) lib;
- (GSXMLParser*) parser;

/** <override-dummy /> */
- (void) attribute: (NSString*)name
	     value: (NSString*)value;
/** <override-dummy /> */
- (void) attributeDecl: (NSString*)nameElement
                  name: (NSString*)name
                  type: (NSInteger)type
          typeDefValue: (NSInteger)defType
          defaultValue: (NSString*)value;
/** <override-dummy /> */
- (void) characters: (NSString*)name;
/** <override-dummy /> */
- (void) cdataBlock: (NSData*)value;
/** <override-dummy /> */
- (void) comment: (NSString*) value;
/** <override-dummy /> */
- (void) elementDecl: (NSString*)name
		type: (NSInteger)type;
/** <override-dummy /> */
- (void) endDocument;
/** <override-dummy /> */
- (void) endElement: (NSString*)elementName;
/** <override-dummy /> */
- (void) endElement: (NSString*)elementName
             prefix: (NSString*)prefix
	       href: (NSString*)href;
/** <override-dummy /> */
- (void) entityDecl: (NSString*)name
               type: (NSInteger)type
             public: (NSString*)publicId
             system: (NSString*)systemId
            content: (NSString*)content;
- (void) error: (NSString*)e;
- (void) error: (NSString*)e
     colNumber: (NSInteger)colNumber
    lineNumber: (NSInteger)lineNumber;
- (BOOL) externalSubset: (NSString*)name
             externalID: (NSString*)externalID
               systemID: (NSString*)systemID;
- (void) fatalError: (NSString*)e;
- (void) fatalError: (NSString*)e
          colNumber: (NSInteger)colNumber
         lineNumber: (NSInteger)lineNumber;
- (void*) getEntity: (NSString*)name;
- (void*) getParameterEntity: (NSString*)name;
/** <override-dummy /> */
- (void) globalNamespace: (NSString*)name
		    href: (NSString*)href
		  prefix: (NSString*)prefix;
- (NSInteger) hasExternalSubset;
- (NSInteger) hasInternalSubset;
/** <override-dummy /> */
- (void) ignoreWhitespace: (NSString*)ch;
- (BOOL) internalSubset: (NSString*)name
             externalID: (NSString*)externalID
               systemID: (NSString*)systemID;
- (NSInteger) isStandalone;
- (NSString*) loadEntity: (NSString*)publicId
		      at: (NSString*)location;
/** <override-dummy /> */
- (void) namespaceDecl: (NSString*)name
		  href: (NSString*)href
		prefix: (NSString*)prefix;
/** <override-dummy /> */
- (void) notationDecl: (NSString*)name
	       public: (NSString*)publicId
	       system: (NSString*)systemId;
/** <override-dummy /> */
- (void) processInstruction: (NSString*)targetName
		       data: (NSString*)PIdata;
/** <override-dummy /> */
- (void) reference: (NSString*)name;
/** <override-dummy /> */
- (void) startDocument;
/** <override-dummy /> */
- (void) startElement: (NSString*)elementName
           attributes: (NSMutableDictionary*)elementAttributes;
/** <override-dummy /> */
- (void) startElement: (NSString*)elementName
	       prefix: (NSString*)prefix
		 href: (NSString*)href
           attributes: (NSMutableDictionary*)elementAttributes
           namespaces: (NSMutableDictionary*)elementNamespaces;
/** <override-dummy /> */
- (void) unparsedEntityDecl: (NSString*)name
		     public: (NSString*)publicId
		     system: (NSString*)systemId
	       notationName: (NSString*)notation;
- (void) warning: (NSString*)e;
- (void) warning: (NSString*)e
       colNumber: (NSInteger)colNumber
      lineNumber: (NSInteger)lineNumber;

@end

@interface GSTreeSAXHandler : GSSAXHandler
@end

@interface GSHTMLSAXHandler : GSSAXHandler
@end

@class GSXPathObject;

/*
 * Using this library class is trivial.  Get your GSXMLDocument.  Create
 * a GSXPathContext for it.
 *
 * GSXPathContext *p = [[GSXPathContext alloc] initWithDocument: document];
 *
 * Then, you can use it to evaluate XPath expressions:
 *
 * GSXPathString *result = [p evaluateExpression: @"string(/body/text())"];
 * NSLog (@"Got %@", [result stringValue]);
 *
 * If the XML document contains namespaces, you first need to register them
 * with the parser by using registerNamespaceWithPrefix:href:, as in:
 *
 * GSXPathContext *p = [[GSXPathContext alloc] initWithDocument: document];
 * if ([p registerNamespaceWithPrefix: @"a"  href="http://www.gnustep.org/demo"] == NO)
 *  {
 *    // Error registering namespace, do something about it.
 *  }
 *
 * and then you can use the namespace prefix in your expressions, as in
 *
 * GSXPathString *result = [p evaluateExpression: @"string(/a:body/text())"];
 * NSLog (@"Got %@", [result stringValue]);
 *
 */
@interface GSXPathContext : NSObject
{
  void		*_lib;		// xmlXPathContext
  GSXMLDocument *_document;
}
- (id) initWithDocument: (GSXMLDocument*)d;
- (GSXPathObject*) evaluateExpression: (NSString*)XPathExpression;

/*
 * Registers a new namespace.  Return YES if succesful, NO if not.
 */
- (BOOL) registerNamespaceWithPrefix: (NSString *)prefix
                                href: (NSString *)href;
@end

/** XPath queries return a GSXPathObject.  GSXPathObject in itself is
 * an abstract class; there are four types of completely different
 * GSXPathObject types, listed below.  I'm afraid you need to check
 * the returned type of each GSXPath query to make sure it's what you
 * meant it to be.
 */
@interface GSXPathObject : NSObject
{
  void		*_lib;		// xmlXPathObject
  GSXPathContext *_context;
}
@end

/**
 * For XPath queries returning true/false.
 */
@interface GSXPathBoolean : GSXPathObject
- (BOOL) booleanValue;
@end

/**
 * For XPath queries returning a number.
 */
@interface GSXPathNumber : GSXPathObject
- (double) doubleValue;
@end

/**
 * For XPath queries returning a string.
 */
@interface GSXPathString : GSXPathObject
- (NSString *) stringValue;
@end

/**
 * For XPath queries returning a node set.
 */
@interface GSXPathNodeSet : GSXPathObject
- (NSUInteger) count;
- (NSUInteger) length;

/** Please note that index starts from 0.  */
- (GSXMLNode *) nodeAtIndex: (NSUInteger)index;
@end

@interface GSXMLDocument (XSLT)
+ (GSXMLDocument*) xsltTransformFile: (NSString*)xmlFile
                          stylesheet: (NSString*)xsltStylesheet
		              params: (NSDictionary*)params;
			
+ (GSXMLDocument*) xsltTransformFile: (NSString*)xmlFile
                          stylesheet: (NSString*)xsltStylesheet;
			
+ (GSXMLDocument*) xsltTransformXml: (NSData*)xmlData
                         stylesheet: (NSData*)xsltStylesheet
		             params: (NSDictionary*)params;
			
+ (GSXMLDocument*) xsltTransformXml: (NSData*)xmlData
                         stylesheet: (NSData*)xsltStylesheet;
			
- (GSXMLDocument*) xsltTransform: (GSXMLDocument*)xsltStylesheet
                          params: (NSDictionary*)params;
			
- (GSXMLDocument*) xsltTransform: (GSXMLDocument*)xsltStylesheet;
@end



#import	<Foundation/NSURLHandle.h>
#import	<Foundation/NSURLConnection.h>

@class	NSArray;
@class	NSDictionary;
@class	NSTimer;
@class	GSXMLNode;
@class	GSXMLRPC;

/**
 * <p>The GSXMLRPC class provides methods for constructing and parsing
 * XMLRPC method call and response documents ... so that calls may
 * be constructed of standard objects.
 * </p>
 * <p>The correspondence between XMLRPC values and Objective-C objects
 * is as follows -
 * </p>
 * <list>
 *   <item><strong>i4</strong> (or <em>int</em>) is an [NSNumber] other
 *   than a real/float or boolean.</item>
 *   <item><strong>boolean</strong> is an [NSNumber] created as a BOOL.</item>
 *   <item><strong>string</strong> is an [NSString] object.</item>
 *   <item><strong>double</strong> is an [NSNumber] created as a float or
 *   double.</item>
 *   <item><strong>dateTime.iso8601</strong> is an [NSDate] object.</item>
 *   <item><strong>base64</strong> is an [NSData] object.</item>
 *   <item><strong>array</strong> is an [NSArray] object.</item>
 *   <item><strong>struct</strong> is an [NSDictionary] object.</item>
 * </list>
 * <p>If you attempt to use any other type of object in the construction
 * of an XMLRPC document, the [NSObject-description] method of that
 * object will be used to create a striong, and the resulting object
 * will be encoded as an XMLRPC <em>string</em> element.
 * </p>
 * <p>In particular, the names of members in a <em>struct</em> must be strings,
 * so if you provide an [NSDictionary] object to represent a <em>struct</em>
 * the keys of the dictionary will be converted to strings if necessary.
 * </p>
 * <p>The class also provides a method for making a synchronous XMLRPC
 * method call (with timeout), or an asynchronous call in which the
 * call completion is handled by a delegate.
 * </p>
 * <p>You may also use the class to implement an XMLRPC server, by calling
 * the -parseMethod:params: method to parse the data POSTed to your server,
 * and -buildResponseWithParams: (or -buildResponseWithFaultCode:andString:)
 * to produce the data to be sent back to the client.
 * </p>
 * <p>In order to simply make a synchronous XMLRPC call to a server, all
 * you need to do is write code like:
 * </p>
 * <example>
 *   GSXMLRPC	*server = [[GSXMLRPC alloc] initWithURL: @"http://server/path"];
 *   id		result = [server makeMethodCall: name params: p timeout: 30];
 * </example>
 * <p>Saying that you want to call the specified method ('name') on  the server,
 * passing the parameters ('p') and with a 30 second timeout.<br />
 * If there is a network or http-level error or a timeout, the result will be
 * an error string, otherwise it will be an array (on success) or a dictionary
 * containing the fault details.
 * </p>
 */
@interface	GSXMLRPC : NSObject <NSURLHandleClient>
{
@private
#if	defined(GNUSTEP)
  NSURLHandle		*handle;
  NSString		*connectionURL GS_UNUSED_IVAR;
  NSURLConnection	*connection GS_UNUSED_IVAR;
  NSMutableData		*response GS_UNUSED_IVAR;
#else
  id			handle GS_UNUSED_IVAR;
  NSString		*connectionURL;
  NSURLConnection	*connection;
  NSMutableData		*response;
#endif
  NSTimer		*timer;
  id			result;
  id			delegate;	// Not retained.
  NSTimeZone		*tz;
  BOOL			compact;
}

/**
 * Given a method name and an array of parameters, this method constructs
 * the XML document for the corresponding XMLRPC call and returns the
 * document as an NSData object containing UTF-8 text.<br />
 * The params array may be empty or nil if there are no parameters to be
 * passed.<br />
 * The method returns nil if passed an invalid method name (a method name
 * may contain any of the ascii alphanumeric characters and underscore,
 * fullstop, colon, or slash).<br />
 * This method is used internally when sending an XMLRPC method call to
 * a remote system, but you can also call it yourself.
 */
- (NSData*) buildMethod: (NSString*)method 
	         params: (NSArray*)params;

/**
 * Given a method name and an array of parameters, this method constructs
 * the XML document for the corresponding XMLRPC call and returns the
 * document as a string.<br />
 * The params array may be empty or nil if there are no parameters to be
 * passed.<br />
 * The method returns nil if passed an invalid method name (a method name
 * may contain any of the ascii alphanumeric characters and underscore,
 * fullstop, colon, or slash).<br />
 */
- (NSString*) buildMethodCall: (NSString*)method 
                       params: (NSArray*)params;

/**
 * Constructs an XML document for an XMLRPC fault response with the
 * specified code and string.  The resulting document is returned
 * as a string.<br />
 * This method is intended for use by applications acting as XMLRPC servers.
 */
- (NSString*) buildResponseWithFaultCode: (NSInteger)code
                               andString: (NSString*)s;

/**
 * Builds an XMLRPC response with the specified array of parameters and
 * returns the document as a string.<br />
 * The params array may be empty or nil if there are no parameters to be
 * returned (an empty params element will be created).<br />
 * This method is intended for use by applications acting as XMLRPC servers.
 */
- (NSString*) buildResponseWithParams: (NSArray*)params;

/**
 * Return the value set by a prior call to -setCompact: (or NO ... the default).
 */
- (BOOL) compact;

/**
 * Returns the delegate previously set by the -setDelegate: method.<br />
 * The delegate handles completion of asynchronous method calls to the
 * URL specified when the receiver was initialised (if any).
 */
- (id) delegate;

/**
 * Initialise the receiver to make XMLRPC calls to the specified URL.<br />
 * This method just calls -initWithURL:certificate:privateKey:password:
 * with nil arguments for the SSL credentials.
 */
- (id) initWithURL: (NSString*)url;

/** <init />
 * Initialise the receiver to make XMLRPC calls to the specified url
 * and (optionally) with the specified SSL parameters.<br />
 * The url argument may be nil, in which case the receiver will be
 * unable to make XMLRPC calls, but can be used to parse incoming
 * requests and build responses.<br />
 * If the SSL credentials are non-nil, connections to the remote server
 * will be authenticated using the supplied certificate so that the
 * remote system knows who is contacting it.
 */
- (id) initWithURL: (NSString*)url
       certificate: (NSString*)cert
        privateKey: (NSString*)pKey
	  password: (NSString*)pwd;

/**
 * Calls -sendMethodCall:params:timeout: and waits for the response.<br />
 * Returns the response parameters (an array),
 * the response fault (a dictionary),
 * or a failure reason (a string).
 */
- (id) makeMethodCall: (NSString*)method
	       params: (NSArray*)params
	      timeout: (NSInteger)seconds;

/**
 * Parses XML data containing an XMLRPC method call.<br />
 * Returns the name of the method call.<br />
 * Empties, and then places the method parameters (if any)
 * in the params argument.<br />
 * NB. Any containers (arrays or dictionaries) in the parsed parameters
 * will be mutable, so you can modify this data structure as you like.<br />
 * Raises an exception if parsing fails.<br />
 * This method is intended for the use of XMLRPC server applications.
 */
- (NSString*) parseMethod: (NSData*)request
		   params: (NSMutableArray*)params;

/**
 * Parses XML data containing an XMLRPC method response.<br />
 * Returns nil for success, the fault dictionary on failure.<br />
 * Places the response parameters (if any) in the params argument.<br />
 * NB. Any containers (arrays or dictionaries) in the parsed parameters
 * will be mutable, so you can modify this data structure as you like.<br />
 * Raises an exception if parsing fails.<br />
 * Used internally when making a method call to a remote server.
 */
- (NSDictionary*) parseResponse: (NSData*)resp
			 params: (NSMutableArray*)params;

/**
 * Returns the result of the last method call, or nil if there has been
 * no method call or one is in progress.<br />
 * The result may be one of -
 * <list>
 *   <item>A mutable array ... the parameters of a success response.</item>
 *   <item>A dictionary ... containing a fault response.</item>
 *   <item>A string ... describing a low-level failure (eg. timeout).</item>
 * </list>
 * NB. Any containers (arrays or dictionaries) in the parsed parameters
 * of a success response will be mutable, so you can modify this data
 * structure as you like.
 */
- (id) result;

/**
 * Send an asynchronous XMLRPC method call with the specified timeout.<br />
 * A delegate should have been set to handle the result of this call,
 * but if one was not set the state of the asynchronous call may be polled
 * by calling the -result method, which will return nil as long as the
 * call has not completed.<br />
 * The call may be cancelled by calling the -timeout: method<br />
 * This method returns YES if the call was started,
 * NO if it could not be started
 * (eg because another call is in progress or because of bad arguments).<br />
 * NB. For the asynchronous operation to proceed, the current [NSRunLoop]
 * must be run.
 */
- (BOOL) sendMethodCall: (NSString*)method
		 params: (NSArray*)params
		timeout: (NSInteger)seconds;

/**
 * Specify whether to generate compact XML (omit indentation and other white
 * space and omit &lt;string&gt; element markup).<br />
 * Compact representation saves some space (can be important when sent over
 * slow/low bandwidth connections), but sacrifices readability.
 */
- (void) setCompact: (BOOL)flag;

/**
 * Specify whether to perform debug trace on I/O
 */
- (void) setDebug: (BOOL)flag;

/**
 * Sets the delegate object which will receive callbacks when an XMLRPC
 * call completes.<br />
 * NB. this delegate is <em>not</em> retained, and should be removed
 * before it is deallocated (call -setDelegate: again with a nil argument
 * to remove the delegate).
 */
- (void) setDelegate: (id)aDelegate;

/**
 * Sets the time zone for use when sending/receiving date/time values.<br />
 * The XMLRPC specification says that timezone is server dependent so you
 * will need to set it according to the server you are connecting to.<br />
 * If this is not set, UCT is assumed.
 */
- (void) setTimeZone: (NSTimeZone*)timeZone;

/**
 * Handles timeouts, passing information to delegate ... you don't need to
 * call this method, but you <em>may</em> call it in order to cancel an
 * asynchronous request as if it had timed out.
 */
- (void) timeout: (NSTimer*)t;

/**
 * Return the time zone currently set.
 */
- (NSTimeZone*) timeZone;

#ifdef GNUSTEP
/** <override-dummy />
 * Allows GSXMLRPC to act as a client of NSURLHandle. Internal use only. */
- (void) URLHandle: (NSURLHandle*)sender
  resourceDataDidBecomeAvailable: (NSData*)newData;
/** <override-dummy />
 * Allows GSXMLRPC to act as a client of NSURLHandle. Internal use only. */
- (void) URLHandle: (NSURLHandle*)sender
  resourceDidFailLoadingWithReason: (NSString*)reason;
/** <override-dummy />
 * Allows GSXMLRPC to act as a client of NSURLHandle. Internal use only. */
- (void) URLHandleResourceDidBeginLoading: (NSURLHandle*)sender;
/** <override-dummy />
 * Allows GSXMLRPC to act as a client of NSURLHandle. Internal use only. */
- (void) URLHandleResourceDidCancelLoading: (NSURLHandle*)sender;
/** <override-dummy />
 * Allows GSXMLRPC to act as a client of NSURLHandle. Internal use only. */
- (void) URLHandleResourceDidFinishLoading: (NSURLHandle*)sender;
#endif

@end

/**
 * Delegates should implement this method in order to be informed of
 * the success or failure of an XMLRPC method call which was initiated
 * by the -sendMethodCall:params:timeout: method.<br />
 */
@interface	GSXMLRPC (Delegate)

/** <override-dummy />
 * Called by the sender when an XMLRPC method call completes (either success
 * or failure). 
 * The delegate may then call the -result method to retrieve the result of
 * the method call from the sender.
 */
- (void) completedXMLRPC: (GSXMLRPC*)sender;
@end

#if	defined(__cplusplus)
}
#endif

#endif	/* OS_API_VERSION(GS_API_NONE,GS_API_NONE) */

#endif /* __GSXML_h_GNUSTEP_BASE_INCLUDE */