9 #include <util/misc/ioUtil.h> 24 if (!matchLabel(line, begin))
return false;
29 bool encoding =
false;
30 while (matchAttribute(attribute)) {
31 if (attribute.
label() !=
"version") {
32 if (version)
return false;
35 if (attribute.
label() !=
"encoding") {
36 if (encoding)
return false;
42 if (!version)
return false;
43 if (!encoding)
return false;
52 bool XmlXmlTag::matchLabel(
const std::string& line,
int begin)
59 if (
isEnd())
return false;
61 if (
isEnd())
return false;
73 int beginLabel, endLabel;
76 if (
isEnd())
return false;
80 if (
isEnd())
return false;
83 label_ =
string().substr(beginLabel, endLabel - beginLabel);
84 if (label_ !=
"xml") {
95 if (
isEnd())
return false;
98 if (
isEnd())
return false;
104 return attribute.
match(*
this);
void setString(const std::string &string, int cursor=0)
Initialize string and cursor.
Parser for an XML attribute.
int cursor() const
Return the index of the current character.
const std::string & label()
Return label string.
bool match(const std::string &string, int begin)
Attempt to match entire xml tag.
void next()
Advance to the next character.
Utility classes for scientific computation.
bool isEnd() const
Has the cursor reached the end of the string?
const std::string & string() const
Return the associated string.
int c() const
Return the current character.
bool match(const std::string &string, int begin)
Return true if an attribute is found, false otherwise.
void skip()
Skip leading white space, if any.