[xiph-commits] r8313 - in trunk/oggdsf/src: lib/codecs/cmml/libCMMLTags lib/codecs/cmml/libWinCMMLParse tests/testCMMLParser

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Tue Nov 30 07:24:03 PST 2004


Author: illiminable
Date: 2004-11-30 07:24:02 -0800 (Tue, 30 Nov 2004)
New Revision: 8313

Modified:
   trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp
   trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp
   trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h
   trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
Log:
* Head tag parser no longer validates valid xml which is not cmml.

Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp	2004-11-30 14:01:28 UTC (rev 8312)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp	2004-11-30 15:24:02 UTC (rev 8313)
@@ -36,7 +36,6 @@
 
 C_CMMLRootTag::C_CMMLRootTag(void)
 {
-	
 	mStream = NULL;
 	mHead = new C_HeadTag;
 	mClipList = new C_ClipTagList;

Modified: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp	2004-11-30 14:01:28 UTC (rev 8312)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp	2004-11-30 15:24:02 UTC (rev 8313)
@@ -318,9 +318,9 @@
 	}
 
 	bool retVal		=		(locNum_title == 1)
-						&&	(locNum_base <= 1)
-						&&	(locNum_meta <= 1);
+						&&	(locNum_base <= 1);
 
+
 	SysFreeString(locBStr);
 	if (locAttribMap != NULL)					locAttribMap->Release();
 	if (locNode != NULL)						locNode->Release();
@@ -461,14 +461,18 @@
 	//	MSXML2::IXMLDOMNode* locImageNode = NULL;
 	HRESULT locHR = S_FALSE;
 
+	bool retVal = true;
 	//---------------Attributes-----------------
 	locHR = inImageNode->get_attributes(&locAttribMap);
 	outImage->setId(getNamedAttribValue(L"id", locAttribMap));
 	outImage->setSrc(getNamedAttribValue(L"src", locAttribMap));
+	if (outImage->src() == L"") {
+		retVal = false;
+	}
 	outImage->setAlt(getNamedAttribValue(L"alt", locAttribMap));
 
 	if (locAttribMap != NULL)		locAttribMap->Release();
-	return true;
+	return retVal;
 }
 /*
 bool CMMLParser::parseMetaTag(MSXML2::IXMLDOMNode* inMetaNode, C_MetaTag* outMeta) {
@@ -484,10 +488,9 @@
 
 bool CMMLParser::parseMetaTag(MSXML2::IXMLDOMNode* inMetaNode, C_MetaTag* outMeta) {
 	MSXML2::IXMLDOMNamedNodeMap* locAttribMap = NULL;
-	MSXML2::IXMLDOMNode* locMetaNode = NULL;
 	HRESULT locHR = S_FALSE;
 
-	bool retVal = false;
+	bool retVal = true;
 	//---------------Attributes-----------------
 	locHR = inMetaNode->get_attributes(&locAttribMap);
 
@@ -496,8 +499,14 @@
 	outMeta->setDirn(getNamedAttribValue(L"dir", locAttribMap));
 	outMeta->setName(getNamedAttribValue(L"name", locAttribMap));
 	if (outMeta->name() == L"") {
+		retVal = false;
+	} else {
+		outMeta->setContent(getNamedAttribValue(L"content", locAttribMap));
+		if (outMeta->content() == L"") {
+			retVal = false;
+		}
+	}
 
-	outMeta->setContent(getNamedAttribValue(L"content", locAttribMap));
 	outMeta->setScheme(getNamedAttribValue(L"scheme", locAttribMap));
 	//------------------------------------------
 
@@ -518,26 +527,36 @@
 
 bool CMMLParser::parseAnchorTag(MSXML2::IXMLDOMNode* inAnchorNode, C_AnchorTag* outAnchor) {
 	MSXML2::IXMLDOMNamedNodeMap*		locAttribMap	= NULL;
-	MSXML2::IXMLDOMNode*				locAnchorNode	= NULL;
 	HRESULT								locHR			= S_FALSE;
 	BSTR								locBStr			= NULL;
-	wstring								locAnchorText;
+	wstring								locAnchorText	= L"";
 
+	bool								retVal			= true;
 	//---------------Attributes-----------------
 	locHR = inAnchorNode->get_attributes(&locAttribMap);
+	outAnchor->setId(getNamedAttribValue(L"id", locAttribMap));
+	outAnchor->setLang(getNamedAttribValue(L"lang", locAttribMap));
+	outAnchor->setDirn(getNamedAttribValue(L"dir", locAttribMap));
+	outAnchor->setCls(getNamedAttribValue(L"class", locAttribMap));
 	outAnchor->setHref(getNamedAttribValue(L"href", locAttribMap));
+	if (outAnchor->href() == L"") {
+		retVal = false;
+	}
 	//------------------------------------------
 	//Anchor text
 
 	inAnchorNode->get_text(&locBStr);
 	locAnchorText = locBStr;
+
+	//if (locAnchorText == L"") {
+	//	retVal = false;
+	//}
 	outAnchor->setText(locAnchorText);
 
 	//Cleanup
 	SysFreeString(locBStr);
     if (locAttribMap != NULL)					locAttribMap->Release();
-	if (locAnchorNode != NULL)					locAnchorNode->Release();
-	return true;
+	return retVal;
 }
 
 bool CMMLParser::parseTitleTag(MSXML2::IXMLDOMNode* inTitleNode, C_TitleTag* outTitle) {
@@ -547,9 +566,13 @@
 	HRESULT locHR = S_FALSE;
 
 	//---------------Attributes-----------------
-	//locHR = inTitleNode->get_attributes(&locAttribMap);
-	//None for now.
+	locHR = inTitleNode->get_attributes(&locAttribMap);
+	
+	outTitle->setId(getNamedAttribValue(L"id", locAttribMap));
+	outTitle->setLang(getNamedAttribValue(L"lang", locAttribMap));
+	outTitle->setDirn(getNamedAttribValue(L"dir", locAttribMap));
 	//------------------------------------------
+
 	inTitleNode->get_text(&locBStr);
 	locTitleText = locBStr;
 	outTitle->setText(locTitleText);
@@ -562,14 +585,15 @@
 
 bool CMMLParser::parseDescTag(MSXML2::IXMLDOMNode* inDescNode, C_DescTag* outDesc) {
 	MSXML2::IXMLDOMNamedNodeMap* locAttribMap = NULL;
-	//MSXML2::IXMLDOMNode* locDescNode = NULL;
 	BSTR locBStr = NULL;
 	wstring locDescText;
 	HRESULT locHR = S_FALSE;
 
 	//---------------Attributes-----------------
-	//locHR = inDescNode->get_attributes(&locAttribMap);
-	//None for now.
+	locHR = inDescNode->get_attributes(&locAttribMap);
+	outDesc->setId(getNamedAttribValue(L"id", locAttribMap));
+	outDesc->setLang(getNamedAttribValue(L"lang", locAttribMap));
+	outDesc->setDirn(getNamedAttribValue(L"dir", locAttribMap));
 	//------------------------------------------
 	inDescNode->get_text(&locBStr);
 	locDescText = locBStr;
@@ -580,3 +604,54 @@
 	return true;
 
 }
+
+
+
+
+bool CMMLParser::parseBaseTag(MSXML2::IXMLDOMNode* inBaseNode, C_BaseTag* outBase) {
+	MSXML2::IXMLDOMNamedNodeMap* locAttribMap = NULL;
+	HRESULT locHR = S_FALSE;
+
+	bool retVal = true;
+	//---------------Attributes-----------------
+	locHR = inBaseNode->get_attributes(&locAttribMap);
+	
+	outBase->setId(getNamedAttribValue(L"id", locAttribMap));
+	outBase->setHref(getNamedAttribValue(L"href", locAttribMap));
+	if (outBase->href() == L"") {
+		retVal = false;
+	}
+	//------------------------------------------
+
+	if (locAttribMap != NULL)					locAttribMap->Release();
+	return retVal;
+
+}
+
+
+
+bool CMMLParser::parseParamTag(MSXML2::IXMLDOMNode* inParamNode, C_ParamTag* outParam) {
+	MSXML2::IXMLDOMNamedNodeMap* locAttribMap = NULL;
+	HRESULT locHR = S_FALSE;
+
+	bool retVal = true;
+	//---------------Attributes-----------------
+	locHR = inParamNode->get_attributes(&locAttribMap);
+
+	outParam->setId(getNamedAttribValue(L"id", locAttribMap));
+	outParam->setName(getNamedAttribValue(L"name", locAttribMap));
+	if (outParam->name() == L"") {
+		retVal = false;
+	} else {
+		outParam->setContent(getNamedAttribValue(L"value", locAttribMap));
+		if (outParam->content() == L"") {
+			retVal = false;
+		}
+	}
+
+	
+	//------------------------------------------
+
+	if (locAttribMap != NULL)		locAttribMap->Release();
+	return true;
+}

Modified: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h	2004-11-30 14:01:28 UTC (rev 8312)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.h	2004-11-30 15:24:02 UTC (rev 8313)
@@ -60,6 +60,8 @@
 	bool parseImageTag(MSXML2::IXMLDOMNode* inImageNode, C_ImageTag* outImage);
 	bool parseMetaTag(MSXML2::IXMLDOMNode* inMetaNode, C_MetaTag* outMeta);
 	bool parseDescTag(MSXML2::IXMLDOMNode* inDescNode, C_DescTag* outDesc);
+	bool parseBaseTag(MSXML2::IXMLDOMNode* inBaseNode, C_BaseTag* outBase);
+	bool parseParamTag(MSXML2::IXMLDOMNode* inParamNode, C_ParamTag* outParam);
 
 
 

Modified: trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp	2004-11-30 14:01:28 UTC (rev 8312)
+++ trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp	2004-11-30 15:24:02 UTC (rev 8313)
@@ -19,9 +19,9 @@
 	bool locWasOK = locParser.parseHeadTag(inHeadString, &locHead);
 
 	if (locWasOK) {
-		cout<<"Parsed OK"<<endl<<endl<<locHead.toString()<<endl<<endl;
+		wcout<<"Parsed OK"<<endl<<endl<<locHead.toString()<<endl<<endl;
 	} else {
-		cout<<"*** PARSE FAILED ***"<<endl<<endl;
+		wcout<<"*** PARSE FAILED ***"<<endl<<endl;
 	}
 
 	return locWasOK;



More information about the commits mailing list