Accept but ignore special tags: <!, <?; Start of class UnsingedInteger; success: make distcheck
This commit is contained in:
@@ -46,12 +46,13 @@ namespace xml {
|
||||
iterator _active;
|
||||
};
|
||||
typedef Attributes::Value Attr;
|
||||
enum NodeType {START, END, EMPTY};
|
||||
enum NodeType {START, END, EMPTY, SPECIAL};
|
||||
struct Tag {
|
||||
std::string name;
|
||||
NodeType type;
|
||||
std::string text;
|
||||
Attributes attributes;
|
||||
std::string special;
|
||||
};
|
||||
const bool mandatory = true;
|
||||
const bool optional = false;
|
||||
@@ -82,6 +83,13 @@ namespace xml {
|
||||
exception("tag ('<') expected, text not allowed\ntext: "+txt, t) {}
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
class type_mismatch: public exception {
|
||||
public:
|
||||
type_mismatch(const Node& t, const std::string& txt) throw():
|
||||
exception("wrong type, text contains mismatching character\ntext: "
|
||||
+txt, t) {}
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
class access_error: public exception {
|
||||
public:
|
||||
access_error(const Node& t, const std::string& name) throw();
|
||||
@@ -204,7 +212,8 @@ namespace xml {
|
||||
virtual std::ostream& out(std::ostream& o, unsigned int level=0) const
|
||||
throw();
|
||||
virtual std::string text() const throw();
|
||||
virtual Node& text(const std::string& txt) throw(tag_expected);
|
||||
virtual Node& text(const std::string& txt) throw(tag_expected,
|
||||
type_mismatch);
|
||||
virtual Node& append(const Node& o) throw(cannot_have_children);
|
||||
virtual Node& set(const Attributes& o) throw();
|
||||
Node& clear() throw ();
|
||||
@@ -230,7 +239,8 @@ namespace xml {
|
||||
//! Get the first named child.
|
||||
Node& operator[](const std::string& child) throw(access_error);
|
||||
std::string operator*() const throw();
|
||||
Node& operator=(const std::string& contents) throw(tag_expected);
|
||||
Node& operator=(const std::string& contents) throw(tag_expected,
|
||||
type_mismatch);
|
||||
friend std::ostream& operator<<(std::ostream& o, const Node& t) throw();
|
||||
protected:
|
||||
Attributes _attributes;
|
||||
@@ -250,7 +260,25 @@ namespace xml {
|
||||
virtual std::auto_ptr<Node> clone() const throw();
|
||||
virtual ~String() throw() {}
|
||||
virtual std::string text() const throw();
|
||||
virtual String& text(const std::string& txt) throw(tag_expected);
|
||||
virtual String& text(const std::string& txt) throw(tag_expected,
|
||||
type_mismatch);
|
||||
virtual std::ostream& out(std::ostream& o, unsigned int level=0) const
|
||||
throw();
|
||||
virtual String& append(const Node& o) throw(cannot_have_children);
|
||||
Node& operator=(const std::string& contents) throw();
|
||||
private:
|
||||
std::string _text;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class UnsignedInteger: public Node {
|
||||
public:
|
||||
String(std::string name, const std::string& text = std::string()) throw();
|
||||
virtual std::auto_ptr<Node> clone() const throw();
|
||||
virtual ~String() throw() {}
|
||||
virtual std::string text() const throw();
|
||||
virtual String& text(const std::string& txt) throw(tag_expected,
|
||||
type_mismatch);
|
||||
virtual std::ostream& out(std::ostream& o, unsigned int level=0) const
|
||||
throw();
|
||||
virtual String& append(const Node& o) throw(cannot_have_children);
|
||||
@@ -268,7 +296,7 @@ namespace xml {
|
||||
Factory(const Node& t) throw();
|
||||
const Node& operator*() const throw();
|
||||
std::auto_ptr<Node> read(std::istream& is)
|
||||
throw(wrong_end_tag, wrong_start_tag, tag_expected,
|
||||
throw(wrong_end_tag, wrong_start_tag, tag_expected, type_mismatch,
|
||||
second_slash_in_tag, character_after_slash,
|
||||
missing_end_tag, attribute_value_not_quoted, access_error,
|
||||
empty_stream, duplicate_attribute, attributes_in_end_tag);
|
||||
@@ -278,7 +306,7 @@ namespace xml {
|
||||
Factory(const Factory&); // not implemented
|
||||
bool ws(char c) const throw();
|
||||
std::auto_ptr<Node> read(std::istream& is, const Node& position)
|
||||
throw(wrong_end_tag, wrong_start_tag, tag_expected,
|
||||
throw(wrong_end_tag, wrong_start_tag, tag_expected, type_mismatch,
|
||||
second_slash_in_tag, character_after_slash,
|
||||
missing_end_tag,
|
||||
attribute_value_not_quoted, access_error, duplicate_attribute,
|
||||
|
Reference in New Issue
Block a user