ref: refs/heads/SuSE-Code-11-Branch
commit f0d7c3db25514bf8c0cb5c338585870cc2476aee
Author: Michael Andres
Date: Wed Feb 4 17:11:51 2009 +0100
Let xml::ParseDef skip initial comments.
---
zypp/parser/xml/ParseDef.cc | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/zypp/parser/xml/ParseDef.cc b/zypp/parser/xml/ParseDef.cc
index 58b1a8a..04dcdae 100644
--- a/zypp/parser/xml/ParseDef.cc
+++ b/zypp/parser/xml/ParseDef.cc
@@ -241,7 +241,21 @@ namespace zypp
{
if ( reader_r->nodeType() != XML_READER_TYPE_ELEMENT )
{
- ZYPP_THROW( ParseDefValidateException( exstr("Expected ELEMENT", *this, reader_r) ) );
+ if ( reader_r->depth() == 0 )
+ {
+ // on the verry first level we skip any initial whitespace and comments...
+ do {
+ // advance to next node
+ if ( ! reader_r.nextNode() )
+ {
+ ZYPP_THROW( ParseDefValidateException( exstr( "Unexpected EOF ", *this ) ) );
+ }
+ } while( reader_r->nodeType() != XML_READER_TYPE_ELEMENT );
+ }
+ else
+ {
+ ZYPP_THROW( ParseDefValidateException( exstr("Expected ELEMENT", *this, reader_r) ) );
+ }
}
if ( reader_r->name() != _name )
{
@@ -320,6 +334,7 @@ namespace zypp
break;
default:
+ //DBG << exstr("SKIP ", *this, reader_r) << endl;
break;
}
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org