summaryrefslogtreecommitdiff
path: root/ACEXML/common/Attributes.h
blob: 45982ed459e1cd39d3e0470fb99a61afa2f13984 (plain)
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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Attributes.h
 *
 *  $Id$
 *
 *  @author Nanbor Wang <nanbor@cs.wustl.edu>
 */
//=============================================================================

#ifndef _ACEXML_ATTRIBUTES_H_
#define _ACEXML_ATTRIBUTES_H_
#include /**/ "ace/pre.h"

#include "ACEXML/common/ACEXML_Export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ACEXML/common/XML_Types.h"

/**
 * @class ACEXML_Attributes Attributes.h "ACEXML/common/Attributes.h"
 *
 * @brief ACEXML_Attributes defines a collection of attributes of an XML element.
 *
 * This is an abstract class (interface in Java) that defines
 * the API for accessing attributes of an XML entity.
 *
 * This interface allows access to a list of attributes in three different ways:
 *
 * - by attribute index;
 * - by Namespace-qualified name; or
 * - by qualified (prefixed) name.
 *
 * The list will not contain attributes that were declared #IMPLIED
 * but not specified in the start tag. It will also not contain
 * attributes used as Namespace declarations (xmlns*) unless the
 * http://xml.org/sax/features/namespace-prefixes feature is set to
 * true (it is false by default).
 *
 * If the namespace-prefixes feature (see above) is false, access by
 * qualified name may not be available; if the
 * http://xml.org/sax/features/namespaces feature is false, access by
 * Namespace-qualified names may not be available.
 *
 * This interface replaces the now-deprecated SAX1 AttributeList
 * interface, which does not contain Namespace support. In addition to
 * Namespace support, it adds the getIndex methods (below).
 *
 * The order of attributes in the list is unspecified, and will vary
 * from implementation to implementation.
 */
class ACEXML_Export ACEXML_Attributes
{
public:

  /// Destructor.
  virtual ~ACEXML_Attributes (void);

  /**
   * Look up the index of an attribute by XML 1.0 qualified name.
   */
  virtual int getIndex (const ACEXML_Char *qName) = 0;

  /**
   * Look up the index of an attribute by Namespace name.
   */
  virtual int getIndex (const ACEXML_Char *uri,
                        const ACEXML_Char *localPart) = 0;

  /**
   * Return the number of attributes in the list.
   */
  virtual size_t getLength (void) = 0;

  /**
   * Look up an attribute's local name by index.
   */
  virtual const ACEXML_Char *getLocalName (size_t index) = 0;

  /**
   * Look up an attribute's XML 1.0 qualified name by index.
   */
  virtual const ACEXML_Char *getQName (size_t index) = 0;

  /**
   * Look up an attribute's type by index.
   */
  virtual const ACEXML_Char *getType (size_t index) = 0;

  /**
   * Look up an attribute's type by XML 1.0 qualified name.
   */
  virtual const ACEXML_Char *getType (const ACEXML_Char *qName) = 0;

  /**
   * Look up an attribute's type by Namespace name.
   */
  virtual const ACEXML_Char *getType (const ACEXML_Char *uri,
                                      const ACEXML_Char *localPart) = 0;

  /**
   * Look up an attribute's Namespace URI by index.
   */
  virtual const ACEXML_Char *getURI (size_t index) = 0;

  /**
   * Look up an attribute's value by index.
   */
  virtual const ACEXML_Char *getValue (size_t index) = 0;

  /**
   * Look up an attribute's value by XML 1.0 qualified name.
   */
  virtual const ACEXML_Char *getValue (const ACEXML_Char *qName) = 0;

  /**
   * Look up an attribute's value by Namespace name.
   */
  virtual const ACEXML_Char *getValue (const ACEXML_Char *uri,
                                       const ACEXML_Char *localPart) = 0;
};

#include /**/ "ace/post.h"

#endif /* _ACEXML_ ATTRIBUTES_H_ */