messagingappbase/smilparser/SMILdtd/tsrc/t_ScriptRunner.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Parsing and Processing of script commands, to test the
       
    15 // SMIL DOM classes.
       
    16 // 
       
    17 //
       
    18 
       
    19 
       
    20 #include "t_ScriptRunner.h"
       
    21 
       
    22 
       
    23 _LIT(KLogFileName, "c:\\MsgTest\\SMIL_DOM\\SmilDomLog.txt");
       
    24 
       
    25 
       
    26 // Script Commands
       
    27 _LIT(KCreateDOMtree, "createdomtree");
       
    28 _LIT(KDeleteDOMtree, "deletedomtree");
       
    29 _LIT(KCreate,        "create");
       
    30 _LIT(KDeleteChild,   "deletechild");
       
    31 _LIT(KParent,        "parent");
       
    32 _LIT(KRootSmil,      "rootsmil");
       
    33 _LIT(KFirstChild,    "firstchild");
       
    34 _LIT(KLastChild,     "lastchild");
       
    35 _LIT(KNextSibling,   "nextsibling");
       
    36 _LIT(KPrevSibling,   "prevsibling");
       
    37 _LIT(KFirst,         "first");
       
    38 _LIT(KLast,          "last");
       
    39 _LIT(KNext,          "next");
       
    40 _LIT(KPrev,          "prev");
       
    41 _LIT(KSetAtt,        "setatt");
       
    42 _LIT(KGetAtt,        "getatt");
       
    43 _LIT(KUnsetAtt,      "unsetatt");
       
    44 _LIT(KLegalChildren, "legalchildren");
       
    45 _LIT(KSetId,         "setid");
       
    46 _LIT(KGetId,         "getid");
       
    47 _LIT(KRemoveId,      "removeid");
       
    48 
       
    49 
       
    50 // Script Command Arguments: SMIL Elements (excluding 'smil')
       
    51 _LIT(KA,           "a");
       
    52 _LIT(KAnchor,      "anchor");
       
    53 _LIT(KAnimation,   "animation");
       
    54 _LIT(KArea,        "area");
       
    55 _LIT(KAudio,       "audio");
       
    56 _LIT(KBody,        "body");
       
    57 _LIT(KHead,        "head");
       
    58 _LIT(KImg,         "img");
       
    59 _LIT(KLayout,      "layout");
       
    60 _LIT(KMeta,        "meta");
       
    61 _LIT(KPar,         "par");
       
    62 _LIT(KRef,         "ref");
       
    63 _LIT(KRegion,      "region");
       
    64 _LIT(KRoot_layout, "root-layout");
       
    65 _LIT(KSeq,         "seq");
       
    66 _LIT(KSwitch,      "switch");
       
    67 _LIT(KText,        "text");
       
    68 _LIT(KTextstream,  "textstream");
       
    69 _LIT(KVideo,       "video");
       
    70 
       
    71 
       
    72 // Other Script Command Arguments
       
    73 _LIT(KAppend,      "append");
       
    74 _LIT(KInsert,      "insert");
       
    75 _LIT(KReplace,     "replace");
       
    76 
       
    77 
       
    78 // Errors reported via the log file
       
    79 _LIT(KNotSupported,                      "Not supported.");
       
    80 _LIT(KInvalidChild,                      "Invalid child.");
       
    81 _LIT(KCannotFindSpecifiedChild,          "Cannot find specified child.");
       
    82 _LIT(KReachedEnd_ElementInsertedAtStart, "Reached end of child list, element inserted at start of list.");
       
    83 _LIT(KReachedEnd_NoChildReplaced,        "Reached end of child list, no child has been replaced.");
       
    84 _LIT(KReachedEnd_NoChildRemoved,         "Reached end of child list, no child has been removed.");
       
    85 _LIT(KAlreadyAtEndOfList,                "Already at end of list.");
       
    86 _LIT(KInvalidArgument,                   "Invalid argument.");
       
    87 _LIT(KAttributeNotSet,                   "Attribute not set.");
       
    88 _LIT(KElementHasLegalChildren,           "Element has legal children.");
       
    89 _LIT(KElementHasIllegalChildren,         "Element has illegal children.");
       
    90 _LIT(KUnrecognisedCommand,               "Unrecognised command.");
       
    91 _LIT(KUnrecognisedArgument,              "Unrecognised argument.");
       
    92 _LIT(KUnrecognisedElementType,           "Unrecognised element type.");
       
    93 _LIT(KNotABasicElt,                      "Error: Current element is not a BasicElt.");
       
    94 _LIT(KNotOfSpecifiedType,                "Error: Current element is not of the specified type.");
       
    95 
       
    96 //
       
    97 //
       
    98 // CScriptRunner
       
    99 //
       
   100 
       
   101 CScriptRunner* CScriptRunner::NewL()
       
   102 	{
       
   103 	CScriptRunner* self = new (ELeave) CScriptRunner();
       
   104 	CleanupStack::PushL(self);
       
   105 	self->ConstructL();
       
   106 	CleanupStack::Pop();
       
   107 	return self;
       
   108 	}
       
   109 
       
   110 
       
   111 CScriptRunner::~CScriptRunner()
       
   112 	{
       
   113 	delete iArgumentList;
       
   114 	delete iCurrentCommand;
       
   115 	delete iWriter;
       
   116 	delete iDOMtreeRoot; // This will delete the entire DOM tree
       
   117 	}
       
   118 
       
   119 
       
   120 CScriptRunner::CScriptRunner()
       
   121 : iCurrentCommand(NULL), iCurrentElement(NULL), iDOMtreeRoot(NULL)
       
   122 	{
       
   123 	}
       
   124 
       
   125 
       
   126 void CScriptRunner::ConstructL()
       
   127 	{
       
   128 	iArgumentList = new (ELeave) CDesCArrayFlat(3);
       
   129 	iWriter = CTestDataWriter::NewL(KLogFileName);
       
   130 	}
       
   131 
       
   132 
       
   133 // Extract the command, and any arguments, from the given string
       
   134 void CScriptRunner::ParseL(const TDesC& aCommand)
       
   135 	{
       
   136 	// First, echo the command line to the log file
       
   137 	iWriter->WriteTest(aCommand);
       
   138 
       
   139 	iArgumentList->Reset();
       
   140 	delete iCurrentCommand;
       
   141 	iCurrentCommand = NULL;
       
   142 
       
   143 	// Determine whether aCommand is a command, or a comment
       
   144 	if (aCommand.Length() >= 2  &&  aCommand[0] == '/'  &&  aCommand[1] == '/')
       
   145 		{
       
   146 		// This is a comment
       
   147 		iCurrentCommand = NULL;
       
   148 		}
       
   149 	else // Extract the command, and any arguments
       
   150 		{
       
   151 		TInt commandIter = 0;
       
   152 		TInt commandStart = 0;
       
   153 		TBool inQuotes = EFalse;
       
   154 		while (commandIter <= aCommand.Length())
       
   155 			{
       
   156 			TBool commandFound = EFalse;
       
   157 
       
   158 			if (commandIter < aCommand.Length())
       
   159 				{
       
   160 				if (aCommand[commandIter] == '"')
       
   161 					{
       
   162 					// We assume that quotes only occur at the beginning and end
       
   163 					// of arguments. Hence, if we've just found a new quote, we should
       
   164 					// not make it part of the argument.
       
   165 					if (!inQuotes)
       
   166 						{
       
   167 						inQuotes = ETrue;
       
   168 						commandStart++;
       
   169 						}
       
   170 					else
       
   171 						{
       
   172 						// Assume we've got to the end of the argument, and skip the
       
   173 						// following space.
       
   174 						commandFound = ETrue;
       
   175 						commandIter++;
       
   176 						}
       
   177 					}
       
   178 				else if ((aCommand[commandIter] == ' ') && (!inQuotes))
       
   179 					{
       
   180 					commandFound = ETrue;
       
   181 					}
       
   182 				}
       
   183 			else
       
   184 				{
       
   185 				commandFound = ETrue;
       
   186 				}
       
   187 
       
   188 			if (commandFound)
       
   189 				{
       
   190 				if (commandIter > commandStart)
       
   191 					{
       
   192 					// Command or argument found
       
   193 					TInt commandLength = commandIter - commandStart;
       
   194 
       
   195 					// If the argument ended in quotes, modify the length to exclude them
       
   196 					if (inQuotes)
       
   197 						{
       
   198 						inQuotes = EFalse;
       
   199 						commandLength--;
       
   200 						}
       
   201 
       
   202 					if (iCurrentCommand == NULL)
       
   203 						{
       
   204 						// This is a command
       
   205 						iCurrentCommand = HBufC::NewL(commandLength);
       
   206 						(*iCurrentCommand) = aCommand.Mid(commandStart, commandLength);
       
   207 						}
       
   208 					else
       
   209 						{
       
   210 						// This is a command argument
       
   211 						iArgumentList->AppendL(aCommand.Mid(commandStart, commandLength));
       
   212 						}
       
   213 
       
   214 					// Set the start of the next argument
       
   215 					commandStart = commandIter + 1;
       
   216 					}
       
   217 				}
       
   218 
       
   219 			commandIter++;
       
   220 			}
       
   221 		}
       
   222 
       
   223 	if (iCurrentCommand != NULL)
       
   224 		{
       
   225 		// Process the command
       
   226 		ProcessL();
       
   227 		}
       
   228 	}
       
   229 
       
   230 
       
   231 // Process the script command
       
   232 void CScriptRunner::ProcessL()
       
   233 	{
       
   234 	if (iCurrentCommand->Compare(KCreateDOMtree) == 0)
       
   235 		{
       
   236 		// Create a new DOM tree (document + smil) & make the smil the current element.
       
   237 		// Command: createdomtree
       
   238 
       
   239 		iDOMtreeRoot = CMDXMLSMILDocument::NewL();
       
   240 		CMDXMLSMILsmil* smilElement = CMDXMLSMILsmil::NewL(iDOMtreeRoot);
       
   241 
       
   242 		// The 'document' takes ownership of the 'smil' element
       
   243 		CMDXMLElement* documentElement = iDOMtreeRoot->DocumentElement();
       
   244 		documentElement->AppendChild(smilElement);
       
   245 		iCurrentElement = smilElement;
       
   246 		}
       
   247 	else if (iCurrentCommand->Compare(KDeleteDOMtree) == 0)
       
   248 		{
       
   249 		// Delete the DOM tree
       
   250 		// Command: deletedomtree
       
   251 
       
   252 		delete iDOMtreeRoot; // This will delete the entire DOM tree
       
   253 		iDOMtreeRoot = NULL;
       
   254 		iCurrentElement = NULL;
       
   255 		}
       
   256 	else if (iCurrentCommand->Compare(KCreate) == 0)
       
   257 		{
       
   258 		CMDXMLElement* newElement = NULL;
       
   259 
       
   260 		// Determine element type to create
       
   261 		if ((*iArgumentList)[0].Compare(KA) == 0)
       
   262 			{
       
   263 			newElement = CMDXMLSMILa::NewL(iDOMtreeRoot);
       
   264 			}
       
   265 		else if ((*iArgumentList)[0].Compare(KAnchor) == 0)
       
   266 			{
       
   267 			newElement = CMDXMLSMILanchor::NewL(iDOMtreeRoot);
       
   268 			}
       
   269 		else if ((*iArgumentList)[0].Compare(KAnimation) == 0)
       
   270 			{
       
   271 			newElement = CMDXMLSMILanimation::NewL(iDOMtreeRoot);
       
   272 			}
       
   273 		else if ((*iArgumentList)[0].Compare(KArea) == 0)
       
   274 			{
       
   275 			newElement = CMDXMLSMILarea::NewL(iDOMtreeRoot);
       
   276 			}
       
   277 		else if ((*iArgumentList)[0].Compare(KAudio) == 0)
       
   278 			{
       
   279 			newElement = CMDXMLSMILaudio::NewL(iDOMtreeRoot);
       
   280 			}
       
   281 		else if ((*iArgumentList)[0].Compare(KBody) == 0)
       
   282 			{
       
   283 			newElement = CMDXMLSMILbody::NewL(iDOMtreeRoot);
       
   284 			}
       
   285 		else if ((*iArgumentList)[0].Compare(KHead) == 0)
       
   286 			{
       
   287 			newElement = CMDXMLSMILhead::NewL(iDOMtreeRoot);
       
   288 			}
       
   289 		else if ((*iArgumentList)[0].Compare(KImg) == 0)
       
   290 			{
       
   291 			newElement = CMDXMLSMILimg::NewL(iDOMtreeRoot);
       
   292 			}
       
   293 		else if ((*iArgumentList)[0].Compare(KLayout) == 0)
       
   294 			{
       
   295 			newElement = CMDXMLSMILlayout::NewL(iDOMtreeRoot);
       
   296 			}
       
   297 		else if ((*iArgumentList)[0].Compare(KMeta) == 0)
       
   298 			{
       
   299 			newElement = CMDXMLSMILmeta::NewL(iDOMtreeRoot);
       
   300 			}
       
   301 		else if ((*iArgumentList)[0].Compare(KPar) == 0)
       
   302 			{
       
   303 			newElement = CMDXMLSMILpar::NewL(iDOMtreeRoot);
       
   304 			}
       
   305 		else if ((*iArgumentList)[0].Compare(KRef) == 0)
       
   306 			{
       
   307 			newElement = CMDXMLSMILref::NewL(iDOMtreeRoot);
       
   308 			}
       
   309 		else if ((*iArgumentList)[0].Compare(KRegion) == 0)
       
   310 			{
       
   311 			newElement = CMDXMLSMILregion::NewL(iDOMtreeRoot);
       
   312 			}
       
   313 		else if ((*iArgumentList)[0].Compare(KRoot_layout) == 0)
       
   314 			{
       
   315 			newElement = CMDXMLSMILroot_layout::NewL(iDOMtreeRoot);
       
   316 			}
       
   317 		else if ((*iArgumentList)[0].Compare(KSeq) == 0)
       
   318 			{
       
   319 			newElement = CMDXMLSMILseq::NewL(iDOMtreeRoot);
       
   320 			}
       
   321 		else if ((*iArgumentList)[0].Compare(KSwitch) == 0)
       
   322 			{
       
   323 			newElement = CMDXMLSMILswitch::NewL(iDOMtreeRoot);
       
   324 			}
       
   325 		else if ((*iArgumentList)[0].Compare(KText) == 0)
       
   326 			{
       
   327 			newElement = CMDXMLSMILtext::NewL(iDOMtreeRoot);
       
   328 			}
       
   329 		else if ((*iArgumentList)[0].Compare(KTextstream) == 0)
       
   330 			{
       
   331 			newElement = CMDXMLSMILtextstream::NewL(iDOMtreeRoot);
       
   332 			}
       
   333 		else if ((*iArgumentList)[0].Compare(KVideo) == 0)
       
   334 			{
       
   335 			newElement = CMDXMLSMILvideo::NewL(iDOMtreeRoot);
       
   336 			}
       
   337 		else  // Unrecognised element type
       
   338 			{
       
   339 			iWriter->WriteTest(KUnrecognisedElementType);
       
   340 			}
       
   341 
       
   342 
       
   343 		if ((*iArgumentList)[1].Compare(KAppend) == 0)
       
   344 			{
       
   345 			// Create an element of a specified type, and add it to the end of the current
       
   346 			// element’s child list.
       
   347 			// Command: create <element type> append
       
   348 
       
   349 			TInt err = iCurrentElement->AppendChild(newElement);
       
   350 			if (err != KErrNone)
       
   351 				{
       
   352 				delete newElement; // Ownership was not taken
       
   353 				if (err == KErrNotSupported)
       
   354 					{
       
   355 					iWriter->WriteTest(KNotSupported);
       
   356 					}
       
   357 				else if (err == KErrXMLInvalidChild)
       
   358 					{
       
   359 					iWriter->WriteTest(KInvalidChild);
       
   360 					}
       
   361 				}
       
   362 			}
       
   363 		else if ((*iArgumentList)[1].Compare(KInsert) == 0)
       
   364 			{
       
   365 			// Create an element of a specified type, and insert it at a numerically defined
       
   366 			// position in the current element’s child list.
       
   367 			// Command: create <element type> insert n
       
   368 			// Use n = -3 for start of list (specified with NULL parameter),
       
   369 			// and no element to insert.
       
   370 			// Use n = -2 for start of list (specified with pointer to first child),
       
   371 			// and no element to insert.
       
   372 			// Use n = -1 for invalid pointer specifying place to insert.
       
   373 			// Use n = 0 for start of list (specified with NULL parameter)
       
   374 			// Use n = 1 for start of list (specified with pointer to first child)
       
   375 			// Then n = 2 for second child etc.
       
   376 
       
   377 			// Convert the final argument to an integer
       
   378 			TLex lex = (*iArgumentList)[2];
       
   379 			TInt position;
       
   380 			lex.Val(position);
       
   381 
       
   382 			CMDXMLNode* insertBeforeChild = NULL;
       
   383 
       
   384 			if (position == -3)
       
   385 				{
       
   386 				insertBeforeChild = NULL; // One way of specifying start of list
       
   387 				delete newElement;
       
   388 				newElement = NULL;
       
   389 				}
       
   390 			else if (position == -2)
       
   391 				{
       
   392 				insertBeforeChild = iCurrentElement->FirstChild();
       
   393 				delete newElement;
       
   394 				newElement = NULL;
       
   395 				}
       
   396 			else if (position == -1)
       
   397 				{
       
   398 				insertBeforeChild = iCurrentElement; // Invalid pointer - not a child
       
   399 				}
       
   400 			else if (position == 0)
       
   401 				{
       
   402 				insertBeforeChild = NULL; // One way of specifying start of list
       
   403 				}
       
   404 			else if (position > 0)
       
   405 				{
       
   406 				insertBeforeChild = iCurrentElement->FirstChild();
       
   407 
       
   408 				while (position-- > 1  &&  insertBeforeChild != NULL)
       
   409 					{
       
   410 					insertBeforeChild = insertBeforeChild->NextSibling();
       
   411 					}
       
   412 
       
   413 				if (insertBeforeChild == NULL)
       
   414 					{
       
   415 					iWriter->WriteTest(KReachedEnd_ElementInsertedAtStart);
       
   416 					}
       
   417 				}
       
   418 
       
   419 			TInt err = iCurrentElement->InsertBefore(insertBeforeChild, newElement);
       
   420 			if (err != KErrNone)
       
   421 				{
       
   422 				delete newElement; // Ownership was not taken
       
   423 				if (err == KErrNotSupported)
       
   424 					{
       
   425 					iWriter->WriteTest(KNotSupported);
       
   426 					}
       
   427 				else if (err == KErrXMLInvalidChild)
       
   428 					{
       
   429 					iWriter->WriteTest(KInvalidChild);
       
   430 					}
       
   431 				else if (err == KErrNotFound)
       
   432 					{
       
   433 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   434 					}
       
   435 				}
       
   436 			}
       
   437 		else if ((*iArgumentList)[1].Compare(KReplace) == 0)
       
   438 			{
       
   439 			// Create an element of a specified type and use it to replace a numerically defined
       
   440 			// child element in the current element’s child list. Delete the old child.
       
   441 			// Command: create <element type> replace n
       
   442 			// Use n = -2 for start of list, and no element to insert.
       
   443 			// Use n = -1 for invalid pointer specifying child to replace.
       
   444 			// Use n = 0 for NULL, in place of pointer to child to replace.
       
   445 			// Use n = 1 for start of list
       
   446 			// Then n = 2 for second child etc.
       
   447 
       
   448 			// Convert the final argument to an integer
       
   449 			TLex lex = (*iArgumentList)[2];
       
   450 			TInt position;
       
   451 			lex.Val(position);
       
   452 
       
   453 			CMDXMLNode* childToReplace = NULL;
       
   454 
       
   455 			if (position == -2)
       
   456 				{
       
   457 				childToReplace = iCurrentElement->FirstChild();
       
   458 				delete newElement;
       
   459 				newElement = NULL;
       
   460 				}
       
   461 			else if (position == -1)
       
   462 				{
       
   463 				childToReplace = iCurrentElement; // Invalid pointer - not a child
       
   464 				}
       
   465 			else if (position == 0)
       
   466 				{
       
   467 				childToReplace = NULL; // Invalid
       
   468 				}
       
   469 			else if (position > 0)
       
   470 				{
       
   471 				childToReplace = iCurrentElement->FirstChild();
       
   472 
       
   473 				while (position-- > 1  &&  childToReplace != NULL)
       
   474 					{
       
   475 					childToReplace = childToReplace->NextSibling();
       
   476 					}
       
   477 
       
   478 				if (childToReplace == NULL)
       
   479 					{
       
   480 					iWriter->WriteTest(KReachedEnd_NoChildReplaced);
       
   481 					}
       
   482 				}
       
   483 
       
   484 			TInt err = iCurrentElement->ReplaceChild(newElement, childToReplace);
       
   485 			if (err != KErrNone)
       
   486 				{
       
   487 				delete newElement; // Ownership was not taken
       
   488 				if (err == KErrNotSupported)
       
   489 					{
       
   490 					iWriter->WriteTest(KNotSupported);
       
   491 					}
       
   492 				else if (err == KErrXMLInvalidChild)
       
   493 					{
       
   494 					iWriter->WriteTest(KInvalidChild);
       
   495 					}
       
   496 				else if (err == KErrNotFound)
       
   497 					{
       
   498 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   499 					}
       
   500 				}
       
   501 			else // Replace operation was successful
       
   502 				{
       
   503 				delete childToReplace;
       
   504 				}
       
   505 			}
       
   506 		else  // Unrecognised argument
       
   507 			{
       
   508 			iWriter->WriteTest(KUnrecognisedArgument);
       
   509 			}
       
   510 		}
       
   511 	else if (iCurrentCommand->Compare(KDeleteChild) == 0)
       
   512 		{
       
   513 		// Remove a child element, defined by a numeric position, in the current element’s
       
   514 		// list of children. Then delete it.
       
   515 		// Command: deletechild n
       
   516 		// Use n = -1 for invalid pointer specifying child to remove.
       
   517 		// Use n = 0 for NULL, in place of pointer to child to remove.
       
   518 		// Use n = 1 for start of list
       
   519 		// Then n = 2 for second child etc.
       
   520 
       
   521 		// Convert the argument to an integer
       
   522 		TLex lex = (*iArgumentList)[0];
       
   523 		TInt position;
       
   524 		lex.Val(position);
       
   525 
       
   526 		CMDXMLNode* childToRemove = NULL;
       
   527 
       
   528 		if (position == -1)
       
   529 			{
       
   530 			childToRemove = iCurrentElement; // Invalid pointer - not a child
       
   531 			}
       
   532 		else if (position == 0)
       
   533 			{
       
   534 			childToRemove = NULL; // Invalid
       
   535 			}
       
   536 		else if (position > 0)
       
   537 			{
       
   538 			childToRemove = iCurrentElement->FirstChild();
       
   539 
       
   540 			while (position-- > 1  &&  childToRemove != NULL)
       
   541 				{
       
   542 				childToRemove = childToRemove->NextSibling();
       
   543 				}
       
   544 
       
   545 			if (childToRemove == NULL)
       
   546 				{
       
   547 				iWriter->WriteTest(KReachedEnd_NoChildRemoved);
       
   548 				}
       
   549 			}
       
   550 
       
   551 		TInt err = iCurrentElement->RemoveChild(childToRemove);
       
   552 		if (err != KErrNone)
       
   553 			{
       
   554 			if (err == KErrNotSupported)
       
   555 				{
       
   556 				iWriter->WriteTest(KNotSupported);
       
   557 				}
       
   558 			else if (err == KErrXMLInvalidChild)
       
   559 				{
       
   560 				iWriter->WriteTest(KInvalidChild);
       
   561 				}
       
   562 			else if (err == KErrNotFound)
       
   563 				{
       
   564 				iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   565 				}
       
   566 			}
       
   567 		else // Remove operation was successful
       
   568 			{
       
   569 			delete childToRemove;
       
   570 			}
       
   571 		}
       
   572 	else if (iCurrentCommand->Compare(KParent) == 0)
       
   573 		{
       
   574 		// Navigate up the object tree to the current element’s parent.
       
   575 		// Command: parent
       
   576 
       
   577 		CMDXMLNode* parentNode = iCurrentElement->ParentNode();
       
   578 
       
   579 		if (parentNode == NULL || parentNode->NodeName() == KXMLDocumentElementNodeName)
       
   580 			{
       
   581 			iWriter->WriteTest(KAlreadyAtEndOfList);
       
   582 			}
       
   583 		else
       
   584 			{
       
   585 			iCurrentElement = (CMDXMLElement*)parentNode;
       
   586 			}
       
   587 		}
       
   588 	else if (iCurrentCommand->Compare(KRootSmil) == 0)
       
   589 		{
       
   590 		// Navigate to the element at the root of the DOM tree (smil).
       
   591 		// Command: rootsmil
       
   592 
       
   593 		iCurrentElement = (CMDXMLElement*)iDOMtreeRoot->DocumentElement()->FirstChild();
       
   594 		}
       
   595 	else if (iCurrentCommand->Compare(KFirstChild) == 0)
       
   596 		{
       
   597 		// Navigate to the first child of the current element.
       
   598 		// Command: firstchild
       
   599 
       
   600 		CMDXMLNode* firstChild = iCurrentElement->FirstChild();
       
   601 
       
   602 		if (firstChild == NULL)
       
   603 			{
       
   604 			iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   605 			}
       
   606 		else
       
   607 			{
       
   608 			iCurrentElement = (CMDXMLElement*)firstChild;
       
   609 			}
       
   610 		}
       
   611 	else if (iCurrentCommand->Compare(KLastChild) == 0)
       
   612 		{
       
   613 		// Navigate to the last child of the current element.
       
   614 		// Command: lastchild
       
   615 
       
   616 		CMDXMLNode* lastChild = iCurrentElement->LastChild();
       
   617 
       
   618 		if (lastChild == NULL)
       
   619 			{
       
   620 			iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   621 			}
       
   622 		else
       
   623 			{
       
   624 			iCurrentElement = (CMDXMLElement*)lastChild;
       
   625 			}
       
   626 		}
       
   627 	else if (iCurrentCommand->Compare(KNextSibling) == 0)
       
   628 		{
       
   629 		// Navigate to the next sibling of the current element.
       
   630 		// Command: nextsibling
       
   631 
       
   632 		CMDXMLNode* nextSibling = iCurrentElement->NextSibling();
       
   633 
       
   634 		if (nextSibling == NULL)
       
   635 			{
       
   636 			iWriter->WriteTest(KAlreadyAtEndOfList);
       
   637 			}
       
   638 		else
       
   639 			{
       
   640 			iCurrentElement = (CMDXMLElement*)nextSibling;
       
   641 			}
       
   642 		}
       
   643 	else if (iCurrentCommand->Compare(KPrevSibling) == 0)
       
   644 		{
       
   645 		// Navigate to the previous sibling of the current element.
       
   646 		// Command: prevsibling
       
   647 
       
   648 		CMDXMLNode* prevSibling = iCurrentElement->PreviousSibling();
       
   649 
       
   650 		if (prevSibling == NULL)
       
   651 			{
       
   652 			iWriter->WriteTest(KAlreadyAtEndOfList);
       
   653 			}
       
   654 		else
       
   655 			{
       
   656 			iCurrentElement = (CMDXMLElement*)prevSibling;
       
   657 			}
       
   658 		}
       
   659 	else if (iCurrentCommand->Compare(KFirst) == 0)
       
   660 		{
       
   661 		// Navigate to the first child, of specified element type, belonging to the current
       
   662 		// element.
       
   663 		// Command: first <element type>
       
   664 
       
   665 		// If current element is a BasicElt, cast the pointer, so that we can call BasicElt
       
   666 		// members.
       
   667 		if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
   668 		&&  iCurrentElement->NodeName() != KXMLSMILEltmeta)
       
   669 			{
       
   670 			CMDXMLSMILBasicElt* basicElt = (CMDXMLSMILBasicElt*)iCurrentElement;
       
   671 
       
   672 			if ((*iArgumentList)[0].Compare(KAnimation) == 0)
       
   673 				{
       
   674 				CMDXMLElement* firstChild = basicElt->FirstanimationChild();
       
   675 
       
   676 				if (firstChild == NULL)
       
   677 					{
       
   678 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   679 					}
       
   680 				else
       
   681 					{
       
   682 					iCurrentElement = firstChild;
       
   683 					}
       
   684 				}
       
   685 			else if ((*iArgumentList)[0].Compare(KAudio) == 0)
       
   686 				{
       
   687 				CMDXMLElement* firstChild = basicElt->FirstaudioChild();
       
   688 
       
   689 				if (firstChild == NULL)
       
   690 					{
       
   691 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   692 					}
       
   693 				else
       
   694 					{
       
   695 					iCurrentElement = firstChild;
       
   696 					}
       
   697 				}
       
   698 			else if ((*iArgumentList)[0].Compare(KImg) == 0)
       
   699 				{
       
   700 				CMDXMLElement* firstChild = basicElt->FirstimgChild();
       
   701 
       
   702 				if (firstChild == NULL)
       
   703 					{
       
   704 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   705 					}
       
   706 				else
       
   707 					{
       
   708 					iCurrentElement = firstChild;
       
   709 					}
       
   710 				}
       
   711 			else if ((*iArgumentList)[0].Compare(KPar) == 0)
       
   712 				{
       
   713 				CMDXMLElement* firstChild = basicElt->FirstparChild();
       
   714 
       
   715 				if (firstChild == NULL)
       
   716 					{
       
   717 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   718 					}
       
   719 				else
       
   720 					{
       
   721 					iCurrentElement = firstChild;
       
   722 					}
       
   723 				}
       
   724 			else if ((*iArgumentList)[0].Compare(KRef) == 0)
       
   725 				{
       
   726 				CMDXMLElement* firstChild = basicElt->FirstrefChild();
       
   727 
       
   728 				if (firstChild == NULL)
       
   729 					{
       
   730 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   731 					}
       
   732 				else
       
   733 					{
       
   734 					iCurrentElement = firstChild;
       
   735 					}
       
   736 				}
       
   737 			else if ((*iArgumentList)[0].Compare(KRegion) == 0)
       
   738 				{
       
   739 				CMDXMLElement* firstChild = basicElt->FirstregionChild();
       
   740 
       
   741 				if (firstChild == NULL)
       
   742 					{
       
   743 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   744 					}
       
   745 				else
       
   746 					{
       
   747 					iCurrentElement = firstChild;
       
   748 					}
       
   749 				}
       
   750 			else if ((*iArgumentList)[0].Compare(KSeq) == 0)
       
   751 				{
       
   752 				CMDXMLElement* firstChild = basicElt->FirstseqChild();
       
   753 
       
   754 				if (firstChild == NULL)
       
   755 					{
       
   756 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   757 					}
       
   758 				else
       
   759 					{
       
   760 					iCurrentElement = firstChild;
       
   761 					}
       
   762 				}
       
   763 			else if ((*iArgumentList)[0].Compare(KText) == 0)
       
   764 				{
       
   765 				CMDXMLElement* firstChild = basicElt->FirsttextChild();
       
   766 
       
   767 				if (firstChild == NULL)
       
   768 					{
       
   769 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   770 					}
       
   771 				else
       
   772 					{
       
   773 					iCurrentElement = firstChild;
       
   774 					}
       
   775 				}
       
   776 			else if ((*iArgumentList)[0].Compare(KTextstream) == 0)
       
   777 				{
       
   778 				CMDXMLElement* firstChild = basicElt->FirsttextstreamChild();
       
   779 
       
   780 				if (firstChild == NULL)
       
   781 					{
       
   782 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   783 					}
       
   784 				else
       
   785 					{
       
   786 					iCurrentElement = firstChild;
       
   787 					}
       
   788 				}
       
   789 			else if ((*iArgumentList)[0].Compare(KVideo) == 0)
       
   790 				{
       
   791 				CMDXMLElement* firstChild = basicElt->FirstvideoChild();
       
   792 
       
   793 				if (firstChild == NULL)
       
   794 					{
       
   795 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   796 					}
       
   797 				else
       
   798 					{
       
   799 					iCurrentElement = firstChild;
       
   800 					}
       
   801 				}
       
   802 			else  // Invalid element type
       
   803 				{
       
   804 				iWriter->WriteTest(KInvalidArgument);
       
   805 				}
       
   806 			}
       
   807 		else // Error: Current element is not a BasicElt
       
   808 			{
       
   809 			iWriter->WriteTest(KNotABasicElt);
       
   810 			}
       
   811 		}
       
   812 	else if (iCurrentCommand->Compare(KLast) == 0)
       
   813 		{
       
   814 		// Navigate to the last child, of specified element type, belonging to the current
       
   815 		// element.
       
   816 		// Command: last <element type>
       
   817 
       
   818 		// If current element is a BasicElt, cast the pointer, so that we can call BasicElt
       
   819 		// members.
       
   820 		if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
   821 		&&  iCurrentElement->NodeName() != KXMLSMILEltmeta)
       
   822 			{
       
   823 			CMDXMLSMILBasicElt* basicElt = (CMDXMLSMILBasicElt*)iCurrentElement;
       
   824 
       
   825 			if ((*iArgumentList)[0].Compare(KAnimation) == 0)
       
   826 				{
       
   827 				CMDXMLElement* lastChild = basicElt->LastanimationChild();
       
   828 
       
   829 				if (lastChild == NULL)
       
   830 					{
       
   831 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   832 					}
       
   833 				else
       
   834 					{
       
   835 					iCurrentElement = lastChild;
       
   836 					}
       
   837 				}
       
   838 			else if ((*iArgumentList)[0].Compare(KAudio) == 0)
       
   839 				{
       
   840 				CMDXMLElement* lastChild = basicElt->LastaudioChild();
       
   841 
       
   842 				if (lastChild == NULL)
       
   843 					{
       
   844 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   845 					}
       
   846 				else
       
   847 					{
       
   848 					iCurrentElement = lastChild;
       
   849 					}
       
   850 				}
       
   851 			else if ((*iArgumentList)[0].Compare(KImg) == 0)
       
   852 				{
       
   853 				CMDXMLElement* lastChild = basicElt->LastimgChild();
       
   854 
       
   855 				if (lastChild == NULL)
       
   856 					{
       
   857 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   858 					}
       
   859 				else
       
   860 					{
       
   861 					iCurrentElement = lastChild;
       
   862 					}
       
   863 				}
       
   864 			else if ((*iArgumentList)[0].Compare(KPar) == 0)
       
   865 				{
       
   866 				CMDXMLElement* lastChild = basicElt->LastparChild();
       
   867 
       
   868 				if (lastChild == NULL)
       
   869 					{
       
   870 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   871 					}
       
   872 				else
       
   873 					{
       
   874 					iCurrentElement = lastChild;
       
   875 					}
       
   876 				}
       
   877 			else if ((*iArgumentList)[0].Compare(KRef) == 0)
       
   878 				{
       
   879 				CMDXMLElement* lastChild = basicElt->LastrefChild();
       
   880 
       
   881 				if (lastChild == NULL)
       
   882 					{
       
   883 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   884 					}
       
   885 				else
       
   886 					{
       
   887 					iCurrentElement = lastChild;
       
   888 					}
       
   889 				}
       
   890 			else if ((*iArgumentList)[0].Compare(KRegion) == 0)
       
   891 				{
       
   892 				CMDXMLElement* lastChild = basicElt->LastregionChild();
       
   893 
       
   894 				if (lastChild == NULL)
       
   895 					{
       
   896 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   897 					}
       
   898 				else
       
   899 					{
       
   900 					iCurrentElement = lastChild;
       
   901 					}
       
   902 				}
       
   903 			else if ((*iArgumentList)[0].Compare(KSeq) == 0)
       
   904 				{
       
   905 				CMDXMLElement* lastChild = basicElt->LastseqChild();
       
   906 
       
   907 				if (lastChild == NULL)
       
   908 					{
       
   909 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   910 					}
       
   911 				else
       
   912 					{
       
   913 					iCurrentElement = lastChild;
       
   914 					}
       
   915 				}
       
   916 			else if ((*iArgumentList)[0].Compare(KText) == 0)
       
   917 				{
       
   918 				CMDXMLElement* lastChild = basicElt->LasttextChild();
       
   919 
       
   920 				if (lastChild == NULL)
       
   921 					{
       
   922 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   923 					}
       
   924 				else
       
   925 					{
       
   926 					iCurrentElement = lastChild;
       
   927 					}
       
   928 				}
       
   929 			else if ((*iArgumentList)[0].Compare(KTextstream) == 0)
       
   930 				{
       
   931 				CMDXMLElement* lastChild = basicElt->LasttextstreamChild();
       
   932 
       
   933 				if (lastChild == NULL)
       
   934 					{
       
   935 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   936 					}
       
   937 				else
       
   938 					{
       
   939 					iCurrentElement = lastChild;
       
   940 					}
       
   941 				}
       
   942 			else if ((*iArgumentList)[0].Compare(KVideo) == 0)
       
   943 				{
       
   944 				CMDXMLElement* lastChild = basicElt->LastvideoChild();
       
   945 
       
   946 				if (lastChild == NULL)
       
   947 					{
       
   948 					iWriter->WriteTest(KCannotFindSpecifiedChild);
       
   949 					}
       
   950 				else
       
   951 					{
       
   952 					iCurrentElement = lastChild;
       
   953 					}
       
   954 				}
       
   955 			else  // Invalid element type
       
   956 				{
       
   957 				iWriter->WriteTest(KInvalidArgument);
       
   958 				}
       
   959 			}
       
   960 		else // Error: Current element is not a BasicElt
       
   961 			{
       
   962 			iWriter->WriteTest(KNotABasicElt);
       
   963 			}
       
   964 		}
       
   965 	else if (iCurrentCommand->Compare(KNext) == 0)
       
   966 		{
       
   967 		// Navigate to the next sibling, of specified element type, from a current
       
   968 		// element of the same type.
       
   969 		// Command: next <element type>
       
   970 
       
   971 		if ((*iArgumentList)[0].Compare(KAnimation) == 0)
       
   972 			{
       
   973 			// If current element is of the specified type...
       
   974 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
   975 			&&  iCurrentElement->NodeName() == KXMLSMILEltanimation)
       
   976 				{
       
   977 				// ...cast the pointer, so that we can call the members of that type.
       
   978 				CMDXMLSMILanimation* eltOfSpecificType = (CMDXMLSMILanimation*)iCurrentElement;
       
   979 
       
   980 				CMDXMLElement* nextSibling = eltOfSpecificType->NextanimationSibling();
       
   981 
       
   982 				if (nextSibling == NULL)
       
   983 					{
       
   984 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
   985 					}
       
   986 				else
       
   987 					{
       
   988 					iCurrentElement = nextSibling;
       
   989 					}
       
   990 				}
       
   991 			else // Error: Current element is not of the specified type
       
   992 				{
       
   993 				iWriter->WriteTest(KNotOfSpecifiedType);
       
   994 				}
       
   995 			}
       
   996 		else if ((*iArgumentList)[0].Compare(KAudio) == 0)
       
   997 			{
       
   998 			// If current element is of the specified type...
       
   999 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1000 			&&  iCurrentElement->NodeName() == KXMLSMILEltaudio)
       
  1001 				{
       
  1002 				// ...cast the pointer, so that we can call the members of that type.
       
  1003 				CMDXMLSMILaudio* eltOfSpecificType = (CMDXMLSMILaudio*)iCurrentElement;
       
  1004 
       
  1005 				CMDXMLElement* nextSibling = eltOfSpecificType->NextaudioSibling();
       
  1006 
       
  1007 				if (nextSibling == NULL)
       
  1008 					{
       
  1009 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1010 					}
       
  1011 				else
       
  1012 					{
       
  1013 					iCurrentElement = nextSibling;
       
  1014 					}
       
  1015 				}
       
  1016 			else // Error: Current element is not of the specified type
       
  1017 				{
       
  1018 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1019 				}
       
  1020 			}
       
  1021 		else if ((*iArgumentList)[0].Compare(KImg) == 0)
       
  1022 			{
       
  1023 			// If current element is of the specified type...
       
  1024 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1025 			&&  iCurrentElement->NodeName() == KXMLSMILEltimg)
       
  1026 				{
       
  1027 				// ...cast the pointer, so that we can call the members of that type.
       
  1028 				CMDXMLSMILimg* eltOfSpecificType = (CMDXMLSMILimg*)iCurrentElement;
       
  1029 
       
  1030 				CMDXMLElement* nextSibling = eltOfSpecificType->NextimgSibling();
       
  1031 
       
  1032 				if (nextSibling == NULL)
       
  1033 					{
       
  1034 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1035 					}
       
  1036 				else
       
  1037 					{
       
  1038 					iCurrentElement = nextSibling;
       
  1039 					}
       
  1040 				}
       
  1041 			else // Error: Current element is not of the specified type
       
  1042 				{
       
  1043 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1044 				}
       
  1045 			}
       
  1046 		else if ((*iArgumentList)[0].Compare(KPar) == 0)
       
  1047 			{
       
  1048 			// If current element is of the specified type...
       
  1049 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1050 			&&  iCurrentElement->NodeName() == KXMLSMILEltpar)
       
  1051 				{
       
  1052 				// ...cast the pointer, so that we can call the members of that type.
       
  1053 				CMDXMLSMILpar* eltOfSpecificType = (CMDXMLSMILpar*)iCurrentElement;
       
  1054 
       
  1055 				CMDXMLElement* nextSibling = eltOfSpecificType->NextparSibling();
       
  1056 
       
  1057 				if (nextSibling == NULL)
       
  1058 					{
       
  1059 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1060 					}
       
  1061 				else
       
  1062 					{
       
  1063 					iCurrentElement = nextSibling;
       
  1064 					}
       
  1065 				}
       
  1066 			else // Error: Current element is not of the specified type
       
  1067 				{
       
  1068 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1069 				}
       
  1070 			}
       
  1071 		else if ((*iArgumentList)[0].Compare(KRef) == 0)
       
  1072 			{
       
  1073 			// If current element is of the specified type...
       
  1074 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1075 			&&  iCurrentElement->NodeName() == KXMLSMILEltref)
       
  1076 				{
       
  1077 				// ...cast the pointer, so that we can call the members of that type.
       
  1078 				CMDXMLSMILref* eltOfSpecificType = (CMDXMLSMILref*)iCurrentElement;
       
  1079 
       
  1080 				CMDXMLElement* nextSibling = eltOfSpecificType->NextrefSibling();
       
  1081 
       
  1082 				if (nextSibling == NULL)
       
  1083 					{
       
  1084 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1085 					}
       
  1086 				else
       
  1087 					{
       
  1088 					iCurrentElement = nextSibling;
       
  1089 					}
       
  1090 				}
       
  1091 			else // Error: Current element is not of the specified type
       
  1092 				{
       
  1093 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1094 				}
       
  1095 			}
       
  1096 		else if ((*iArgumentList)[0].Compare(KRegion) == 0)
       
  1097 			{
       
  1098 			// If current element is of the specified type...
       
  1099 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1100 			&&  iCurrentElement->NodeName() == KXMLSMILEltregion)
       
  1101 				{
       
  1102 				// ...cast the pointer, so that we can call the members of that type.
       
  1103 				CMDXMLSMILregion* eltOfSpecificType = (CMDXMLSMILregion*)iCurrentElement;
       
  1104 
       
  1105 				CMDXMLElement* nextSibling = eltOfSpecificType->NextregionSibling();
       
  1106 
       
  1107 				if (nextSibling == NULL)
       
  1108 					{
       
  1109 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1110 					}
       
  1111 				else
       
  1112 					{
       
  1113 					iCurrentElement = nextSibling;
       
  1114 					}
       
  1115 				}
       
  1116 			else // Error: Current element is not of the specified type
       
  1117 				{
       
  1118 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1119 				}
       
  1120 			}
       
  1121 		else if ((*iArgumentList)[0].Compare(KSeq) == 0)
       
  1122 			{
       
  1123 			// If current element is of the specified type...
       
  1124 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1125 			&&  iCurrentElement->NodeName() == KXMLSMILEltseq)
       
  1126 				{
       
  1127 				// ...cast the pointer, so that we can call the members of that type.
       
  1128 				CMDXMLSMILseq* eltOfSpecificType = (CMDXMLSMILseq*)iCurrentElement;
       
  1129 
       
  1130 				CMDXMLElement* nextSibling = eltOfSpecificType->NextseqSibling();
       
  1131 
       
  1132 				if (nextSibling == NULL)
       
  1133 					{
       
  1134 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1135 					}
       
  1136 				else
       
  1137 					{
       
  1138 					iCurrentElement = nextSibling;
       
  1139 					}
       
  1140 				}
       
  1141 			else // Error: Current element is not of the specified type
       
  1142 				{
       
  1143 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1144 				}
       
  1145 			}
       
  1146 		else if ((*iArgumentList)[0].Compare(KText) == 0)
       
  1147 			{
       
  1148 			// If current element is of the specified type...
       
  1149 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1150 			&&  iCurrentElement->NodeName() == KXMLSMILElttext)
       
  1151 				{
       
  1152 				// ...cast the pointer, so that we can call the members of that type.
       
  1153 				CMDXMLSMILtext* eltOfSpecificType = (CMDXMLSMILtext*)iCurrentElement;
       
  1154 
       
  1155 				CMDXMLElement* nextSibling = eltOfSpecificType->NexttextSibling();
       
  1156 
       
  1157 				if (nextSibling == NULL)
       
  1158 					{
       
  1159 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1160 					}
       
  1161 				else
       
  1162 					{
       
  1163 					iCurrentElement = nextSibling;
       
  1164 					}
       
  1165 				}
       
  1166 			else // Error: Current element is not of the specified type
       
  1167 				{
       
  1168 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1169 				}
       
  1170 			}
       
  1171 		else if ((*iArgumentList)[0].Compare(KTextstream) == 0)
       
  1172 			{
       
  1173 			// If current element is of the specified type...
       
  1174 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1175 			&&  iCurrentElement->NodeName() == KXMLSMILElttextstream)
       
  1176 				{
       
  1177 				// ...cast the pointer, so that we can call the members of that type.
       
  1178 				CMDXMLSMILtextstream* eltOfSpecificType = (CMDXMLSMILtextstream*)iCurrentElement;
       
  1179 
       
  1180 				CMDXMLElement* nextSibling = eltOfSpecificType->NexttextstreamSibling();
       
  1181 
       
  1182 				if (nextSibling == NULL)
       
  1183 					{
       
  1184 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1185 					}
       
  1186 				else
       
  1187 					{
       
  1188 					iCurrentElement = nextSibling;
       
  1189 					}
       
  1190 				}
       
  1191 			else // Error: Current element is not of the specified type
       
  1192 				{
       
  1193 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1194 				}
       
  1195 			}
       
  1196 		else if ((*iArgumentList)[0].Compare(KVideo) == 0)
       
  1197 			{
       
  1198 			// If current element is of the specified type...
       
  1199 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1200 			&&  iCurrentElement->NodeName() == KXMLSMILEltvideo)
       
  1201 				{
       
  1202 				// ...cast the pointer, so that we can call the members of that type.
       
  1203 				CMDXMLSMILvideo* eltOfSpecificType = (CMDXMLSMILvideo*)iCurrentElement;
       
  1204 
       
  1205 				CMDXMLElement* nextSibling = eltOfSpecificType->NextvideoSibling();
       
  1206 
       
  1207 				if (nextSibling == NULL)
       
  1208 					{
       
  1209 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1210 					}
       
  1211 				else
       
  1212 					{
       
  1213 					iCurrentElement = nextSibling;
       
  1214 					}
       
  1215 				}
       
  1216 			else // Error: Current element is not of the specified type
       
  1217 				{
       
  1218 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1219 				}
       
  1220 			}
       
  1221 		else  // Invalid element type
       
  1222 			{
       
  1223 			iWriter->WriteTest(KInvalidArgument);
       
  1224 			}
       
  1225 		}
       
  1226 	else if (iCurrentCommand->Compare(KPrev) == 0)
       
  1227 		{
       
  1228 		// Navigate to the previous sibling, of specified element type, from a current
       
  1229 		// element of the same type.
       
  1230 		// Command: prev <element type>
       
  1231 
       
  1232 		if ((*iArgumentList)[0].Compare(KAnimation) == 0)
       
  1233 			{
       
  1234 			// If current element is of the specified type...
       
  1235 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1236 			&&  iCurrentElement->NodeName() == KXMLSMILEltanimation)
       
  1237 				{
       
  1238 				// ...cast the pointer, so that we can call the members of that type.
       
  1239 				CMDXMLSMILanimation* eltOfSpecificType = (CMDXMLSMILanimation*)iCurrentElement;
       
  1240 
       
  1241 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousanimationSibling();
       
  1242 
       
  1243 				if (prevSibling == NULL)
       
  1244 					{
       
  1245 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1246 					}
       
  1247 				else
       
  1248 					{
       
  1249 					iCurrentElement = prevSibling;
       
  1250 					}
       
  1251 				}
       
  1252 			else // Error: Current element is not of the specified type
       
  1253 				{
       
  1254 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1255 				}
       
  1256 			}
       
  1257 		else if ((*iArgumentList)[0].Compare(KAudio) == 0)
       
  1258 			{
       
  1259 			// If current element is of the specified type...
       
  1260 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1261 			&&  iCurrentElement->NodeName() == KXMLSMILEltaudio)
       
  1262 				{
       
  1263 				// ...cast the pointer, so that we can call the members of that type.
       
  1264 				CMDXMLSMILaudio* eltOfSpecificType = (CMDXMLSMILaudio*)iCurrentElement;
       
  1265 
       
  1266 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousaudioSibling();
       
  1267 
       
  1268 				if (prevSibling == NULL)
       
  1269 					{
       
  1270 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1271 					}
       
  1272 				else
       
  1273 					{
       
  1274 					iCurrentElement = prevSibling;
       
  1275 					}
       
  1276 				}
       
  1277 			else // Error: Current element is not of the specified type
       
  1278 				{
       
  1279 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1280 				}
       
  1281 			}
       
  1282 		else if ((*iArgumentList)[0].Compare(KImg) == 0)
       
  1283 			{
       
  1284 			// If current element is of the specified type...
       
  1285 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1286 			&&  iCurrentElement->NodeName() == KXMLSMILEltimg)
       
  1287 				{
       
  1288 				// ...cast the pointer, so that we can call the members of that type.
       
  1289 				CMDXMLSMILimg* eltOfSpecificType = (CMDXMLSMILimg*)iCurrentElement;
       
  1290 
       
  1291 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousimgSibling();
       
  1292 
       
  1293 				if (prevSibling == NULL)
       
  1294 					{
       
  1295 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1296 					}
       
  1297 				else
       
  1298 					{
       
  1299 					iCurrentElement = prevSibling;
       
  1300 					}
       
  1301 				}
       
  1302 			else // Error: Current element is not of the specified type
       
  1303 				{
       
  1304 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1305 				}
       
  1306 			}
       
  1307 		else if ((*iArgumentList)[0].Compare(KPar) == 0)
       
  1308 			{
       
  1309 			// If current element is of the specified type...
       
  1310 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1311 			&&  iCurrentElement->NodeName() == KXMLSMILEltpar)
       
  1312 				{
       
  1313 				// ...cast the pointer, so that we can call the members of that type.
       
  1314 				CMDXMLSMILpar* eltOfSpecificType = (CMDXMLSMILpar*)iCurrentElement;
       
  1315 
       
  1316 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousparSibling();
       
  1317 
       
  1318 				if (prevSibling == NULL)
       
  1319 					{
       
  1320 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1321 					}
       
  1322 				else
       
  1323 					{
       
  1324 					iCurrentElement = prevSibling;
       
  1325 					}
       
  1326 				}
       
  1327 			else // Error: Current element is not of the specified type
       
  1328 				{
       
  1329 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1330 				}
       
  1331 			}
       
  1332 		else if ((*iArgumentList)[0].Compare(KRef) == 0)
       
  1333 			{
       
  1334 			// If current element is of the specified type...
       
  1335 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1336 			&&  iCurrentElement->NodeName() == KXMLSMILEltref)
       
  1337 				{
       
  1338 				// ...cast the pointer, so that we can call the members of that type.
       
  1339 				CMDXMLSMILref* eltOfSpecificType = (CMDXMLSMILref*)iCurrentElement;
       
  1340 
       
  1341 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousrefSibling();
       
  1342 
       
  1343 				if (prevSibling == NULL)
       
  1344 					{
       
  1345 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1346 					}
       
  1347 				else
       
  1348 					{
       
  1349 					iCurrentElement = prevSibling;
       
  1350 					}
       
  1351 				}
       
  1352 			else // Error: Current element is not of the specified type
       
  1353 				{
       
  1354 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1355 				}
       
  1356 			}
       
  1357 		else if ((*iArgumentList)[0].Compare(KRegion) == 0)
       
  1358 			{
       
  1359 			// If current element is of the specified type...
       
  1360 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1361 			&&  iCurrentElement->NodeName() == KXMLSMILEltregion)
       
  1362 				{
       
  1363 				// ...cast the pointer, so that we can call the members of that type.
       
  1364 				CMDXMLSMILregion* eltOfSpecificType = (CMDXMLSMILregion*)iCurrentElement;
       
  1365 
       
  1366 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousregionSibling();
       
  1367 
       
  1368 				if (prevSibling == NULL)
       
  1369 					{
       
  1370 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1371 					}
       
  1372 				else
       
  1373 					{
       
  1374 					iCurrentElement = prevSibling;
       
  1375 					}
       
  1376 				}
       
  1377 			else // Error: Current element is not of the specified type
       
  1378 				{
       
  1379 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1380 				}
       
  1381 			}
       
  1382 		else if ((*iArgumentList)[0].Compare(KSeq) == 0)
       
  1383 			{
       
  1384 			// If current element is of the specified type...
       
  1385 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1386 			&&  iCurrentElement->NodeName() == KXMLSMILEltseq)
       
  1387 				{
       
  1388 				// ...cast the pointer, so that we can call the members of that type.
       
  1389 				CMDXMLSMILseq* eltOfSpecificType = (CMDXMLSMILseq*)iCurrentElement;
       
  1390 
       
  1391 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousseqSibling();
       
  1392 
       
  1393 				if (prevSibling == NULL)
       
  1394 					{
       
  1395 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1396 					}
       
  1397 				else
       
  1398 					{
       
  1399 					iCurrentElement = prevSibling;
       
  1400 					}
       
  1401 				}
       
  1402 			else // Error: Current element is not of the specified type
       
  1403 				{
       
  1404 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1405 				}
       
  1406 			}
       
  1407 		else if ((*iArgumentList)[0].Compare(KText) == 0)
       
  1408 			{
       
  1409 			// If current element is of the specified type...
       
  1410 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1411 			&&  iCurrentElement->NodeName() == KXMLSMILElttext)
       
  1412 				{
       
  1413 				// ...cast the pointer, so that we can call the members of that type.
       
  1414 				CMDXMLSMILtext* eltOfSpecificType = (CMDXMLSMILtext*)iCurrentElement;
       
  1415 
       
  1416 				CMDXMLElement* prevSibling = eltOfSpecificType->PrevioustextSibling();
       
  1417 
       
  1418 				if (prevSibling == NULL)
       
  1419 					{
       
  1420 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1421 					}
       
  1422 				else
       
  1423 					{
       
  1424 					iCurrentElement = prevSibling;
       
  1425 					}
       
  1426 				}
       
  1427 			else // Error: Current element is not of the specified type
       
  1428 				{
       
  1429 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1430 				}
       
  1431 			}
       
  1432 		else if ((*iArgumentList)[0].Compare(KTextstream) == 0)
       
  1433 			{
       
  1434 			// If current element is of the specified type...
       
  1435 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1436 			&&  iCurrentElement->NodeName() == KXMLSMILElttextstream)
       
  1437 				{
       
  1438 				// ...cast the pointer, so that we can call the members of that type.
       
  1439 				CMDXMLSMILtextstream* eltOfSpecificType = (CMDXMLSMILtextstream*)iCurrentElement;
       
  1440 
       
  1441 				CMDXMLElement* prevSibling = eltOfSpecificType->PrevioustextstreamSibling();
       
  1442 
       
  1443 				if (prevSibling == NULL)
       
  1444 					{
       
  1445 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1446 					}
       
  1447 				else
       
  1448 					{
       
  1449 					iCurrentElement = prevSibling;
       
  1450 					}
       
  1451 				}
       
  1452 			else // Error: Current element is not of the specified type
       
  1453 				{
       
  1454 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1455 				}
       
  1456 			}
       
  1457 		else if ((*iArgumentList)[0].Compare(KVideo) == 0)
       
  1458 			{
       
  1459 			// If current element is of the specified type...
       
  1460 			if (iCurrentElement->NodeType() == CMDXMLNode::EElementNode
       
  1461 			&&  iCurrentElement->NodeName() == KXMLSMILEltvideo)
       
  1462 				{
       
  1463 				// ...cast the pointer, so that we can call the members of that type.
       
  1464 				CMDXMLSMILvideo* eltOfSpecificType = (CMDXMLSMILvideo*)iCurrentElement;
       
  1465 
       
  1466 				CMDXMLElement* prevSibling = eltOfSpecificType->PreviousvideoSibling();
       
  1467 
       
  1468 				if (prevSibling == NULL)
       
  1469 					{
       
  1470 					iWriter->WriteTest(KAlreadyAtEndOfList);
       
  1471 					}
       
  1472 				else
       
  1473 					{
       
  1474 					iCurrentElement = prevSibling;
       
  1475 					}
       
  1476 				}
       
  1477 			else // Error: Current element is not of the specified type
       
  1478 				{
       
  1479 				iWriter->WriteTest(KNotOfSpecifiedType);
       
  1480 				}
       
  1481 			}
       
  1482 		else  // Invalid element type
       
  1483 			{
       
  1484 			iWriter->WriteTest(KInvalidArgument);
       
  1485 			}
       
  1486 		}
       
  1487 	else if (iCurrentCommand->Compare(KSetAtt) == 0)
       
  1488 		{
       
  1489 		// Set an attribute value of the current element (referring to the attribute by name).
       
  1490 		// Command: setatt <attribute name> "<attribute value>"
       
  1491 
       
  1492 		TInt err = iCurrentElement->SetAttributeL((*iArgumentList)[0],  // aAttributeName
       
  1493 												  (*iArgumentList)[1]); // aAttributeValue
       
  1494 		if (err != KErrNone)
       
  1495 			{
       
  1496 			if (err == KErrNotSupported)
       
  1497 				{
       
  1498 				iWriter->WriteTest(KInvalidArgument);
       
  1499 				}
       
  1500 			}
       
  1501 		}
       
  1502 	else if (iCurrentCommand->Compare(KGetAtt) == 0)
       
  1503 		{
       
  1504 		// Get an attribute value of the current element if it is set (referring to the attribute
       
  1505 		// by name).
       
  1506 		// Command: getatt <attribute name>
       
  1507 
       
  1508 		TPtrC attributeValue; // Used to point to an existing HBufC, which could be any length.
       
  1509 							  // We don't want to copy it into a buffer.
       
  1510 
       
  1511 		TInt err = iCurrentElement->GetAttribute((*iArgumentList)[0],  // aAttributeName
       
  1512 												 attributeValue);
       
  1513 		if (err != KErrNone)
       
  1514 			{
       
  1515 			if (err == KErrNotSupported)
       
  1516 				{
       
  1517 				iWriter->WriteTest(KInvalidArgument);
       
  1518 				}
       
  1519 			else if (err == KErrNotFound)
       
  1520 				{
       
  1521 				iWriter->WriteTest(KAttributeNotSet);
       
  1522 				}
       
  1523 			}
       
  1524 		else  // successful get
       
  1525 			{
       
  1526 			iWriter->WriteTest(attributeValue);
       
  1527 			}
       
  1528 		}
       
  1529 	else if (iCurrentCommand->Compare(KUnsetAtt) == 0)
       
  1530 		{
       
  1531 		// Unset an attribute for the current element (referring to the attribute by name).
       
  1532 		// Command: unsetatt <attribute name>
       
  1533 
       
  1534 		TInt err = iCurrentElement->RemoveAttribute((*iArgumentList)[0]); // aAttributeName
       
  1535 
       
  1536 		if (err != KErrNone)
       
  1537 			{
       
  1538 			if (err == KErrNotSupported)
       
  1539 				{
       
  1540 				iWriter->WriteTest(KInvalidArgument);
       
  1541 				}
       
  1542 			}
       
  1543 		}
       
  1544 	else if (iCurrentCommand->Compare(KLegalChildren) == 0)
       
  1545 		{
       
  1546 		// Check the child elements of the current element.
       
  1547 		// Command: legalchildren
       
  1548 
       
  1549 		if (iCurrentElement->CheckChildren())
       
  1550 			{
       
  1551 			iWriter->WriteTest(KElementHasLegalChildren);
       
  1552 			}
       
  1553 		else
       
  1554 			{
       
  1555 			iWriter->WriteTest(KElementHasIllegalChildren);
       
  1556 			}
       
  1557 		}
       
  1558 	else if (iCurrentCommand->Compare(KSetId) == 0)
       
  1559 		{
       
  1560 		IdAttTestL( KIdSetOp );
       
  1561 		}
       
  1562 	else if (iCurrentCommand->Compare(KGetId) == 0)
       
  1563 		{
       
  1564 		IdAttTestL( KIdGetOp );
       
  1565 		}
       
  1566 	else if (iCurrentCommand->Compare(KRemoveId) == 0)
       
  1567 		{
       
  1568 		IdAttTestL( KIdRemoveOp );
       
  1569 		}
       
  1570 	else  // Unrecognised command
       
  1571 		{
       
  1572 		iWriter->WriteTest(KUnrecognisedCommand);
       
  1573 		}
       
  1574 
       
  1575 	iArgumentList->Reset();
       
  1576 	delete iCurrentCommand;
       
  1577 	iCurrentCommand = NULL;
       
  1578 	}
       
  1579 
       
  1580 void CScriptRunner::IdAttTestL( TIdOp aOp )
       
  1581 	{
       
  1582 	// We can set the Id by means of SetAttribute but we have a separate test that attempts
       
  1583 	// to use the direct member functioin to test that.  Id is only one of a range of attributes
       
  1584 	// but it has been selected as a sample (because it is almost universal)
       
  1585 	TInt err = KErrNone;
       
  1586 
       
  1587 	switch (iCurrentElement->ElementType())
       
  1588 		{
       
  1589 		case (KSMILElementa):
       
  1590 			{
       
  1591 			CMDXMLSMILa *ptr = CMDXMLSMILa::CastToSMILa(iCurrentElement);
       
  1592 			switch(aOp)
       
  1593 				{
       
  1594 				case KIdSetOp:
       
  1595 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1596 					break;
       
  1597 				case KIdGetOp:
       
  1598 					if( ptr->IsAttIdSpecified() )
       
  1599 						{
       
  1600 						TPtrC attributeValue = ptr->AttId();
       
  1601 						iWriter->WriteTest(attributeValue);
       
  1602 						}
       
  1603 					else
       
  1604 						{
       
  1605 						iWriter->WriteTest(KAttributeNotSet);
       
  1606 						}
       
  1607 					break;
       
  1608 				case KIdRemoveOp:
       
  1609 					ptr->RemoveAttId();
       
  1610 					break;
       
  1611 				default:
       
  1612 					err = KErrNotSupported;
       
  1613 					break;
       
  1614 				}
       
  1615 			if (err != KErrNone)
       
  1616 				{
       
  1617 				iWriter->WriteTest(KInvalidArgument);
       
  1618 				}
       
  1619 			}
       
  1620 			break;
       
  1621 		case (KSMILElementanchor):
       
  1622 			{
       
  1623 			CMDXMLSMILanchor *ptr = CMDXMLSMILanchor::CastToSMILanchor(iCurrentElement);
       
  1624 			switch(aOp)
       
  1625 				{
       
  1626 				case KIdSetOp:
       
  1627 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1628 					break;
       
  1629 				case KIdGetOp:
       
  1630 					if( ptr->IsAttIdSpecified() )
       
  1631 						{
       
  1632 						TPtrC attributeValue = ptr->AttId();
       
  1633 						iWriter->WriteTest(attributeValue);
       
  1634 						}
       
  1635 					else
       
  1636 						{
       
  1637 						iWriter->WriteTest(KAttributeNotSet);
       
  1638 						}
       
  1639 					break;
       
  1640 				case KIdRemoveOp:
       
  1641 					ptr->RemoveAttId();
       
  1642 					break;
       
  1643 				default:
       
  1644 					err = KErrNotSupported;
       
  1645 					break;
       
  1646 				}
       
  1647 			if (err != KErrNone)
       
  1648 				{
       
  1649 				iWriter->WriteTest(KInvalidArgument);
       
  1650 				}
       
  1651 			}
       
  1652 			break;
       
  1653 		case (KSMILElementanimation):
       
  1654 			{
       
  1655 			CMDXMLSMILanimation *ptr = CMDXMLSMILanimation::CastToSMILanimation(iCurrentElement);
       
  1656 			switch(aOp)
       
  1657 				{
       
  1658 				case KIdSetOp:
       
  1659 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1660 					break;
       
  1661 				case KIdGetOp:
       
  1662 					if( ptr->IsAttIdSpecified() )
       
  1663 						{
       
  1664 						TPtrC attributeValue = ptr->AttId();
       
  1665 						iWriter->WriteTest(attributeValue);
       
  1666 						}
       
  1667 					else
       
  1668 						{
       
  1669 						iWriter->WriteTest(KAttributeNotSet);
       
  1670 						}
       
  1671 					break;
       
  1672 				case KIdRemoveOp:
       
  1673 					ptr->RemoveAttId();
       
  1674 					break;
       
  1675 				default:
       
  1676 					err = KErrNotSupported;
       
  1677 					break;
       
  1678 				}
       
  1679 			if (err != KErrNone)
       
  1680 				{
       
  1681 				iWriter->WriteTest(KInvalidArgument);
       
  1682 				}
       
  1683 			}
       
  1684 			break;
       
  1685 		case (KSMILElementarea):
       
  1686 			{
       
  1687 			CMDXMLSMILarea *ptr = CMDXMLSMILarea::CastToSMILarea(iCurrentElement);
       
  1688 			switch(aOp)
       
  1689 				{
       
  1690 				case KIdSetOp:
       
  1691 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1692 					break;
       
  1693 				case KIdGetOp:
       
  1694 					if( ptr->IsAttIdSpecified() )
       
  1695 						{
       
  1696 						TPtrC attributeValue = ptr->AttId();
       
  1697 						iWriter->WriteTest(attributeValue);
       
  1698 						}
       
  1699 					else
       
  1700 						{
       
  1701 						iWriter->WriteTest(KAttributeNotSet);
       
  1702 						}
       
  1703 					break;
       
  1704 				case KIdRemoveOp:
       
  1705 					ptr->RemoveAttId();
       
  1706 					break;
       
  1707 				default:
       
  1708 					err = KErrNotSupported;
       
  1709 					break;
       
  1710 				}
       
  1711 			if (err != KErrNone)
       
  1712 				{
       
  1713 				iWriter->WriteTest(KInvalidArgument);
       
  1714 				}
       
  1715 			}
       
  1716 			break;
       
  1717 		case (KSMILElementaudio):
       
  1718 			{
       
  1719 			CMDXMLSMILaudio *ptr = CMDXMLSMILaudio::CastToSMILaudio(iCurrentElement);
       
  1720 			switch(aOp)
       
  1721 				{
       
  1722 				case KIdSetOp:
       
  1723 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1724 					break;
       
  1725 				case KIdGetOp:
       
  1726 					if( ptr->IsAttIdSpecified() )
       
  1727 						{
       
  1728 						TPtrC attributeValue = ptr->AttId();
       
  1729 						iWriter->WriteTest(attributeValue);
       
  1730 						}
       
  1731 					else
       
  1732 						{
       
  1733 						iWriter->WriteTest(KAttributeNotSet);
       
  1734 						}
       
  1735 					break;
       
  1736 				case KIdRemoveOp:
       
  1737 					ptr->RemoveAttId();
       
  1738 					break;
       
  1739 				default:
       
  1740 					err = KErrNotSupported;
       
  1741 					break;
       
  1742 				}
       
  1743 			if (err != KErrNone)
       
  1744 				{
       
  1745 				iWriter->WriteTest(KInvalidArgument);
       
  1746 				}
       
  1747 			}
       
  1748 			break;
       
  1749 		case (KSMILElementbody):
       
  1750 			{
       
  1751 			CMDXMLSMILbody *ptr = CMDXMLSMILbody::CastToSMILbody(iCurrentElement);
       
  1752 			switch(aOp)
       
  1753 				{
       
  1754 				case KIdSetOp:
       
  1755 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1756 					break;
       
  1757 				case KIdGetOp:
       
  1758 					if( ptr->IsAttIdSpecified() )
       
  1759 						{
       
  1760 						TPtrC attributeValue = ptr->AttId();
       
  1761 						iWriter->WriteTest(attributeValue);
       
  1762 						}
       
  1763 					else
       
  1764 						{
       
  1765 						iWriter->WriteTest(KAttributeNotSet);
       
  1766 						}
       
  1767 					break;
       
  1768 				case KIdRemoveOp:
       
  1769 					ptr->RemoveAttId();
       
  1770 					break;
       
  1771 				default:
       
  1772 					err = KErrNotSupported;
       
  1773 					break;
       
  1774 				}
       
  1775 			if (err != KErrNone)
       
  1776 				{
       
  1777 				iWriter->WriteTest(KInvalidArgument);
       
  1778 				}
       
  1779 			}
       
  1780 			break;
       
  1781 		case (KSMILElementhead):
       
  1782 			{
       
  1783 			CMDXMLSMILhead *ptr = CMDXMLSMILhead::CastToSMILhead(iCurrentElement);
       
  1784 			switch(aOp)
       
  1785 				{
       
  1786 				case KIdSetOp:
       
  1787 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1788 					break;
       
  1789 				case KIdGetOp:
       
  1790 					if( ptr->IsAttIdSpecified() )
       
  1791 						{
       
  1792 						TPtrC attributeValue = ptr->AttId();
       
  1793 						iWriter->WriteTest(attributeValue);
       
  1794 						}
       
  1795 					else
       
  1796 						{
       
  1797 						iWriter->WriteTest(KAttributeNotSet);
       
  1798 						}
       
  1799 					break;
       
  1800 				case KIdRemoveOp:
       
  1801 					ptr->RemoveAttId();
       
  1802 					break;
       
  1803 				default:
       
  1804 					err = KErrNotSupported;
       
  1805 					break;
       
  1806 				}
       
  1807 			if (err != KErrNone)
       
  1808 				{
       
  1809 				iWriter->WriteTest(KInvalidArgument);
       
  1810 				}
       
  1811 			}
       
  1812 			break;
       
  1813 		case (KSMILElementimg):
       
  1814 			{
       
  1815 			CMDXMLSMILimg *ptr = CMDXMLSMILimg::CastToSMILimg(iCurrentElement);
       
  1816 			switch(aOp)
       
  1817 				{
       
  1818 				case KIdSetOp:
       
  1819 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1820 					break;
       
  1821 				case KIdGetOp:
       
  1822 					if( ptr->IsAttIdSpecified() )
       
  1823 						{
       
  1824 						TPtrC attributeValue = ptr->AttId();
       
  1825 						iWriter->WriteTest(attributeValue);
       
  1826 						}
       
  1827 					else
       
  1828 						{
       
  1829 						iWriter->WriteTest(KAttributeNotSet);
       
  1830 						}
       
  1831 					break;
       
  1832 				case KIdRemoveOp:
       
  1833 					ptr->RemoveAttId();
       
  1834 					break;
       
  1835 				default:
       
  1836 					err = KErrNotSupported;
       
  1837 					break;
       
  1838 				}
       
  1839 			if (err != KErrNone)
       
  1840 				{
       
  1841 				iWriter->WriteTest(KInvalidArgument);
       
  1842 				}
       
  1843 			}
       
  1844 			break;
       
  1845 		case (KSMILElementlayout):
       
  1846 			{
       
  1847 			CMDXMLSMILlayout *ptr = CMDXMLSMILlayout::CastToSMILlayout(iCurrentElement);
       
  1848 			switch(aOp)
       
  1849 				{
       
  1850 				case KIdSetOp:
       
  1851 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1852 					break;
       
  1853 				case KIdGetOp:
       
  1854 					if( ptr->IsAttIdSpecified() )
       
  1855 						{
       
  1856 						TPtrC attributeValue = ptr->AttId();
       
  1857 						iWriter->WriteTest(attributeValue);
       
  1858 						}
       
  1859 					else
       
  1860 						{
       
  1861 						iWriter->WriteTest(KAttributeNotSet);
       
  1862 						}
       
  1863 					break;
       
  1864 				case KIdRemoveOp:
       
  1865 					ptr->RemoveAttId();
       
  1866 					break;
       
  1867 				default:
       
  1868 					err = KErrNotSupported;
       
  1869 					break;
       
  1870 				}
       
  1871 			if (err != KErrNone)
       
  1872 				{
       
  1873 				iWriter->WriteTest(KInvalidArgument);
       
  1874 				}
       
  1875 			}
       
  1876 			break;
       
  1877 		case (KSMILElementpar):
       
  1878 			{
       
  1879 			CMDXMLSMILpar *ptr = CMDXMLSMILpar::CastToSMILpar(iCurrentElement);
       
  1880 			switch(aOp)
       
  1881 				{
       
  1882 				case KIdSetOp:
       
  1883 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1884 					break;
       
  1885 				case KIdGetOp:
       
  1886 					if( ptr->IsAttIdSpecified() )
       
  1887 						{
       
  1888 						TPtrC attributeValue = ptr->AttId();
       
  1889 						iWriter->WriteTest(attributeValue);
       
  1890 						}
       
  1891 					else
       
  1892 						{
       
  1893 						iWriter->WriteTest(KAttributeNotSet);
       
  1894 						}
       
  1895 					break;
       
  1896 				case KIdRemoveOp:
       
  1897 					ptr->RemoveAttId();
       
  1898 					break;
       
  1899 				default:
       
  1900 					err = KErrNotSupported;
       
  1901 					break;
       
  1902 				}
       
  1903 			if (err != KErrNone)
       
  1904 				{
       
  1905 				iWriter->WriteTest(KInvalidArgument);
       
  1906 				}
       
  1907 			}
       
  1908 			break;
       
  1909 		case (KSMILElementref):
       
  1910 			{
       
  1911 			CMDXMLSMILref *ptr = CMDXMLSMILref::CastToSMILref(iCurrentElement);
       
  1912 			switch(aOp)
       
  1913 				{
       
  1914 				case KIdSetOp:
       
  1915 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1916 					break;
       
  1917 				case KIdGetOp:
       
  1918 					if( ptr->IsAttIdSpecified() )
       
  1919 						{
       
  1920 						TPtrC attributeValue = ptr->AttId();
       
  1921 						iWriter->WriteTest(attributeValue);
       
  1922 						}
       
  1923 					else
       
  1924 						{
       
  1925 						iWriter->WriteTest(KAttributeNotSet);
       
  1926 						}
       
  1927 					break;
       
  1928 				case KIdRemoveOp:
       
  1929 					ptr->RemoveAttId();
       
  1930 					break;
       
  1931 				default:
       
  1932 					err = KErrNotSupported;
       
  1933 					break;
       
  1934 				}
       
  1935 			if (err != KErrNone)
       
  1936 				{
       
  1937 				iWriter->WriteTest(KInvalidArgument);
       
  1938 				}
       
  1939 			}
       
  1940 			break;
       
  1941 		case (KSMILElementregion):
       
  1942 			{
       
  1943 			CMDXMLSMILregion *ptr = CMDXMLSMILregion::CastToSMILregion(iCurrentElement);
       
  1944 			switch(aOp)
       
  1945 				{
       
  1946 				case KIdSetOp:
       
  1947 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1948 					break;
       
  1949 				case KIdGetOp:
       
  1950 					if( ptr->IsAttIdSpecified() )
       
  1951 						{
       
  1952 						TPtrC attributeValue = ptr->AttId();
       
  1953 						iWriter->WriteTest(attributeValue);
       
  1954 						}
       
  1955 					else
       
  1956 						{
       
  1957 						iWriter->WriteTest(KAttributeNotSet);
       
  1958 						}
       
  1959 					break;
       
  1960 				case KIdRemoveOp:
       
  1961 					ptr->RemoveAttId();
       
  1962 					break;
       
  1963 				default:
       
  1964 					err = KErrNotSupported;
       
  1965 					break;
       
  1966 				}
       
  1967 			if (err != KErrNone)
       
  1968 				{
       
  1969 				iWriter->WriteTest(KInvalidArgument);
       
  1970 				}
       
  1971 			}
       
  1972 			break;
       
  1973 		case (KSMILElementroot_layout):
       
  1974 			{
       
  1975 			CMDXMLSMILroot_layout *ptr = CMDXMLSMILroot_layout::CastToSMILroot_layout(iCurrentElement);
       
  1976 			switch(aOp)
       
  1977 				{
       
  1978 				case KIdSetOp:
       
  1979 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  1980 					break;
       
  1981 				case KIdGetOp:
       
  1982 					if( ptr->IsAttIdSpecified() )
       
  1983 						{
       
  1984 						TPtrC attributeValue = ptr->AttId();
       
  1985 						iWriter->WriteTest(attributeValue);
       
  1986 						}
       
  1987 					else
       
  1988 						{
       
  1989 						iWriter->WriteTest(KAttributeNotSet);
       
  1990 						}
       
  1991 					break;
       
  1992 				case KIdRemoveOp:
       
  1993 					ptr->RemoveAttId();
       
  1994 					break;
       
  1995 				default:
       
  1996 					err = KErrNotSupported;
       
  1997 					break;
       
  1998 				}
       
  1999 			if (err != KErrNone)
       
  2000 				{
       
  2001 				iWriter->WriteTest(KInvalidArgument);
       
  2002 				}
       
  2003 			}
       
  2004 			break;
       
  2005 		case (KSMILElementseq):
       
  2006 			{
       
  2007 			CMDXMLSMILseq *ptr = CMDXMLSMILseq::CastToSMILseq(iCurrentElement);
       
  2008 			switch(aOp)
       
  2009 				{
       
  2010 				case KIdSetOp:
       
  2011 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  2012 					break;
       
  2013 				case KIdGetOp:
       
  2014 					if( ptr->IsAttIdSpecified() )
       
  2015 						{
       
  2016 						TPtrC attributeValue = ptr->AttId();
       
  2017 						iWriter->WriteTest(attributeValue);
       
  2018 						}
       
  2019 					else
       
  2020 						{
       
  2021 						iWriter->WriteTest(KAttributeNotSet);
       
  2022 						}
       
  2023 					break;
       
  2024 				case KIdRemoveOp:
       
  2025 					ptr->RemoveAttId();
       
  2026 					break;
       
  2027 				default:
       
  2028 					err = KErrNotSupported;
       
  2029 					break;
       
  2030 				}
       
  2031 			if (err != KErrNone)
       
  2032 				{
       
  2033 				iWriter->WriteTest(KInvalidArgument);
       
  2034 				}
       
  2035 			}
       
  2036 			break;
       
  2037 		case (KSMILElementsmil):
       
  2038 			{
       
  2039 			CMDXMLSMILsmil *ptr = CMDXMLSMILsmil::CastToSMILsmil(iCurrentElement);
       
  2040 			switch(aOp)
       
  2041 				{
       
  2042 				case KIdSetOp:
       
  2043 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  2044 					break;
       
  2045 				case KIdGetOp:
       
  2046 					if( ptr->IsAttIdSpecified() )
       
  2047 						{
       
  2048 						TPtrC attributeValue = ptr->AttId();
       
  2049 						iWriter->WriteTest(attributeValue);
       
  2050 						}
       
  2051 					else
       
  2052 						{
       
  2053 						iWriter->WriteTest(KAttributeNotSet);
       
  2054 						}
       
  2055 					break;
       
  2056 				case KIdRemoveOp:
       
  2057 					ptr->RemoveAttId();
       
  2058 					break;
       
  2059 				default:
       
  2060 					err = KErrNotSupported;
       
  2061 					break;
       
  2062 				}
       
  2063 			if (err != KErrNone)
       
  2064 				{
       
  2065 				iWriter->WriteTest(KInvalidArgument);
       
  2066 				}
       
  2067 			}
       
  2068 			break;
       
  2069 		case (KSMILElementswitch):
       
  2070 			{
       
  2071 			CMDXMLSMILswitch *ptr = CMDXMLSMILswitch::CastToSMILswitch(iCurrentElement);
       
  2072 			switch(aOp)
       
  2073 				{
       
  2074 				case KIdSetOp:
       
  2075 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  2076 					break;
       
  2077 				case KIdGetOp:
       
  2078 					if( ptr->IsAttIdSpecified() )
       
  2079 						{
       
  2080 						TPtrC attributeValue = ptr->AttId();
       
  2081 						iWriter->WriteTest(attributeValue);
       
  2082 						}
       
  2083 					else
       
  2084 						{
       
  2085 						iWriter->WriteTest(KAttributeNotSet);
       
  2086 						}
       
  2087 					break;
       
  2088 				case KIdRemoveOp:
       
  2089 					ptr->RemoveAttId();
       
  2090 					break;
       
  2091 				default:
       
  2092 					err = KErrNotSupported;
       
  2093 					break;
       
  2094 				}
       
  2095 			if (err != KErrNone)
       
  2096 				{
       
  2097 				iWriter->WriteTest(KInvalidArgument);
       
  2098 				}
       
  2099 			}
       
  2100 			break;
       
  2101 		case (KSMILElementtext):
       
  2102 			{
       
  2103 			CMDXMLSMILtext *ptr = CMDXMLSMILtext::CastToSMILtext(iCurrentElement);
       
  2104 			switch(aOp)
       
  2105 				{
       
  2106 				case KIdSetOp:
       
  2107 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  2108 					break;
       
  2109 				case KIdGetOp:
       
  2110 					if( ptr->IsAttIdSpecified() )
       
  2111 						{
       
  2112 						TPtrC attributeValue = ptr->AttId();
       
  2113 						iWriter->WriteTest(attributeValue);
       
  2114 						}
       
  2115 					else
       
  2116 						{
       
  2117 						iWriter->WriteTest(KAttributeNotSet);
       
  2118 						}
       
  2119 					break;
       
  2120 				case KIdRemoveOp:
       
  2121 					ptr->RemoveAttId();
       
  2122 					break;
       
  2123 				default:
       
  2124 					err = KErrNotSupported;
       
  2125 					break;
       
  2126 				}
       
  2127 			if (err != KErrNone)
       
  2128 				{
       
  2129 				iWriter->WriteTest(KInvalidArgument);
       
  2130 				}
       
  2131 			}
       
  2132 			break;
       
  2133 		case (KSMILElementtextstream):
       
  2134 			{
       
  2135 			CMDXMLSMILtextstream *ptr = CMDXMLSMILtextstream::CastToSMILtextstream(iCurrentElement);
       
  2136 			switch(aOp)
       
  2137 				{
       
  2138 				case KIdSetOp:
       
  2139 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  2140 					break;
       
  2141 				case KIdGetOp:
       
  2142 					if( ptr->IsAttIdSpecified() )
       
  2143 						{
       
  2144 						TPtrC attributeValue = ptr->AttId();
       
  2145 						iWriter->WriteTest(attributeValue);
       
  2146 						}
       
  2147 					else
       
  2148 						{
       
  2149 						iWriter->WriteTest(KAttributeNotSet);
       
  2150 						}
       
  2151 					break;
       
  2152 				case KIdRemoveOp:
       
  2153 					ptr->RemoveAttId();
       
  2154 					break;
       
  2155 				default:
       
  2156 					err = KErrNotSupported;
       
  2157 					break;
       
  2158 				}
       
  2159 			if (err != KErrNone)
       
  2160 				{
       
  2161 				iWriter->WriteTest(KInvalidArgument);
       
  2162 				}
       
  2163 			}
       
  2164 			break;
       
  2165 		case (KSMILElementvideo):
       
  2166 			{
       
  2167 			CMDXMLSMILvideo *ptr = CMDXMLSMILvideo::CastToSMILvideo(iCurrentElement);
       
  2168 			switch(aOp)
       
  2169 				{
       
  2170 				case KIdSetOp:
       
  2171 					err = ptr->SetAttIdL((*iArgumentList)[0]);
       
  2172 					break;
       
  2173 				case KIdGetOp:
       
  2174 					if( ptr->IsAttIdSpecified() )
       
  2175 						{
       
  2176 						TPtrC attributeValue = ptr->AttId();
       
  2177 						iWriter->WriteTest(attributeValue);
       
  2178 						}
       
  2179 					else
       
  2180 						{
       
  2181 						iWriter->WriteTest(KAttributeNotSet);
       
  2182 						}
       
  2183 					break;
       
  2184 				case KIdRemoveOp:
       
  2185 					ptr->RemoveAttId();
       
  2186 					break;
       
  2187 				default:
       
  2188 					err = KErrNotSupported;
       
  2189 					break;
       
  2190 				}
       
  2191 			if (err != KErrNone)
       
  2192 				{
       
  2193 				iWriter->WriteTest(KInvalidArgument);
       
  2194 				}
       
  2195 			}
       
  2196 			break;
       
  2197 		
       
  2198 		default:
       
  2199 			iWriter->WriteTest(KUnrecognisedElementType);
       
  2200 			break;
       
  2201 		} //end switch
       
  2202 	}