From 6edf35a784c6f9ce1f306b372bdf7da17c1e84a8 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 11 Jul 2004 04:06:59 +0000 Subject: [PATCH] add support for parsing meta tags --- stepmania/src/XmlFile.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/stepmania/src/XmlFile.cpp b/stepmania/src/XmlFile.cpp index 897de4a3c7..d488ab800f 100644 --- a/stepmania/src/XmlFile.cpp +++ b/stepmania/src/XmlFile.cpp @@ -9,6 +9,7 @@ static const TCHAR chXMLTagOpen = '<'; static const TCHAR chXMLTagClose = '>'; +static const TCHAR chXMLTagQuestion = '?'; // used in checking for meta tags: "" static const TCHAR chXMLTagPre = '/'; static const TCHAR chXMLEscape = '\\'; // for value field escape @@ -237,7 +238,7 @@ char* XNode::LoadAttributes( const char* pszAttrs , LPPARSEINFO pi /*= &piDefaul continue; // close tag - if( *xml == chXMLTagClose || *xml == chXMLTagPre ) + if( *xml == chXMLTagClose || *xml == chXMLTagPre || *xml == chXMLTagQuestion ) // wel-formed tag return xml; @@ -348,13 +349,23 @@ char* XNode::Load( const char* pszXml, LPPARSEINFO pi /*= &piDefault*/ ) if( xml == NULL ) return NULL; - // alone tag - if( *xml == chXMLTagPre ) + // alone tag or + if( *xml == chXMLTagPre || *xml == chXMLTagQuestion ) { xml++; if( *xml == chXMLTagClose ) + { // wel-formed tag - return ++xml; + ++xml; + + // UGLY: We want to ignore all XML meta tags. So, since the Node we + // just loaded is a meta tag, then Load ourself again using the rest + // of the file until we reach a non-meta tag. + if( !name.empty() && name[0] == chXMLTagQuestion ) + xml = Load( xml, pi ); + + return xml; + } else { // error: