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