[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 1010
Date       : Thu May 11 17:11:21 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/oilfltrs.cpp

Modify to deal with other junk at root of XML file (DTD, etc), I'd written the code anyway so may as well use it


Diff:
Index: Trunk/XaraLX/wxOil/oilfltrs.cpp
===================================================================
--- Trunk/XaraLX/wxOil/oilfltrs.cpp	(revision 1009)
+++ Trunk/XaraLX/wxOil/oilfltrs.cpp	(revision 1010)
@@ -380,14 +380,24 @@
 		xmlDoc*		pDoc = xmlReadFile( pszFile, NULL, 0 );
 		if( NULL != pDoc )
 		{
-			// Scan the root elements for a\some 'filter's
+			// Scan the root elements for FilterConfig element
 			xmlNode* pRootElement = xmlDocGetRootElement( pDoc );
-
-			wxString strName = CXMLUtils::ConvertToWXString(pRootElement->name);
-			if (strName == _T("FilterConfig"))
+			xmlNode* pConfigElem  = NULL;
+			for( xmlNode* pNode = pRootElement; NULL != pNode; pNode = pNode->next )
 			{
-				for( xmlNode* pNode = pRootElement->children; NULL != pNode; pNode = pNode->next )
+				if( XML_ELEMENT_NODE == pNode->type &&
+					0 == strcmp( "FilterConfig", PCSTR(pNode->name) ) )
 				{
+					pConfigElem = pNode;
+					break;
+				}
+			}
+			
+			if( NULL != pConfigElem )
+			{
+				// Scan the elements below FilterConfig for filters
+				for( xmlNode* pNode = pConfigElem->children; NULL != pNode; pNode = pNode->next )
+				{
 					if( XML_ELEMENT_NODE == pNode->type &&
 						0 == strcmp( "Filter", PCSTR(pNode->name) ) )
 					{


Xara