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") {
92 bool XmlXmlTag::matchAttribute(XmlAttribute& attribute)
95 if (
isEnd())
return false;
98 if (
isEnd())
return false;
104 return attribute.match(*
this);
Parser for an XML attribute.
const std::string & label()
Return label string.
void skip()
Skip leading white space, if any.
const std::string & string() const
Return the associated string.
void next()
Advance to the next character.
int cursor() const
Return the index of the current character.
void setString(const std::string &string, int cursor=0)
Initialize string and cursor.
int c() const
Return the current character.
bool isEnd() const
Has the cursor reached the end of the string?
bool match(const std::string &string, int begin)
Attempt to match entire xml tag.
Utility classes for scientific computation.