summaryrefslogtreecommitdiff
path: root/oox/source/mathml
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-11-29 19:54:54 +0100
committerLuboš Luňák <l.lunak@suse.cz>2011-11-29 21:20:27 +0100
commit5c897753a6cc16f1b9b8c51721cb93e80b3bfc01 (patch)
tree438e68a54eff6babdd66862121f8a8b92bbb7bc2 /oox/source/mathml
parentf92bb660961a3f2dee392eac214bdd568ba2ea52 (diff)
better debug output when skipping an element
Diffstat (limited to 'oox/source/mathml')
-rw-r--r--oox/source/mathml/importutils.cxx19
1 files changed, 15 insertions, 4 deletions
diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx
index 703e96b8752d..912f0f65be1c 100644
--- a/oox/source/mathml/importutils.cxx
+++ b/oox/source/mathml/importutils.cxx
@@ -229,7 +229,7 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional )
if( optional )
{ // avoid printing debug messages about skipping tags if the optional one
// will not be found and the position will be reset back
- if( currentToken() != token && !recoverAndFindTagHelper( token, true ))
+ if( currentToken() != token && !recoverAndFindTagInternal( token, true ))
{
pos = savedPos;
return Tag();
@@ -253,10 +253,10 @@ XmlStream::Tag XmlStream::checkTag( int token, bool optional )
bool XmlStream::recoverAndFindTag( int token )
{
- return recoverAndFindTagHelper( token, false );
+ return recoverAndFindTagInternal( token, false );
}
-bool XmlStream::recoverAndFindTagHelper( int token, bool silent )
+bool XmlStream::recoverAndFindTagInternal( int token, bool silent )
{
int depth = 0;
for(;
@@ -305,15 +305,25 @@ bool XmlStream::recoverAndFindTagHelper( int token, bool silent )
void XmlStream::skipElement( int token )
{
+ return skipElementInternal( token, true ); // no debug about skipping if called from outside
+}
+
+void XmlStream::skipElementInternal( int token, bool silent )
+{
int closing = ( token & ~TAG_OPENING ) | TAG_CLOSING; // make it a closing tag
assert( currentToken() == OPENING( token ));
+ if( !silent )
+ fprintf( stderr, "Skipping unexpected element %s\n", CSTR( tokenToString( currentToken())));
moveToNextTag();
// and just find the matching closing tag
if( recoverAndFindTag( closing ))
{
+ if( !silent )
+ fprintf( stderr, "Skipped unexpected element %s\n", CSTR( tokenToString( token )));
moveToNextTag(); // and skip it too
return;
}
+ // this one is an unexpected problem, do not silent it
fprintf( stderr, "Expected end of element %s not found.\n", CSTR( tokenToString( token )));
}
@@ -323,10 +333,11 @@ void XmlStream::handleUnexpectedTag()
return;
if( currentToken() == CLOSING( currentToken()))
{
+ fprintf( stderr, "Skipping unexpected tag %s\n", CSTR( tokenToString( currentToken())));
moveToNextTag(); // just skip it
return;
}
- skipElement( currentToken()); // otherwise skip the entire element
+ skipElementInternal( currentToken(), false ); // otherwise skip the entire element
}