1 using System;
2 using System.Collections;
3
4
5
6
7
8 namespace System.Xml
9 {
10 public class Attribute
11 {
12 public Attribute(const ustring& namespaceUri_, const ustring& localName_, const ustring& qualifiedName_, const ustring& value_) :
13 namespaceUri(namespaceUri_), localName(localName_), qualifiedName(qualifiedName_), value(value_)
14 {
15 }
16 public const ustring& NamespaceUri() const
17 {
18 return namespaceUri;
19 }
20 public const ustring& LocalName() const
21 {
22 return localName;
23 }
24 public const ustring& QualifiedName() const
25 {
26 return qualifiedName;
27 }
28 public const ustring& Value() const
29 {
30 return value;
31 }
32 private ustring namespaceUri;
33 private ustring localName;
34 private ustring qualifiedName;
35 private ustring value;
36 }
37 public class Attributes
38 {
39 public typedef List<Attribute>.Iterator Iterator;
40 public typedef List<Attribute>.ConstIterator ConstIterator;
41 public List<Attribute>.Iterator Begin()
42 {
43 return attributes.Begin();
44 }
45 public List<Attribute>.Iterator End()
46 {
47 return attributes.End();
48 }
49 public List<Attribute>.ConstIterator Begin() const
50 {
51 return attributes.CBegin();
52 }
53 public List<Attribute>.ConstIterator End() const
54 {
55 return attributes.CEnd();
56 }
57 public List<Attribute>.ConstIterator CBegin() const
58 {
59 return attributes.CBegin();
60 }
61 public List<Attribute>.ConstIterator CEnd() const
62 {
63 return attributes.CEnd();
64 }
65 public long Count() const
66 {
67 return attributes.Count();
68 }
69 public void Add(const Attribute& attribute)
70 {
71 attributes.Add(attribute);
72 }
73 public void Clear()
74 {
75 attributes.Clear();
76 }
77 public const ustring* GetAttributeValue(const ustring& namespaceUri, const ustring& localName) const
78 {
79 for (const Attribute& attribute : attributes)
80 {
81 if (attribute.NamespaceUri() == namespaceUri && attribute.LocalName() == localName)
82 {
83 const ustring& value = attribute.Value();
84 return &value;
85 }
86 }
87 return null;
88 }
89 public const ustring* GetAttributeValue(const ustring& qualifiedName) const
90 {
91 for (const Attribute& attribute : attributes)
92 {
93 if (attribute.QualifiedName() == qualifiedName)
94 {
95 const ustring& value = attribute.Value();
96 return &value;
97 }
98 }
99 return null;
100 }
101 private List<Attribute> attributes;
102 }
103 public class XmlContentHandler
104 {
105 public virtual ~XmlContentHandler()
106 {
107 }
108 public virtual void StartDocument()
109 {
110 }
111 public virtual void EndDocument()
112 {
113 }
114 public virtual void Version(const ustring& xmlVersion)
115 {
116 }
117 public virtual void Standalone(bool standalone)
118 {
119 }
120 public virtual void Encoding(const ustring& encoding)
121 {
122 }
123 public virtual void HandleText(const ustring& text)
124 {
125 }
126 public virtual void HandleComment(const ustring& comment)
127 {
128 }
129 public virtual void HandlePI(const ustring& target, const ustring& data)
130 {
131 }
132 public virtual void HandleCDataSection(const ustring& cdata)
133 {
134 }
135 public virtual void StartElement(const ustring& namespaceUri, const ustring& localName, const ustring& qualifiedName, const Attributes& attributes)
136 {
137 }
138 public virtual void EndElement(const ustring& namespaceUri, const ustring& localName, const ustring& qualifiedName)
139 {
140 }
141 public virtual void SkippedEntity(const ustring& entityName)
142 {
143 }
144 }
145 }