diff --git a/configure.in b/configure.in index c8aed01..b8493d1 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ TST_DIR=test DOC_DIR=doc m4_define(x_packagename, libxml-cxx) -m4_define(x_major, 0) +m4_define(x_major, 1) m4_define(x_minor, 0) m4_define(x_least, 0) AM_INIT_AUTOMAKE(x_packagename, x_major.x_minor.x_least, [marc@waeckerlin.org]) diff --git a/doc/makefile.am b/doc/makefile.am index 2e6899b..7cad915 100644 --- a/doc/makefile.am +++ b/doc/makefile.am @@ -8,7 +8,7 @@ develdir = ${pkgdatadir}/doc devel_DATA = html/index.html -ALL_SRC = ${top_srcdir}/src/*.[ch]xx ${top_srcdir}/test/*.[ch]xx +ALL_SRC = ${top_srcdir}/*/*.[ch]xx ${top_srcdir}/*/*/*.[ch]xx DIRS = html latex diff --git a/install-64-and-32-bit-linux.sh b/install-64-and-32-bit-linux.sh index 276852e..45d8614 100755 --- a/install-64-and-32-bit-linux.sh +++ b/install-64-and-32-bit-linux.sh @@ -1,8 +1,4 @@ ./bootstrap.sh && \ -./configure && \ -make && \ -sudo make install && \ -make clean && \ LDFLAGS="-L/usr/lib32 -m32" CXXFLAGS="-m32" ./configure \ --libdir=/usr/local/lib32 \ --build=x86_64 \ @@ -16,5 +12,8 @@ make clean && \ --host=i586-mingw32msvc && \ make && \ sudo make install && \ -make clean +make clean && \ +./configure && \ +make check && \ +sudo make install diff --git a/src/xml-cxx/xml.hxx b/src/xml-cxx/xml.hxx index ddc0b68..c6afa8e 100644 --- a/src/xml-cxx/xml.hxx +++ b/src/xml-cxx/xml.hxx @@ -110,6 +110,7 @@ namespace xml { exception(std::string reason) throw(); exception(std::string reason, const Node& t) throw(); ~exception() throw(); + void line(unsigned long line) throw(); const char* what() const throw(); private: std::string _what; @@ -402,7 +403,7 @@ namespace xml { friend class stream_error; Factory(); // not implemented Factory(const Factory&); // not implemented - bool ws(char c) const throw(); + bool ws(char c) throw(); std::auto_ptr read(std::istream& is, const Node& position) throw(wrong_end_tag, wrong_start_tag, tag_expected, type_mismatch, second_slash_in_tag, character_after_slash, @@ -414,6 +415,7 @@ namespace xml { missing_end_tag, attribute_value_not_quoted, access_error, duplicate_attribute); std::auto_ptr _template; + unsigned long _line; }; } diff --git a/src/xml.cxx b/src/xml.cxx index f0844ba..29c5843 100644 --- a/src/xml.cxx +++ b/src/xml.cxx @@ -49,6 +49,11 @@ namespace xml { exception::~exception() throw() { delete _node; } + void exception::line(unsigned long line) throw() { + std::stringstream ss; + ss< node(_template->clone()); node->clear(); Tag res; - try { + while (true) try { res = tag(is, *node); + *node< Factory::read(std::istream& is, const Node& node) @@ -516,8 +529,10 @@ namespace xml { if (!is) throw missing_end_tag(position, is, tag); if (c!='<') do tag.text+=c; while (is && is.get(c) && c!='<'); bool nameRead(false); - for (char last(c); is && is.get(c) && c!='>'; last = c) switch (c) { - case ' ': case '\t': case '\n': case '\r': + for (char last(c); is && is.get(c) && c!='>'; last=c) switch (c) { + case '\n': case '\r': + if (last!='\n'&&last!='\r') ++_line; + case ' ': case '\t': if (!nameRead && tag.name.size()) nameRead=true; break; case '/': @@ -527,14 +542,16 @@ namespace xml { break; case '!': case '?': if (last=='<') { // ' && is && is.get(c)); + tag.type=SPECIAL; return tag; } default: if (tag.type==EMPTY) throw character_after_slash(position, is, tag, c); if (nameRead) { // read attribute std::string attrname(1, c), attrvalue; - while (is && is.get(c) && c!='=' && !ws(c)) attrname+=c; + while (is && is.get(c) && c!='=' && c!='>' && !ws(c)) attrname+=c; while (c!='=' && is && is.get(c) && ws(c)); // skip ws, search '=' if (c=='=') { // get the value while (is && is.get(c) && ws(c)); // skip ws