applayerprotocols/wapbase/dtdmdl/CDTDModel.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2000-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 //
       
    15 
       
    16 // header
       
    17 #include <cdtdmodel.h>
       
    18 
       
    19 #include <attrlut.h>
       
    20 
       
    21 // debug macros
       
    22 #ifdef DEBUG_DTD
       
    23 #include <e32svr.h>
       
    24 _LIT(KDebugInvalidStream, "Stream is INVALID - Unmatched: %S\n");
       
    25 _LIT(KDebugValidStream, "Stream is VALID!"));
       
    26 _LIT(KDebugMatchedText, "Matched \"%S\"\n");
       
    27 #define DEBUG_MATCHED(A) { HBufC* matched = aParser.MarkedL(); CleanupStack::PushL(matched); RDebug::Print(KDebugMatchedText, &_L(A)); CleanupStack::PopAndDelete(); }
       
    28 #define DEBUG_MARK()	 { aParser.Mark(); } // Mark can leave
       
    29 #define DEBUG_UNMARK()	 { aParser.DeleteMark(); }
       
    30 #else
       
    31 #define DEBUG_MATCHED(A) {}
       
    32 #define DEBUG_MARK()	 {}
       
    33 #define DEBUG_UNMARK()	 {}
       
    34 #endif
       
    35 
       
    36 
       
    37 // constants
       
    38 const TInt KValidCharMatchStartStingLength=2;
       
    39 
       
    40 // parser strings
       
    41 #define _STRING(X) _LIT(K ## X, #X)
       
    42 _STRING(Match0Plus);
       
    43 _STRING(Rules);
       
    44 _STRING(Rule);
       
    45 _STRING(Comment);
       
    46 _STRING(optS);
       
    47 _STRING(Space);
       
    48 _STRING(Optional);
       
    49 _STRING(Match1Plus);
       
    50 _STRING(Or);
       
    51 _STRING(And);
       
    52 _STRING(GroupStart);
       
    53 _STRING(GroupEnd);
       
    54 _STRING(SStringStart);
       
    55 _STRING(SStringEnd);
       
    56 _STRING(DStringStart);
       
    57 _STRING(DStringEnd);
       
    58 _STRING(Pop);
       
    59 _STRING(Letter);
       
    60 _STRING(Digit);
       
    61 _STRING(HexNumber);
       
    62 _STRING(DecNumber);
       
    63 _STRING(HexChar);
       
    64 _STRING(DecChar);
       
    65 _STRING(ValidHexChar);
       
    66 _STRING(BaseChar);
       
    67 _STRING(ValidChar);
       
    68 _STRING(SStringChar);
       
    69 _STRING(DStringChar);
       
    70 _STRING(Identifier);
       
    71 _STRING(SString);
       
    72 _STRING(DString);
       
    73 _STRING(String);
       
    74 _STRING(Primary);
       
    75 _STRING(Factor);
       
    76 _STRING(Definition);
       
    77 _STRING(Definitions);
       
    78 _STRING(DataReference);
       
    79 _STRING(AttlistLine);
       
    80 _STRING(EntityDefinition);
       
    81 _STRING(CharRefStream);
       
    82 _STRING(EntityDef);
       
    83 _STRING(ReferenceName);
       
    84 _STRING(EntityDeclName);
       
    85 _STRING(ElementDeclName);
       
    86 _STRING(NameChar);
       
    87 _STRING(AttlistDeclName);
       
    88 _STRING(EntityDecl);
       
    89 _STRING(ElementDecl);
       
    90 _STRING(AttDefRequired);
       
    91 _STRING(AttDefImplied);
       
    92 _STRING(AttDefFixed);
       
    93 _STRING(AttDefault);
       
    94 _STRING(Reference);
       
    95 _STRING(AttlistReference);
       
    96 _STRING(AttlistDef);
       
    97 _STRING(AttlistDecl);
       
    98 _STRING(CommentChar);
       
    99 _STRING(AttfieldName);
       
   100 _STRING(AttfieldTypeName);
       
   101 _STRING(AttValue);
       
   102 _STRING(GEContentS);
       
   103 _STRING(GEContentD);
       
   104 _STRING(GEDecl);
       
   105 _STRING(PEDecl);
       
   106 
       
   107 _LIT(KRefNameInitialChar,	"%");
       
   108 _LIT(KRefNameEndChar,		";");
       
   109 _LIT(KEntityInitialChar,	"%");
       
   110 _LIT(KWhiteSpaceString,		" \n\r\t");
       
   111 _LIT(KQMark,				"?");
       
   112 _LIT(KStar,					"*");
       
   113 _LIT(KPlus,					"+");
       
   114 _LIT(KSpaceChar,			" ");
       
   115 _LIT(KOrCharacter,			"|");
       
   116 _LIT(KAndCharacter,			",");
       
   117 _LIT(KGroupStartChar,		"(");
       
   118 _LIT(KGroupEndChar,			")");
       
   119 _LIT(KStringStartCharacter,	"'");
       
   120 _LIT(KStringEndCharacter,	"'");
       
   121 _LIT(KStringStartCharacter2,"\"");
       
   122 _LIT(KStringEndCharacter2,	"\"");
       
   123 _LIT(KHexCharacterStart,	"&#");
       
   124 _LIT(KHexCharacterEnd,		";");
       
   125 _LIT(KDecCharacterStart,	"#");
       
   126 _LIT(KBaseCharacters,		"-()+,./:=?;!*#@$_%^&<>|");
       
   127 _LIT(KOtherValidCharacters,	"'\"");
       
   128 _LIT(KStringCharacters,		"\"[]");
       
   129 _LIT(KStringCharacters2,	"'[]");
       
   130 _LIT(KCharRefStreamAmpersand, "&");
       
   131 _LIT(KNameOtherCharacters,	".-_:");
       
   132 _LIT(KGEContentCharacters,	"^<&'");
       
   133 _LIT(KGEContentDCharacters, "^<&\"");
       
   134 _LIT(KEntityDeclStart,		"<!ENTITY");
       
   135 _LIT(KEntityDeclEnd,		">");
       
   136 _LIT(KElementDeclStart,		"<!ELEMENT");
       
   137 _LIT(KElementDeclEnd,		">");
       
   138 _LIT(KRequired,				"#REQUIRED");
       
   139 _LIT(KImplied,				"#IMPLIED");
       
   140 _LIT(KFixed,				"#FIXED");
       
   141 _LIT(KCData,				"CDATA");
       
   142 _LIT(KPCData,				"#PCDATA");
       
   143 _LIT(KNMToken,				"NMTOKEN");
       
   144 _LIT(KID,					"ID");
       
   145 _LIT(KAttributeListStart,	"<!ATTLIST");
       
   146 _LIT(KAttlistDeclNameCharacters,"AttlistDeclName");
       
   147 _LIT(KAttributeListEnd,		">");
       
   148 _LIT(KCommentStart,			"<!--");
       
   149 _LIT(KCommentCharacter,		"-");
       
   150 _LIT(KCommentEnd,			"-->");
       
   151 
       
   152 _LIT(KCharRefMatchingPattern, "*&#*;*");
       
   153 
       
   154 
       
   155 /** Allocates and constructs a new DTD parser.
       
   156 
       
   157 @return New parser
       
   158 @param aLUT Attribute lookup table in which to store attributes for the rule tree
       
   159 */
       
   160 EXPORT_C CDTDModel* CDTDModel::NewL(CAttributeLookupTable& aLUT)
       
   161 	{ // static
       
   162 	CDTDModel* model = new (ELeave) CDTDModel(aLUT);
       
   163 	return (model);
       
   164 	}
       
   165 
       
   166 /** Constructor.
       
   167 
       
   168 @param aLUT Attribute lookup table in which to store attributes for the rule tree
       
   169 */
       
   170 EXPORT_C CDTDModel::CDTDModel(CAttributeLookupTable& aLUT)
       
   171 : CBNFParser(aLUT)
       
   172 	{
       
   173 	}
       
   174 
       
   175 
       
   176 /** Destructor. */
       
   177 EXPORT_C CDTDModel::~CDTDModel()
       
   178 	{
       
   179 	DoClear();
       
   180 	}
       
   181 
       
   182 EXPORT_C void CDTDModel::ResetL()
       
   183 /** Reset the parser to a state where it can accept and parse new input.
       
   184 	Any existing state of parsing and input data is destroyed. */
       
   185 	{
       
   186 	CBNFParser::ResetL();
       
   187 	DoClear();
       
   188 	}
       
   189 
       
   190 
       
   191 void CDTDModel::DoClear()
       
   192 	{
       
   193 	delete iNewAttfieldName;
       
   194 	iNewAttfieldName = NULL;
       
   195 	delete iNewElementAttribute;
       
   196 	iNewElementAttribute = NULL;
       
   197 	delete iNewTree;
       
   198 	iNewTree = NULL;
       
   199 	iNewRuleStack.Clear();
       
   200 
       
   201 	iInPEDecl = EFalse;
       
   202 	iCharRefCheck = EFalse;
       
   203 	delete iGEContent;
       
   204 	iGEContent = NULL;
       
   205 	}
       
   206 
       
   207 /** Called when the parser starts a conditional point (i.e. And/Or rules) in the BNF grammar.
       
   208 
       
   209 This overrides CBNFParser::StartConditional().
       
   210 
       
   211 @param aRuleType Rule type
       
   212 */
       
   213 EXPORT_C void CDTDModel::StartConditional(TParserNodeTypes aRuleType)
       
   214 	{
       
   215 	if (aRuleType == EOr)
       
   216 		iNewRuleStack.MarkL(EConditionalMark);
       
   217 	}
       
   218 
       
   219 /** Called when the parser ends a conditional point (i.e. And/Or rules) in the BNF grammar.
       
   220 
       
   221 This overrides CBNFParser::EndConditional().
       
   222 
       
   223 @param aRuleType Rule type
       
   224 @param aSuccess True if processing was sucessful, otherwise false
       
   225 */
       
   226 EXPORT_C void  CDTDModel::EndConditional(TParserNodeTypes aRuleType, TBool aSuccess)
       
   227 	{
       
   228 	if (aRuleType == EOr)
       
   229 		{
       
   230 		if (aSuccess)
       
   231 			iNewRuleStack.RemoveMark(EConditionalMark);
       
   232 		else
       
   233 			iNewRuleStack.DeleteToMark(EConditionalMark);
       
   234 		}
       
   235 	}
       
   236 
       
   237 void CDTDModel::PreRulesL(CBNFParser& aParser)
       
   238 	{ // static
       
   239 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   240 	me.iNewTree = me.NewBNFL();
       
   241 	}
       
   242 
       
   243 
       
   244 #ifdef DEBUG_DTD
       
   245 const TInt KMaxMatchTextDebugOuput=100;
       
   246 
       
   247 void CDTDModel::PostRulesL(CBNFParser& aParser)
       
   248 	{ // static
       
   249 	if (aParser.RuleMatched())
       
   250 		{
       
   251 		if (!aParser.Valid())
       
   252 			{
       
   253 			HBufC* unmatched = aParser.StringL();
       
   254 			RDebug::Print(KDebugInvalidStream, unmatched->Left(Min(KMaxMatchTextDebugOuput, unmatched->Length())));
       
   255 			delete unmatched;
       
   256 			}
       
   257 		else
       
   258 			RDebug::Print(KDebugValidStream);
       
   259 		}
       
   260 	}
       
   261 #else
       
   262 void CDTDModel::PostRulesL(CBNFParser& /*aParser*/)
       
   263 	{ // static
       
   264 	}
       
   265 #endif // DEBUG_DTD
       
   266 
       
   267 
       
   268 
       
   269 void CDTDModel::PreElementDeclL(CBNFParser& aParser)
       
   270 	{ // static
       
   271 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   272 	DEBUG_MARK(); // Mark can leave
       
   273 	me.iNewRuleStack.MarkL(ERuleStartMark);
       
   274 	}
       
   275 
       
   276 void CDTDModel::PostElementDeclL(CBNFParser& aParser)
       
   277 	{ // static
       
   278 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   279 	if (me.RuleMatched())
       
   280 		{
       
   281 		DEBUG_MATCHED("postElementDecl");
       
   282 
       
   283 		me.iNewRuleStack.MergeToMarkL(ERuleStartMark);
       
   284 		CBNFNode* currentRule=me.iNewRuleStack.Pop();
       
   285 		CleanupStack::PushL(currentRule);
       
   286 		currentRule->ReparentL(me.iNewRule);
       
   287 		CleanupStack::Pop(); // currentRule
       
   288 		}
       
   289 	else
       
   290 		me.iNewRuleStack.DeleteToMark(ERuleStartMark);
       
   291 	DEBUG_UNMARK();
       
   292 	}
       
   293 
       
   294 
       
   295 void CDTDModel::PreEntityDeclL(CBNFParser& aParser)
       
   296 	{ // static
       
   297 	DEBUG_MARK(); // Mark can leave
       
   298 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);	
       
   299 	me.iNewRuleStack.MarkL(ERuleStartMark);
       
   300 	}
       
   301 
       
   302 void CDTDModel::PostEntityDeclL(CBNFParser& aParser)
       
   303 	{ // static
       
   304 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   305 	if (me.RuleMatched())
       
   306 		{
       
   307 		DEBUG_MATCHED("postEntityDecl");
       
   308 
       
   309 		if (!me.iNewRuleStack.IsEmpty())
       
   310 			{
       
   311 			me.iNewRuleStack.MergeToMarkL(ERuleStartMark);
       
   312 			CBNFNode* currentRule = me.iNewRuleStack.Pop();
       
   313 			CleanupStack::PushL(currentRule);
       
   314 			currentRule->ReparentL(me.iNewRule);
       
   315 			CleanupStack::Pop(); // currentRule
       
   316 			me.iNewRule->SetType(EAnd);
       
   317 			}
       
   318 		}
       
   319 	else
       
   320 		me.iNewRuleStack.DeleteToMark(ERuleStartMark);
       
   321 
       
   322 	DEBUG_UNMARK();
       
   323 	}
       
   324 
       
   325 
       
   326 void CDTDModel::PreAttlistLineL(CBNFParser& aParser)
       
   327 	{ // static
       
   328 	DEBUG_MARK(); // Mark can leave
       
   329 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   330 	me.iNewRuleStack.MarkL(ERuleStartMark);
       
   331 	if (me.iNewElementAttribute == NULL)
       
   332 		me.iNewElementAttribute = new (ELeave) CDTDElementAttribute();
       
   333 	}
       
   334 
       
   335 void CDTDModel::PostAttlistLineL(CBNFParser& aParser)
       
   336 	{ // static
       
   337 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   338 	if (me.RuleMatched())
       
   339 		{
       
   340 		DEBUG_MATCHED("postAttlistLine");
       
   341 
       
   342 		me.iNewRuleStack.MergeToMarkL(ERuleStartMark);
       
   343 		CBNFNode *currentRule = me.iNewRuleStack.Pop();
       
   344 		if (currentRule)
       
   345 			me.iNewElementAttribute->iType = currentRule;
       
   346 		const HBufC* attNameId = me.AttributeLUT().Des2IDL(*me.iNewAttfieldName);
       
   347 		delete me.iNewAttfieldName;
       
   348 		me.iNewAttfieldName = NULL;
       
   349 
       
   350 		me.iNewRule->AddAttributeL(attNameId, me.iNewElementAttribute);
       
   351 		me.iNewElementAttribute = NULL;
       
   352 		}
       
   353 	else
       
   354 		me.iNewRuleStack.DeleteToMark(ERuleStartMark);
       
   355 
       
   356 	DEBUG_UNMARK();
       
   357 	}
       
   358 
       
   359 void CDTDModel::PostIdentifierL(CBNFParser& aParser)
       
   360 	{ // static
       
   361 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   362 	if (me.RuleMatched())
       
   363 		{
       
   364 		DEBUG_MATCHED("postIdentifier");
       
   365 		HBufC* matched=me.MarkedL();
       
   366 		CleanupStack::PushL(matched);
       
   367 		CBNFNode* newRule = me.NewComponentL(me.iNewTree, *matched);
       
   368 		me.iNewRuleStack.PushL(newRule);
       
   369 		CleanupStack::PopAndDestroy(); // matched
       
   370 		}
       
   371 
       
   372 	me.DeleteMark();
       
   373 	}
       
   374 
       
   375 void CDTDModel::PostReferenceNameL(CBNFParser& aParser)
       
   376 	{ // static
       
   377 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   378 	if (me.RuleMatched())
       
   379 		{
       
   380 		DEBUG_MATCHED("postReferenceName");
       
   381 		HBufC* matched = me.MarkedWithInitialTextL(KRefNameInitialChar);
       
   382 		CleanupStack::PushL(matched);
       
   383 		CBNFNode* newRule = me.NewComponentL(me.iNewTree, *matched);
       
   384 		me.iNewRuleStack.PushL(newRule);
       
   385 		CleanupStack::PopAndDestroy(); // matched
       
   386 		}
       
   387 
       
   388 	me.DeleteMark();
       
   389 	}
       
   390 
       
   391 void 
       
   392 CDTDModel::PostAttlistReferenceL(CBNFParser& aParser)
       
   393 	{ // static
       
   394 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   395 	if (me.RuleMatched())
       
   396 		{
       
   397 		me.iNewRuleStack.MergeToMarkL(ERuleStartMark);
       
   398 		CBNFNode *currentRule = me.iNewRuleStack.Pop();
       
   399 		if (currentRule)
       
   400 			me.iNewElementAttribute->iType = currentRule;
       
   401         me.iNewElementAttribute->iValueType = CDTDElementAttribute::EReference;
       
   402         const TDesC* unique = REINTERPRET_CAST(const TDesC*, me.iNewElementAttribute);
       
   403 		me.iNewRule->AddAttributeL(unique, me.iNewElementAttribute);
       
   404 		me.iNewElementAttribute = NULL;
       
   405 		}
       
   406 	else
       
   407 		me.iNewRuleStack.DeleteToMark(ERuleStartMark);
       
   408 	}
       
   409 
       
   410 void CDTDModel::PostEntityDeclNameL(CBNFParser& aParser)
       
   411 	{ // static
       
   412 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   413 	if (me.RuleMatched())
       
   414 		{
       
   415 		DEBUG_MATCHED("postEntityDeclName");
       
   416 
       
   417 		HBufC* matched=NULL;
       
   418 		if(me.iInPEDecl)
       
   419 			matched=me.MarkedWithInitialTextL(KEntityInitialChar);
       
   420 		else
       
   421 			matched=me.MarkedL();
       
   422 		CleanupStack::PushL(matched);
       
   423 		CBNFNode& newRule = me.NewRuleL(me.iNewTree, *matched, EIncomplete, NULL, NULL, NULL);
       
   424 		me.iNewRule = &newRule;
       
   425 		CleanupStack::PopAndDestroy(); // matched	
       
   426 		}
       
   427 	
       
   428 	me.DeleteMark();
       
   429 	}
       
   430 
       
   431 void CDTDModel::PostElementDeclNameL(CBNFParser& aParser)
       
   432 	{ // static
       
   433 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   434 	if (me.RuleMatched())
       
   435 		{
       
   436 		DEBUG_MATCHED("postElementDeclName");
       
   437 
       
   438 		HBufC* matched = me.MarkedL();
       
   439 		CleanupStack::PushL(matched);
       
   440 		CBNFNode& newRule = me.NewRuleL(me.iNewTree, *matched, EAnd, NULL, NULL, NULL);
       
   441 		me.iNewRule = &newRule;
       
   442 		CleanupStack::PopAndDestroy(); // matched		
       
   443 		}
       
   444 
       
   445 	me.DeleteMark();
       
   446 	}
       
   447 
       
   448 
       
   449 void CDTDModel::PostAttlistDeclNameL(CBNFParser& aParser)
       
   450 	{ // static
       
   451 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   452 	if (me.RuleMatched())
       
   453 		DEBUG_MATCHED("postAttlistDeclName");
       
   454 
       
   455 	me.DeleteMark();
       
   456 	}
       
   457 
       
   458 void CDTDModel::PostAttfieldNameL(CBNFParser& aParser)
       
   459 	{ // static
       
   460 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   461 	if (me.RuleMatched())
       
   462 		{
       
   463 		DEBUG_MATCHED("postAttfieldName");
       
   464 		HBufC* matched=me.MarkedL();
       
   465 		delete me.iNewAttfieldName;
       
   466 		me.iNewAttfieldName = matched;
       
   467 		}
       
   468 
       
   469 	me.DeleteMark();
       
   470 	}
       
   471 
       
   472 void CDTDModel::PreAttValueL(CBNFParser& aParser)
       
   473 	{ // static
       
   474 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   475 	me.iNewRuleStack.MarkL(ERuleStartMark);
       
   476 	}
       
   477 
       
   478 void  CDTDModel::PostAttValueL(CBNFParser& aParser)
       
   479 	{ // static
       
   480 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   481 	if (me.RuleMatched())
       
   482 		{
       
   483 		me.iNewRuleStack.MergeToMarkL(ERuleStartMark);
       
   484 		CBNFNode *currentRule = me.iNewRuleStack.Pop();
       
   485         // ASSUME me.iNewElementAttribute != NULL
       
   486 		if (currentRule)
       
   487 			me.iNewElementAttribute->iValue = currentRule;
       
   488 		}
       
   489 	else
       
   490 		me.iNewRuleStack.DeleteToMark(ERuleStartMark);
       
   491 	}
       
   492 
       
   493 void CDTDModel::PostRequiredL(CBNFParser& aParser)
       
   494 	{ // static
       
   495 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   496 	if (me.RuleMatched())
       
   497 		{
       
   498         // ASSUME me.iNewElementAttribute != NULL
       
   499         me.iNewElementAttribute->iValueType = CDTDElementAttribute::ERequired;
       
   500 		}
       
   501 	}
       
   502 
       
   503 void CDTDModel::PostImpliedL(CBNFParser& aParser)
       
   504 	{ // static
       
   505 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   506 	if (me.RuleMatched())
       
   507 		{
       
   508         // ASSUME me.iNewElementAttribute != NULL
       
   509         me.iNewElementAttribute->iValueType = CDTDElementAttribute::EImplied;
       
   510 		}
       
   511 	}
       
   512 void 
       
   513 CDTDModel::PostFixedL(CBNFParser& aParser)
       
   514 	{ // static
       
   515 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   516 	if (me.RuleMatched())
       
   517 		{
       
   518         // ASSUME me.iNewElementAttribute != NULL
       
   519         me.iNewElementAttribute->iValueType = CDTDElementAttribute::EFixed;
       
   520 		}
       
   521 	}
       
   522 
       
   523 void CDTDModel::PostAndL(CBNFParser& aParser)
       
   524 	{ // static
       
   525 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   526 	if (me.RuleMatched())
       
   527 		{
       
   528 		CBNFNode *currentRule = me.iNewRuleStack.Head();
       
   529 		if (currentRule->Type() != EAnd)
       
   530 			{
       
   531 			CBNFNode* newRule = me.NewComponentL(EAnd);
       
   532 			CleanupStack::PushL(newRule);
       
   533 			CBNFNode* currentRule = me.iNewRuleStack.Pop();
       
   534 			CleanupStack::PushL(currentRule);
       
   535 			currentRule->ReparentL(newRule);
       
   536 			CleanupStack::Pop(2); // currentRule, newRule
       
   537 			me.iNewRuleStack.PushL(newRule);
       
   538 			}
       
   539 		}
       
   540 	}
       
   541 
       
   542 
       
   543 
       
   544 void CDTDModel::PostRuleL(CBNFParser& aParser, TParserNodeTypes aType, const TDesC* aAttribute)
       
   545 	{ // static
       
   546 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   547 	if (me.RuleMatched())
       
   548 		{
       
   549 		CBNFNode *currentRule = me.iNewRuleStack.Head();
       
   550 		if (currentRule->Type()!=aType)
       
   551 			{
       
   552 			CBNFNode* newRule = me.NewComponentL(aType);
       
   553 			CleanupStack::PushL(newRule);
       
   554 
       
   555 			if (aAttribute)
       
   556 				me.AddComponentAttributeL(*newRule, aAttribute, 1);
       
   557 
       
   558 			CBNFNode* currentRule = me.iNewRuleStack.Pop();
       
   559 			CleanupStack::PushL(currentRule);
       
   560 			currentRule->ReparentL(newRule);
       
   561 			CleanupStack::Pop(2); // currentRule, newRule
       
   562 			me.iNewRuleStack.PushL(newRule);
       
   563 			}
       
   564 		}
       
   565 	}
       
   566 
       
   567 
       
   568 void CDTDModel::PostOrL(CBNFParser& aParser)
       
   569 	{ // static
       
   570 	PostRuleL(aParser, EOr, NULL);
       
   571 	}
       
   572 
       
   573 void CDTDModel::PostOptionalL(CBNFParser& aParser)
       
   574 	{ // static
       
   575 	PostRuleL(aParser, EOptional, NULL);
       
   576 	}
       
   577 
       
   578 void CDTDModel::PostMatch0PlusL(CBNFParser& aParser)
       
   579 	{ // static
       
   580 	PostRuleL(aParser, ENMore, NULL);
       
   581 	}
       
   582 
       
   583 void CDTDModel::PostMatch1PlusL(CBNFParser& aParser)
       
   584 	{ // static
       
   585 	PostRuleL(aParser, ENMore, CBNFNode::KNMoreMinimum());
       
   586 	}
       
   587 	
       
   588 void CDTDModel::PreGroupL(CBNFParser& aParser)
       
   589 	{ // static
       
   590 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   591 	me.iNewRuleStack.MarkL(EGroupMark);
       
   592 	}
       
   593 
       
   594 void CDTDModel::PostGroupL(CBNFParser& aParser)
       
   595 	{ // static
       
   596 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   597 	if (aParser.RuleMatched())
       
   598 		me.iNewRuleStack.MergeToMarkL(EGroupMark);
       
   599 	else
       
   600 		me.iNewRuleStack.RemoveMark(EGroupMark);
       
   601 	}
       
   602 
       
   603 
       
   604 void CDTDModel::PostStringL(CBNFParser& aParser)
       
   605 	{ // static
       
   606 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   607 
       
   608 	if (me.RuleMatched() && !me.iCharRefCheck)
       
   609 		{
       
   610 		DEBUG_MATCHED("postString");
       
   611 		HBufC* matched = me.MarkedL();
       
   612 		CBNFNode* newRule = me.NewComponentL(EExact, matched);
       
   613 		me.iNewRuleStack.PushL(newRule);
       
   614 		}
       
   615 
       
   616 	me.DeleteMark();
       
   617 	}
       
   618 
       
   619 
       
   620 void CDTDModel::PostValidCharL(CBNFParser& aParser, TRadix aRadix)
       
   621 	{ // static
       
   622 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   623 
       
   624 	if (me.RuleMatched())
       
   625 		{
       
   626 		DEBUG_MATCHED("postValidChar");		
       
   627 		HBufC* matched = me.MarkedL();
       
   628 		CleanupStack::PushL(matched);
       
   629 		TLex lex(matched->Mid(KValidCharMatchStartStingLength));
       
   630 		TUint32 value;
       
   631 		lex.Val(value, aRadix);
       
   632 		HBufC* hexChar = HBufC::NewL(1);
       
   633 		hexChar->Des().Append(TChar(value));
       
   634 		CBNFNode* newRule = me.NewComponentL(EExact, hexChar);
       
   635 		me.iNewRuleStack.PushL(newRule);
       
   636 		CleanupStack::PopAndDestroy(); // matched
       
   637 		}
       
   638 
       
   639 	me.DeleteMark();
       
   640 	}
       
   641 
       
   642 void CDTDModel::PostValidHexCharL(CBNFParser& aParser)
       
   643 	{ // static
       
   644 	PostValidCharL(aParser, EHex);
       
   645 	}
       
   646 
       
   647 void CDTDModel::PostValidDecCharL(CBNFParser& aParser)
       
   648 	{ // static
       
   649 	PostValidCharL(aParser, EDecimal);
       
   650 	}
       
   651 
       
   652 
       
   653 void CDTDModel::PreGEContentL(CBNFParser& aParser)
       
   654 	{ // static
       
   655 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   656 
       
   657 	me.iCharRefCheck = ETrue;
       
   658 	me.Mark();	 // Mark can leave
       
   659 	}
       
   660 
       
   661 void CDTDModel::PostGEContentL(CBNFParser& aParser)
       
   662 	{ // static
       
   663 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   664 
       
   665 	if (me.RuleMatched())
       
   666 		{
       
   667 		HBufC* matched=me.MarkedL();
       
   668 		delete me.iGEContent;
       
   669 		me.iGEContent=matched;
       
   670 		TPtr string=me.iGEContent->Des();
       
   671 		me.CharRefReplacement(string);
       
   672 		}
       
   673 	me.iCharRefCheck=EFalse;
       
   674 	me.DeleteMark();
       
   675 	}
       
   676 
       
   677 void CDTDModel::PostGEDeclL(CBNFParser& aParser)
       
   678 	{ // static
       
   679 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   680 
       
   681 	if (me.RuleMatched())
       
   682 		{
       
   683 		CBNFNode* newRule = me.NewComponentL(EExact, me.iGEContent);
       
   684 		me.iGEContent=NULL;
       
   685 		me.iNewRuleStack.PushL(newRule);		
       
   686 		}
       
   687 	}
       
   688 
       
   689 void CDTDModel::PrePEDeclL(CBNFParser& aParser)
       
   690 	{ // static
       
   691 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   692 
       
   693 	me.iInPEDecl = ETrue;
       
   694 	}
       
   695 
       
   696 void CDTDModel::PostPEDeclL(CBNFParser& aParser)
       
   697 	{ // static
       
   698 	CDTDModel& me = REINTERPRET_CAST(CDTDModel&, aParser);
       
   699 
       
   700 	me.iInPEDecl = EFalse;
       
   701 	}
       
   702 
       
   703 /** Creates a BNF rule tree to parse the input stream.
       
   704 
       
   705 This overrides CBNFParser::TreeL().
       
   706 
       
   707 @return BNF rule tree
       
   708 */
       
   709 EXPORT_C CBNFNode* CDTDModel::TreeL()
       
   710 	{
       
   711     CBNFNode* root = NewBNFL();
       
   712 	CleanupStack::PushL(root);
       
   713 
       
   714 	NewComponentL(root, *root, KRules);
       
   715 
       
   716 	// Rules ::= ((S? Comment) | Rule )+ S?
       
   717 //#pragma message(__FILE__ " note : Parameter entity references in the document body")
       
   718 // It is possible, that there is a parameter entity reference in
       
   719 // document body. This should be replaced with its corresponding replacement
       
   720 // text and then processed.
       
   721 	CBNFNode& Rules = NewRuleL(root, KRules, EAnd, NULL, PreRulesL, PostRulesL);
       
   722 	CBNFNode& Rules1 = NewComponentL(Rules, ENMore);
       
   723 	CBNFNode& Rules2 = NewComponentL(Rules1, EOr);
       
   724 	CBNFNode& Rules3 = NewComponentL(Rules2, EAnd);
       
   725 	NewComponentL(root, Rules3, KoptS);
       
   726 	NewComponentL(root, Rules3, KComment);
       
   727 	NewComponentL(root, Rules2, KRule);
       
   728 	AddComponentAttributeL(Rules1, CBNFNode::KNMoreMinimum(), 1);
       
   729 	NewComponentL(root, Rules, KoptS);
       
   730 
       
   731 	// Space ::= #x20 | #x9 | #x d | #xa
       
   732 	NewRuleL(root, KSpace, ESelect, KWhiteSpaceString, NULL, NULL);
       
   733 	// OptionalSpace ::= Space* 
       
   734 	CBNFNode& optSpace = NewRuleL(root, KoptS, ENMore, NULL, NULL, NULL);
       
   735 	NewComponentL(root, optSpace, KSpace);
       
   736 
       
   737 	// Optional ::= '?'
       
   738 	NewRuleL(root, KOptional, EExact, KQMark, NULL, PostOptionalL);
       
   739 	// Match 0 or More := '*'
       
   740 	NewRuleL(root, KMatch0Plus, EExact, KStar, NULL, PostMatch0PlusL);
       
   741 	// Match 1 or More := '+'
       
   742 	NewRuleL(root, KMatch1Plus, EExact, KPlus, NULL, PostMatch1PlusL);
       
   743 	// Or ::= '|'
       
   744 	NewRuleL(root, KOr, EExact, KOrCharacter, NULL, PostOrL);
       
   745 	// And ::= ','
       
   746 	NewRuleL(root, KAnd, EExact, KAndCharacter, NULL, PostAndL);
       
   747 	// GroupStart ::= '('
       
   748 	NewRuleL(root, KGroupStart, EExact, KGroupStartChar, PreGroupL, NULL);
       
   749 	// GroupEnd ::= ')'
       
   750 	NewRuleL(root, KGroupEnd, EExact, KGroupEndChar, PostGroupL, NULL);
       
   751 	// SStringStart ::= '''
       
   752 	NewRuleL(root, KSStringStart, EExact, KStringStartCharacter, NULL, NULL);
       
   753 	// SStringEnd ::= '''
       
   754 	NewRuleL(root, KSStringEnd, EExact, KStringEndCharacter, NULL, NULL);
       
   755 	// DStringStart ::= '"'
       
   756 	NewRuleL(root, KDStringStart, EExact, KStringStartCharacter2, NULL, NULL);
       
   757 	// DStringEnd ::= '"'
       
   758 	NewRuleL(root, KDStringEnd, EExact, KStringEndCharacter2, NULL, NULL);
       
   759 
       
   760 	// PostOp ::= Optional | Macth0Plus | Match1Plus
       
   761     CBNFNode& Pop = NewRuleL(root, KPop, EOr, NULL, NULL, NULL);
       
   762 	NewComponentL(root, Pop, KOptional);
       
   763 	NewComponentL(root, Pop, KMatch0Plus);
       
   764 	NewComponentL(root, Pop, KMatch1Plus);
       
   765 
       
   766 	// Letter ::= [A-Za-z]
       
   767 	CBNFNode& letter = NewRuleL(root, KLetter, EOr, NULL, NULL, NULL);
       
   768 	CBNFNode& letter1 = NewComponentL(letter, ERange);
       
   769 	AddComponentAttributeL(letter1, CBNFNode::KRangeStart(), 'A');
       
   770 	AddComponentAttributeL(letter1, CBNFNode::KRangeEnd(), 'Z');
       
   771 	CBNFNode& letter2 = NewComponentL(letter, ERange);
       
   772 	AddComponentAttributeL(letter2, CBNFNode::KRangeStart(), 'a');
       
   773 	AddComponentAttributeL(letter2, CBNFNode::KRangeEnd(), 'z');
       
   774 
       
   775 	// Digit ::= [0-9]
       
   776 	CBNFNode& Digit = NewRuleL(root, KDigit, ERange, NULL, NULL, NULL);
       
   777 	AddComponentAttributeL(Digit, CBNFNode::KRangeStart(), '0');
       
   778 	AddComponentAttributeL(Digit, CBNFNode::KRangeEnd(), '9');
       
   779 
       
   780 	// HexNumber ::= (Digit | [a-fA-f])+
       
   781     CBNFNode& HexNumber = NewRuleL(root, KHexNumber, ENMore, NULL, NULL, NULL);
       
   782 	AddComponentAttributeL(HexNumber, CBNFNode::KNMoreMinimum(), 1);
       
   783 	CBNFNode& HexNumber1 = NewComponentL(HexNumber, EOr);
       
   784 	NewComponentL(root, HexNumber1, KDigit);
       
   785 	CBNFNode& HexNumber2 = NewComponentL(HexNumber1, ERange);
       
   786 	AddComponentAttributeL(HexNumber2, CBNFNode::KRangeStart(), 'a');
       
   787 	AddComponentAttributeL(HexNumber2, CBNFNode::KRangeEnd(), 'f');
       
   788 	CBNFNode& HexNumber3 = NewComponentL(HexNumber1, ERange);
       
   789 	AddComponentAttributeL(HexNumber3, CBNFNode::KRangeStart(), 'A');
       
   790 	AddComponentAttributeL(HexNumber3, CBNFNode::KRangeEnd(), 'F');
       
   791 
       
   792 	// DecNumber ::= Digit+
       
   793     CBNFNode& DecNumber = NewRuleL(root, KDecNumber, ENMore, NULL, NULL, NULL);
       
   794 	AddComponentAttributeL(DecNumber, CBNFNode::KNMoreMinimum(), 1);
       
   795 	NewComponentL(root, DecNumber, KDigit);
       
   796 
       
   797 	// HexChar ::= "#x" HexNumber ";"
       
   798     CBNFNode& HexChar = NewRuleL(root, KHexChar, EAnd, NULL, NULL, NULL);
       
   799 	NewComponentL(HexChar, EExact, KHexCharacterStart);
       
   800 	NewComponentL(root, HexChar, KHexNumber);
       
   801 	NewComponentL(HexChar, EExact, KHexCharacterEnd);
       
   802 
       
   803 	// DecChar ::= "#" DecNumber ";"
       
   804     CBNFNode& DecChar = NewRuleL(root, KDecChar, EAnd, NULL, NULL, NULL);
       
   805 	NewComponentL(DecChar, EExact, KDecCharacterStart);
       
   806 	NewComponentL(root, DecChar, KDecNumber);
       
   807 	NewComponentL(DecChar, EExact, KHexCharacterEnd);
       
   808 
       
   809 	// ValidHexChar ::= HexChar
       
   810     CBNFNode& ValidHexChar = NewRuleL(root, KValidHexChar, EAnd, NULL, MarkCallback, PostValidHexCharL);
       
   811 	NewComponentL(root, ValidHexChar, KHexChar);
       
   812 
       
   813 	// BaseChar ::= ' ' | Letter | Digit | [-()+,./:=?;!*#@$_%^&<>|]
       
   814     CBNFNode& BaseChar = NewRuleL(root, KBaseChar, EOr, NULL, NULL, NULL);
       
   815 	NewComponentL(BaseChar, EExact, KSpaceChar);
       
   816 	NewComponentL(root, BaseChar, KLetter);
       
   817 	NewComponentL(root, BaseChar, KDigit);
       
   818 	NewComponentL(BaseChar, ESelect, KBaseCharacters);
       
   819 
       
   820 	// ValidChar ::= BaseChar | ValidHexChar | ['"]
       
   821     CBNFNode& ValidChar = NewRuleL(root, KValidChar, EOr, NULL, NULL, NULL);
       
   822 	NewComponentL(root, ValidChar, KBaseChar);
       
   823 	NewComponentL(root, ValidChar, KValidHexChar);
       
   824 	NewComponentL(ValidChar, ESelect, KOtherValidCharacters);
       
   825 
       
   826 	// SStringChar ::= BaseChar | ["[]] | S
       
   827     CBNFNode& SStringChar = NewRuleL(root, KSStringChar, EOr, NULL, NULL, NULL);
       
   828 	NewComponentL(root, SStringChar, KBaseChar);
       
   829 	NewComponentL(SStringChar, ESelect, KStringCharacters);
       
   830 	NewComponentL(root, SStringChar, KSpace);
       
   831 
       
   832 	// DStringChar ::= BaseChar | ['[]] | S
       
   833     CBNFNode& DStringChar = NewRuleL(root, KDStringChar, EOr, NULL, NULL, NULL);
       
   834 	NewComponentL(root, DStringChar, KBaseChar);
       
   835 	NewComponentL(DStringChar, ESelect, KStringCharacters2);
       
   836 	NewComponentL(root, DStringChar, KSpace);
       
   837 
       
   838 	// Identifier ::= Letter (Letter | Digit)*
       
   839     CBNFNode& identifier = NewRuleL(root, KIdentifier, EAnd, NULL, MarkCallback, PostIdentifierL);
       
   840 	NewComponentL(root, identifier, KLetter);
       
   841 	CBNFNode& identifier1 = NewComponentL(identifier, ENMore);
       
   842 	CBNFNode& identifier2 = NewComponentL(identifier1, EOr);
       
   843 	NewComponentL(root, identifier2, KLetter);
       
   844 	NewComponentL(root, identifier2, KDigit);
       
   845 
       
   846 	// SString ::= SStringChar+
       
   847     CBNFNode& sstring = NewRuleL(root, KSString, ENMore, NULL, MarkCallback, PostStringL);
       
   848 	AddComponentAttributeL(sstring, CBNFNode::KNMoreMinimum(), 1);
       
   849 	NewComponentL(root, sstring, KSStringChar);
       
   850 
       
   851 	// DString ::= DStringChar+
       
   852     CBNFNode& dstring = NewRuleL(root, KDString, ENMore, NULL, MarkCallback, PostStringL);
       
   853 	AddComponentAttributeL(dstring, CBNFNode::KNMoreMinimum(), 1);
       
   854 	NewComponentL(root, dstring, KDStringChar);
       
   855 
       
   856 	// String ::= SStringStart SString SStringEnd
       
   857 	//            | DStringStart DString DStringEnd
       
   858 	//            | ValidHexChar
       
   859     CBNFNode& string = NewRuleL(root, KString, EOr, NULL, NULL, NULL);
       
   860 	CBNFNode& string1 = NewComponentL(string, EAnd);
       
   861 	NewComponentL(root, string1, KSStringStart);
       
   862 	NewComponentL(root, string1, KSString);
       
   863 	NewComponentL(root, string1, KSStringEnd);
       
   864 	CBNFNode& string2 = NewComponentL(string, EAnd);
       
   865 	NewComponentL(root, string2, KDStringStart);
       
   866 	NewComponentL(root, string2, KDString);
       
   867 	NewComponentL(root, string2, KDStringEnd);
       
   868 	NewComponentL(root, string, KValidHexChar);
       
   869 
       
   870     // Primary ::= S? (GroupStart Definitions S? GroupEnd
       
   871 	//				  | DataReference
       
   872 	//                | Identifier
       
   873 	//                | String)
       
   874 	CBNFNode& Primary = NewRuleL(root, KPrimary, EAnd, NULL, NULL, NULL);
       
   875 	NewComponentL(root, Primary, KoptS);
       
   876 	CBNFNode& Primary0 = NewComponentL(Primary, EOr);
       
   877 
       
   878 	CBNFNode& Primary4 = NewComponentL(Primary0, EAnd);
       
   879 	NewComponentL(root, Primary4, KGroupStart);
       
   880 	NewComponentL(root, Primary4, KDefinitions);
       
   881 	NewComponentL(root, Primary4, KoptS);
       
   882 	NewComponentL(root, Primary4, KGroupEnd);
       
   883 
       
   884 	NewComponentL(root, Primary0, KDataReference);
       
   885 	NewComponentL(root, Primary0, KIdentifier);
       
   886 	NewComponentL(root, Primary0, KString);
       
   887 
       
   888 	// Factor ::= Primary Pop?
       
   889 	CBNFNode& Factor = NewRuleL(root, KFactor, EAnd, NULL, NULL, NULL);
       
   890 	NewComponentL(root, Factor, KPrimary);
       
   891 	CBNFNode& Factor1 = NewComponentL(Factor, EOptional);
       
   892 	NewComponentL(root, Factor1, KPop);
       
   893 	
       
   894 	// Definition ::= Factor (S? And Factor)*
       
   895 	CBNFNode& Definition = NewRuleL(root, KDefinition, EAnd, NULL, NULL, NULL);
       
   896 	NewComponentL(root, Definition, KFactor);
       
   897 	CBNFNode& Definition1 = NewComponentL(Definition, ENMore);
       
   898 	CBNFNode& Definition2 = NewComponentL(Definition1, EAnd);
       
   899 	NewComponentL(root, Definition2, KoptS);
       
   900 	NewComponentL(root, Definition2, KAnd);
       
   901 	NewComponentL(root, Definition2, KFactor);
       
   902 
       
   903 	// Definitions ::= Definition (S? Or Definition)*
       
   904 	CBNFNode& Definitions = NewRuleL(root, KDefinitions, EAnd, NULL, NULL, NULL);
       
   905 	NewComponentL(root, Definitions, KDefinition);
       
   906 	CBNFNode& Definitions1 = NewComponentL(Definitions, ENMore);
       
   907 	CBNFNode& Definitions2 = NewComponentL(Definitions1, EAnd);
       
   908 	NewComponentL(root, Definitions2, KoptS);
       
   909 	NewComponentL(root, Definitions2, KOr);
       
   910 	NewComponentL(root, Definitions2, KDefinition);
       
   911 
       
   912 	// EntityDefinition ::= (S? AttlistLine)+ | Definition
       
   913     CBNFNode& EntityDefinition = NewRuleL(root, KEntityDefinition, EOr, NULL, NULL, NULL);
       
   914 	CBNFNode& EntityDefinition1 = NewComponentL(EntityDefinition, ENMore);
       
   915 	CBNFNode& EntityDefinition11 = NewComponentL(EntityDefinition1, EAnd);
       
   916 	NewComponentL(root, EntityDefinition11, KoptS);
       
   917 	NewComponentL(root, EntityDefinition11, KAttlistLine);
       
   918 	AddComponentAttributeL(EntityDefinition1, CBNFNode::KNMoreMinimum(), 1);
       
   919 	NewComponentL(root, EntityDefinition, KDefinitions);
       
   920 
       
   921 	// CharRefStream ::= "&" (DecChar | HexChar)+
       
   922     CBNFNode& CharRefStream = NewRuleL(root, KCharRefStream, EAnd, NULL, MarkCallback, PostStringL);
       
   923 	NewComponentL(CharRefStream, EExact, KCharRefStreamAmpersand);
       
   924 	CBNFNode& CharRefStream1 = NewComponentL(CharRefStream, ENMore);
       
   925 	AddComponentAttributeL(CharRefStream1, CBNFNode::KNMoreMinimum(), 1);
       
   926 	CBNFNode& CharRefStream2 = NewComponentL(CharRefStream1, EOr);
       
   927 	NewComponentL(root, CharRefStream2, KDecChar);
       
   928 	NewComponentL(root, CharRefStream2, KHexChar);
       
   929 
       
   930 	// EntityDef ::= DStringStart (CharRefStream | EntityDefinition) DStringEnd
       
   931 //#pragma message(__FILE__ " note : An entity (also a Parameter entity) can be surrounded with single quotes, too")
       
   932     CBNFNode& EntityDef = NewRuleL(root, KEntityDef, EAnd, NULL, NULL, NULL);
       
   933 	NewComponentL(root, EntityDef, KDStringStart);
       
   934 	CBNFNode& EntityDef1 = NewComponentL(EntityDef, EOr);
       
   935 	NewComponentL(root, EntityDef1, KCharRefStream);
       
   936 	NewComponentL(root, EntityDef1, KEntityDefinition);
       
   937 	NewComponentL(root, EntityDef, KDStringEnd);
       
   938 
       
   939 	// ReferenceName ::= Identifier
       
   940     CBNFNode& ReferenceName = NewRuleL(root, KReferenceName, EAnd, NULL, MarkCallback, PostReferenceNameL);
       
   941 	NewComponentL(root, ReferenceName, KLetter);
       
   942 	CBNFNode& ReferenceName1 = NewComponentL(ReferenceName, ENMore);
       
   943 	CBNFNode& ReferenceName2 = NewComponentL(ReferenceName1, EOr);
       
   944 	NewComponentL(root, ReferenceName2, KLetter);
       
   945 	NewComponentL(root, ReferenceName2, KDigit);
       
   946 
       
   947 	// EntityDeclName ::= Identifier
       
   948     CBNFNode& EntityDeclName = NewRuleL(root, KEntityDeclName, EAnd, NULL, MarkCallback, PostEntityDeclNameL);
       
   949 	NewComponentL(root, EntityDeclName, KLetter);
       
   950 	CBNFNode& EntityDeclName1 = NewComponentL(EntityDeclName, ENMore);
       
   951 	CBNFNode& EntityDeclName2 = NewComponentL(EntityDeclName1, EOr);
       
   952 	NewComponentL(root, EntityDeclName2, KLetter);
       
   953 	NewComponentL(root, EntityDeclName2, KDigit);
       
   954 
       
   955 	// ElementDeclName ::= Letter (Letter | Digit)*
       
   956     CBNFNode& ElementDeclName = NewRuleL(root, KElementDeclName, EAnd, NULL, MarkCallback, PostElementDeclNameL);
       
   957 	NewComponentL(root, ElementDeclName, KLetter);
       
   958 	CBNFNode& ElementDeclName1 = NewComponentL(ElementDeclName, ENMore);
       
   959 	CBNFNode& ElementDeclName2 = NewComponentL(ElementDeclName1, EOr);
       
   960 	NewComponentL(root, ElementDeclName2, KLetter);
       
   961 	NewComponentL(root, ElementDeclName2, KDigit);
       
   962 
       
   963 	// NameChar ::= Letter | Digit | [.-_:]
       
   964     CBNFNode& NameChar = NewRuleL(root, KNameChar, EOr, NULL, NULL, NULL);
       
   965 	NewComponentL(root, NameChar, KLetter);
       
   966 	NewComponentL(root, NameChar, KDigit);
       
   967 	NewComponentL(NameChar, ESelect, KNameOtherCharacters);
       
   968 
       
   969 	// AttlistDeclName ::= Letter (Letter | Digit)*
       
   970     CBNFNode& AttlistDeclName = NewRuleL(root, KAttlistDeclName, EAnd, NULL, MarkCallback, PostAttlistDeclNameL);
       
   971 	NewComponentL(root, AttlistDeclName, KLetter);
       
   972 	CBNFNode& AttlistDeclName1 = NewComponentL(AttlistDeclName, ENMore);
       
   973 	CBNFNode& AttlistDeclName2 = NewComponentL(AttlistDeclName1, EOr);
       
   974 	NewComponentL(root, AttlistDeclName2, KLetter);
       
   975 	NewComponentL(root, AttlistDeclName2, KDigit);
       
   976 
       
   977 	// AttfieldName ::= NameChar (NameChar | Digit)*
       
   978     CBNFNode& AttfieldName = NewRuleL(root, KAttfieldName, EAnd, NULL, MarkCallback, PostAttfieldNameL);
       
   979 	NewComponentL(root, AttfieldName, KNameChar);
       
   980 	CBNFNode& AttfieldName1 = NewComponentL(AttfieldName, ENMore);
       
   981 	CBNFNode& AttfieldName2 = NewComponentL(AttfieldName1, EOr);
       
   982 	NewComponentL(root, AttfieldName2, KNameChar);
       
   983 	NewComponentL(root, AttfieldName2, KDigit);
       
   984 
       
   985 	// AttfieldTypeName ::= Letter (Letter | Digit)*
       
   986     CBNFNode& AttfieldTypeName = NewRuleL(root, KAttfieldTypeName, EAnd, NULL, NULL, NULL);
       
   987 	NewComponentL(root, AttfieldTypeName, KLetter);
       
   988 	CBNFNode& AttfieldTypeName1 = NewComponentL(AttfieldTypeName, ENMore);
       
   989 	CBNFNode& AttfieldTypeName2 = NewComponentL(AttfieldTypeName1, EOr);
       
   990 	NewComponentL(root, AttfieldTypeName2, KLetter);
       
   991 	NewComponentL(root, AttfieldTypeName2, KDigit);
       
   992 
       
   993 	// AttValue ::= SStringStart (CharRefStream | ReferenceName) SStringEnd
       
   994 	//            | DStringStart (CharRefStream | ReferenceName) DStringEnd
       
   995 //#pragma message(__FILE__ " note : AttValue may contain several references")
       
   996 // It is possible for the attribute value to contain several character
       
   997 // references and parameter references, too. The complete attribute value
       
   998 // should be stored as whole string, so that it can be used in the actual
       
   999 // parser
       
  1000     CBNFNode& AttValue = NewRuleL(root, KAttValue, EOr, NULL, PreAttValueL, PostAttValueL);
       
  1001 	CBNFNode& AttValue1 = NewComponentL(AttValue, EAnd);
       
  1002 	NewComponentL(root, AttValue1, KSStringStart);
       
  1003 	CBNFNode& AttValue11 = NewComponentL(AttValue1, EOr);
       
  1004 	NewComponentL(root, AttValue11, KCharRefStream);
       
  1005 	NewComponentL(root, AttValue11, KReferenceName);
       
  1006 	NewComponentL(root, AttValue11, KSString);
       
  1007 	NewComponentL(root, AttValue1, KSStringEnd);
       
  1008 	CBNFNode& AttValue2 = NewComponentL(AttValue, EAnd);
       
  1009 	NewComponentL(root, AttValue2, KDStringStart);
       
  1010 	CBNFNode& AttValue21 = NewComponentL(AttValue2, EOr);
       
  1011 	NewComponentL(root, AttValue21, KCharRefStream);
       
  1012 	NewComponentL(root, AttValue11, KReferenceName);
       
  1013 	NewComponentL(root, AttValue21, KDString);
       
  1014 	NewComponentL(root, AttValue2, KDStringEnd);
       
  1015 
       
  1016 	CBNFNode& GEContentS = NewRuleL(root, KGEContentS, ENMore, NULL, PreGEContentL, PostGEContentL);
       
  1017 	CBNFNode& GEContentS1 = NewComponentL(GEContentS, EOr);
       
  1018 		NewComponentL(GEContentS1, ESelect, KGEContentCharacters);
       
  1019 		NewComponentL(root, GEContentS1, KCharRefStream);
       
  1020 //		NewComponentL(root, GEContent, PEReference);
       
  1021 
       
  1022 	CBNFNode& GEContentD = NewRuleL(root, KGEContentD, ENMore, NULL, PreGEContentL, PostGEContentL);
       
  1023 	CBNFNode& GEContentD1 = NewComponentL(GEContentD, EOr);
       
  1024 		NewComponentL(GEContentD1, ESelect, KGEContentDCharacters);
       
  1025 		NewComponentL(root, GEContentD1, KCharRefStream);
       
  1026 
       
  1027 	// GEDecl ::= EntityDeclName S? 
       
  1028     CBNFNode& GEDecl = NewRuleL(root, KGEDecl, EAnd, NULL, NULL, PostGEDeclL);
       
  1029 	NewComponentL(root, GEDecl, KEntityDeclName);
       
  1030 	NewComponentL(root, GEDecl, KoptS);
       
  1031 	CBNFNode& GEDecl3 = NewComponentL(GEDecl, EOr);
       
  1032 		CBNFNode& GEDecl31 = NewComponentL(GEDecl3, EAnd);
       
  1033 			NewComponentL(root, GEDecl31, KSStringStart);
       
  1034 			NewComponentL(root, GEDecl31, KGEContentS);
       
  1035 			NewComponentL(root, GEDecl31, KSStringEnd);
       
  1036 		CBNFNode& GEDecl32 = NewComponentL(GEDecl3, EAnd);
       
  1037 			NewComponentL(root, GEDecl32, KDStringStart);
       
  1038 			NewComponentL(root, GEDecl32, KGEContentD);
       
  1039 			NewComponentL(root, GEDecl32, KDStringEnd);
       
  1040 
       
  1041 	// PEDecl ::= "%" S? GEDecl  --- old ---
       
  1042 	// PEDecl ::= "%" S? EntityDeclName S? EntityDef
       
  1043    	CBNFNode& PEDecl = NewRuleL(root, KPEDecl, EAnd, NULL, PrePEDeclL, PostPEDeclL);
       
  1044 	NewComponentL(PEDecl, EExact, KEntityInitialChar);
       
  1045 	NewComponentL(root, PEDecl, KoptS);
       
  1046 	NewComponentL(root, PEDecl, KEntityDeclName);
       
  1047 	NewComponentL(root, PEDecl, KoptS);
       
  1048 	NewComponentL(root, PEDecl, KEntityDef);
       
  1049 
       
  1050 	// EntityDecl ::= "<!ENTITY" S (GEDecl | PEDecl) S? ">"
       
  1051     CBNFNode& EntityDecl = NewRuleL(root, KEntityDecl, EAnd, NULL, PreEntityDeclL, PostEntityDeclL);
       
  1052 	NewComponentL(EntityDecl, EExact, KEntityDeclStart);
       
  1053 	NewComponentL(root, EntityDecl, KoptS);
       
  1054 	CBNFNode& EntityDecl1 = NewComponentL(EntityDecl, EOr);
       
  1055 	NewComponentL(root, EntityDecl1, KPEDecl);
       
  1056 	NewComponentL(root, EntityDecl1, KGEDecl);
       
  1057 	NewComponentL(root, EntityDecl, KoptS);
       
  1058 	NewComponentL(EntityDecl, EExact, KEntityDeclEnd);
       
  1059 
       
  1060 	// ElementDecl ::= "<!ELEMENT" S ElementDeclName S Definitions S? ">"
       
  1061     CBNFNode& ElementDecl = NewRuleL(root, KElementDecl, EAnd, NULL, PreElementDeclL, PostElementDeclL);
       
  1062 	NewComponentL(ElementDecl, EExact, KElementDeclStart);
       
  1063 	NewComponentL(root, ElementDecl, KoptS);
       
  1064 	NewComponentL(root, ElementDecl, KElementDeclName);
       
  1065 	NewComponentL(root, ElementDecl, KoptS);
       
  1066 	NewComponentL(root, ElementDecl, KDefinitions);
       
  1067 	NewComponentL(root, ElementDecl, KoptS);
       
  1068 	NewComponentL(ElementDecl, EExact, KElementDeclEnd);
       
  1069 
       
  1070 	// AttDefRequired ::= "#REQUIRED"
       
  1071     NewRuleL(root, KAttDefRequired, EExact, KRequired, NULL, PostRequiredL);
       
  1072 	// AttDefImplied ::= "#IMPLIED"
       
  1073     NewRuleL(root, KAttDefImplied, EExact, KImplied, NULL, PostImpliedL);
       
  1074 	// AttDefFixed ::= "#FIXED"
       
  1075     NewRuleL(root, KAttDefFixed, EExact, KFixed, NULL, PostFixedL);
       
  1076 
       
  1077 	// AttDefault ::= AttDefRequired | AttDefImplied | (AttDefFixed S?)? AttValue
       
  1078     CBNFNode& AttDefault = NewRuleL(root, KAttDefault, EOr, NULL, NULL, NULL);
       
  1079 	NewComponentL(root, AttDefault, KAttDefRequired);
       
  1080 	NewComponentL(root, AttDefault, KAttDefImplied);
       
  1081 	CBNFNode& AttDefault1 = NewComponentL(AttDefault, EAnd);
       
  1082 	CBNFNode& AttDefault11 = NewComponentL(AttDefault1, EOptional);
       
  1083 	CBNFNode& AttDefault111 = NewComponentL(AttDefault11, EAnd);
       
  1084 	NewComponentL(root, AttDefault111, KAttDefFixed);
       
  1085 	NewComponentL(root, AttDefault111, KoptS);
       
  1086 	NewComponentL(root, AttDefault1, KAttValue);
       
  1087 
       
  1088 	// CDATA ::= "CDATA"
       
  1089 	NewRuleL(root, KCData, EExact, KCData, MarkCallback, PostIdentifierL);
       
  1090 	// PCDATA ::= "#PCDATA"
       
  1091 	NewRuleL(root, KPCData, EExact, KPCData, MarkCallback, PostIdentifierL);
       
  1092 	// NMTOKEN ::= "NMTOKEN"
       
  1093 	NewRuleL(root, KNMToken, EExact, KNMToken, MarkCallback, PostIdentifierL);
       
  1094 	// ID ::= "ID"
       
  1095 	NewRuleL(root, KID, EExact, KID, MarkCallback, PostIdentifierL);
       
  1096 
       
  1097 	// Reference ::= "%" ReferenceName ";" 
       
  1098     CBNFNode& Reference = NewRuleL(root, KReference, EAnd, NULL, NULL, NULL);
       
  1099 	NewComponentL(Reference, EExact, KRefNameInitialChar);
       
  1100 	NewComponentL(root, Reference, KReferenceName);
       
  1101 	NewComponentL(Reference, EExact, KRefNameEndChar);
       
  1102 
       
  1103 	// AttlistReference ::= Reference
       
  1104     CBNFNode& AttlistReference = NewRuleL(root, KAttlistReference, EAnd, NULL, PreAttlistLineL, PostAttlistReferenceL);
       
  1105 	NewComponentL(root, AttlistReference, KReference);
       
  1106 
       
  1107 	// DataReference ::= CDATA | NMTOKEN | #PCDATA | ID | Reference
       
  1108 	CBNFNode& DataReference = NewRuleL(root, KDataReference, EOr, NULL, NULL, NULL);
       
  1109 	NewComponentL(root, DataReference, KCData);
       
  1110 	NewComponentL(root, DataReference, KNMToken);
       
  1111 	NewComponentL(root, DataReference, KPCData);
       
  1112 	NewComponentL(root, DataReference, KID);
       
  1113 	NewComponentL(root, DataReference, KReference);
       
  1114 
       
  1115 	// AttlistLine ::= (AttfieldName S? Definition S? AttDefault)
       
  1116 	CBNFNode& AttlistLine = NewRuleL(root, KAttlistLine, EOr, NULL, PreAttlistLineL, PostAttlistLineL);
       
  1117 	CBNFNode& AttlistLine1 = NewComponentL(AttlistLine, EAnd);
       
  1118 	NewComponentL(root, AttlistLine1, KAttfieldName);
       
  1119 	NewComponentL(root, AttlistLine1, KoptS);
       
  1120 	NewComponentL(root, AttlistLine1, KDefinition);
       
  1121 	NewComponentL(root, AttlistLine1, KoptS);
       
  1122 	NewComponentL(root, AttlistLine1, KAttDefault);
       
  1123 
       
  1124 	// AttlistDef ::=  AttlistLine | Reference
       
  1125     CBNFNode& AttlistDef = NewRuleL(root, KAttlistDef, EOr, NULL, NULL, NULL);
       
  1126 	NewComponentL(root, AttlistDef, KAttlistLine);
       
  1127 	NewComponentL(root, AttlistDef, KAttlistReference);
       
  1128 
       
  1129 	// AttlistDecl ::= "<!ATTLIST" S? AttlistDeclName S? (AttlistDef S?)* ">"
       
  1130     CBNFNode& AttlistDecl = NewRuleL(root, KAttlistDecl, EAnd, NULL, NULL, NULL);
       
  1131 	NewComponentL(AttlistDecl, EExact, KAttributeListStart);
       
  1132 	NewComponentL(root, AttlistDecl, KoptS);
       
  1133 	NewComponentL(root, AttlistDecl, KAttlistDeclNameCharacters);
       
  1134 	NewComponentL(root, AttlistDecl, KoptS);
       
  1135 	CBNFNode& AttlistDecl1 = NewComponentL(AttlistDecl, ENMore);
       
  1136 	CBNFNode& AttlistDecl11 = NewComponentL(AttlistDecl1, EAnd);
       
  1137 	NewComponentL(root, AttlistDecl11, KAttlistDef);
       
  1138 	NewComponentL(root, AttlistDecl11, KoptS);
       
  1139 	NewComponentL(AttlistDecl, EExact, KAttributeListEnd);
       
  1140 
       
  1141 	// CommentChar ::= S | [#x20-#xD7FF]
       
  1142     CBNFNode& CommentChar = NewRuleL(root, KCommentChar, EOr, NULL, NULL, NULL);
       
  1143 	NewComponentL(root, CommentChar, KSpace);
       
  1144 	CBNFNode& CommentChar1 = NewComponentL(CommentChar, ERange);
       
  1145 	AddComponentAttributeL(CommentChar1, CBNFNode::KRangeStart(), 0x20);
       
  1146 	AddComponentAttributeL(CommentChar1, CBNFNode::KRangeEnd(), 0xD7FF);
       
  1147 
       
  1148 	// Comment ::= "<!--" ((CommentChar - '-') | ('-' (CommentChar - '-')))* "-->"
       
  1149 	CBNFNode& Comment = NewRuleL(root, KComment, EAnd, NULL, NULL, NULL);
       
  1150 	NewComponentL(Comment, EExact, KCommentStart);
       
  1151 	CBNFNode& Comment0 = NewComponentL(Comment, ENMore);
       
  1152 	CBNFNode& Comment1 = NewComponentL(Comment0, EOr);
       
  1153 
       
  1154 	CBNFNode& Comment11 = NewComponentL(Comment1, EWithout);
       
  1155 	NewComponentL(root, Comment11, KCommentChar);
       
  1156 	NewComponentL(Comment11, EExact, KCommentCharacter);
       
  1157 	CBNFNode& Comment12 = NewComponentL(Comment1, EAnd);
       
  1158 	NewComponentL(Comment12, EExact, KCommentCharacter);
       
  1159 	CBNFNode& Comment13 = NewComponentL(Comment12, EWithout);
       
  1160 	NewComponentL(root, Comment13, KCommentChar);
       
  1161 	NewComponentL(Comment13, EExact, KCommentCharacter);
       
  1162 	NewComponentL(Comment, EExact, KCommentEnd);
       
  1163 
       
  1164 	// Rule ::= S? Comment? S? (EntityDecl | ElementDecl | AttlistDecl)
       
  1165 	CBNFNode& Rule = NewRuleL(root, KRule, EAnd, NULL, NULL, NULL);
       
  1166 	NewComponentL(root, Rule, KoptS);
       
  1167 	CBNFNode& Rule1 = NewComponentL(Rule, EOptional);
       
  1168 	NewComponentL(root, Rule1, KComment);
       
  1169 	NewComponentL(root, Rule, KoptS);
       
  1170 	CBNFNode& Rule2 = NewComponentL(Rule, EOr);
       
  1171 	NewComponentL(root, Rule2, KEntityDecl);
       
  1172 	NewComponentL(root, Rule2, KElementDecl);
       
  1173 	NewComponentL(root, Rule2, KAttlistDecl);
       
  1174 
       
  1175 	CleanupStack::Pop(); // root
       
  1176 	return (root);
       
  1177 	}
       
  1178 
       
  1179 void CDTDModel::CharRefReplacement(TPtr& aString)
       
  1180 // A method to replace character references to the given string with the referenced character
       
  1181 // This method does minimal set of checks since when this method is called the string has
       
  1182 // already been parsed and hence the references it contains are valid (this is ensured by the
       
  1183 // reference parsing rules). Therefore, this method should be called just before the data
       
  1184 // is being attached as an attribute value or as CDATA to a node. The reason why we don't replace
       
  1185 // the values during the parsing (i.e. when the values are checked) is that if the rule would
       
  1186 // later fail and the string would be re-parsed then the replaced characters might cause
       
  1187 // errorneous situations and unintended references to appear.
       
  1188 	{
       
  1189 	TPtrC examinable = aString;
       
  1190 	TInt examinableOffset = 0;
       
  1191 	TInt referenceOffset = examinable.Match(KCharRefMatchingPattern);
       
  1192 	while( referenceOffset != KErrNotFound )
       
  1193 		{
       
  1194 		TPtrC reference = examinable.Mid(referenceOffset);
       
  1195 		TInt referenceValueOffset = 2;
       
  1196 		TRadix system = EDecimal;
       
  1197 		if( reference[2] == 'x' )
       
  1198 			{
       
  1199 			referenceValueOffset++;
       
  1200 			system = EHex;
       
  1201 			}
       
  1202 		TLex valueString(reference.Mid(referenceValueOffset, reference.Locate(';')-referenceValueOffset) );
       
  1203 		TUint16 referenceValue = 32;	// just in case something fails, we shall insert space
       
  1204 		valueString.Val(referenceValue, system);
       
  1205 		aString.Delete(examinableOffset+referenceOffset, reference.Locate(';') );
       
  1206 		aString[examinableOffset+referenceOffset] = referenceValue;
       
  1207 
       
  1208 		examinable.Set(aString.Mid(examinableOffset+referenceOffset+1));
       
  1209 		examinableOffset += referenceOffset+1;
       
  1210 		referenceOffset = examinable.Match(KCharRefMatchingPattern);
       
  1211 		}
       
  1212 	} 
       
  1213 
       
  1214 
       
  1215 /** Gets the root node of the tree generated to process the DTD.
       
  1216 
       
  1217 It transfers ownership of the tree to the caller.
       
  1218 
       
  1219 @return Root node of the tree
       
  1220 */
       
  1221 EXPORT_C CBNFNode* CDTDModel::GeneratedTree()
       
  1222 	{ 
       
  1223 	CBNFNode* tree=iNewTree; 
       
  1224 	iNewTree=NULL;
       
  1225 	return tree; 
       
  1226 	}
       
  1227 
       
  1228 void CDTDModel::AddNewAttributeL(CBNFNode& aNode, const TDesC* aAttributeId, const TDesC& aAttributeType, CDTDElementAttribute::KValueType aAttributeValueType, CBNFNode* aRootNode)
       
  1229 	{
       
  1230 	CDTDElementAttribute* newAttribute = new(ELeave)CDTDElementAttribute();
       
  1231 	CleanupStack::PushL(newAttribute);
       
  1232 	newAttribute->iValueType = aAttributeValueType;
       
  1233 	newAttribute->iType = NewComponentL(aRootNode, aAttributeType);
       
  1234 	aNode.AddAttributeL(aAttributeId, newAttribute);
       
  1235 	CleanupStack::Pop(); // newAttribute
       
  1236 	}
       
  1237 
       
  1238 void CDTDModel::AddNewReferenceAttributeL(CBNFNode& aNode, const TDesC& aAttributeType, CBNFNode* aRootNode)
       
  1239 	{
       
  1240 	CDTDElementAttribute* newAttribute = new(ELeave)CDTDElementAttribute();
       
  1241 	CleanupStack::PushL(newAttribute);
       
  1242 	newAttribute->iValueType = CDTDElementAttribute::EReference;
       
  1243 	newAttribute->iType = NewComponentL(aRootNode, aAttributeType);
       
  1244 	aNode.AddAttributeL(REINTERPRET_CAST(const TDesC*, newAttribute), newAttribute);
       
  1245 	CleanupStack::Pop(); // newAttribute
       
  1246 	}
       
  1247 
       
  1248 void CDTDModel::AddNewAttributeWithValueL(CBNFNode& aNode, const TDesC* aAttributeId, const TDesC& aAttributeType, const TDesC& aAttributeDefaultValue, CBNFNode* aRootNode)
       
  1249 	{
       
  1250 	CDTDElementAttribute* newAttribute = new(ELeave)CDTDElementAttribute();
       
  1251 	CleanupStack::PushL(newAttribute);
       
  1252 	newAttribute->iType = NewComponentL(aRootNode, aAttributeType);
       
  1253 	newAttribute->iValue = NewComponentL(EExact, aAttributeDefaultValue);
       
  1254 	aNode.AddAttributeL(aAttributeId, newAttribute);
       
  1255 	CleanupStack::Pop(); // newAttribute, 
       
  1256 	}
       
  1257 
       
  1258 /** Builds a parser tree for the WML1.1 DTD.
       
  1259 
       
  1260 @param aPackageRootNode A root node to which the generated tree is attached
       
  1261 */
       
  1262 EXPORT_C void CDTDModel::BuildWml11DTDL(CBNFNode& aPackageRootNode)
       
  1263 {
       
  1264 	CBNFNode* dtdRoot = NewBNFL();
       
  1265 	dtdRoot->ReparentL(&aPackageRootNode);
       
  1266 
       
  1267 	_LIT(KCDATA,"CDATA");
       
  1268 	_LIT(Klength,"%length");
       
  1269 	_LIT(Kvdata,"%vdata");
       
  1270 	_LIT(KHREF,"%HREF");
       
  1271 	_LIT(Ktrue,"true");
       
  1272 	_LIT(Kfalse,"false");
       
  1273 	_LIT(Kboolean,"%boolean");
       
  1274 	_LIT(KNMTOKEN,"NMTOKEN");
       
  1275 	_LIT(Knumber,"%number");
       
  1276 	_LIT(Kcoreattrs,"%coreattrs");
       
  1277 	_LIT(Kem,"em");
       
  1278 	_LIT(Kstrong,"strong");
       
  1279 	_LIT(Kb,"b");
       
  1280 	_LIT(Ki,"i");
       
  1281 	_LIT(Ku,"u");
       
  1282 	_LIT(Kbig,"big");
       
  1283 	_LIT(Ksmall,"small");
       
  1284 	_LIT(Kemph,"%emph");
       
  1285 	_LIT(Kbr,"br");
       
  1286 	_LIT(Klayout,"%layout");
       
  1287 	_LIT(KPCDATA,"#PCDATA");
       
  1288 	_LIT(Ktext,"%text");
       
  1289 	_LIT(Kimg,"img");
       
  1290 	_LIT(Kanchor,"anchor");
       
  1291 	_LIT(Ka,"a");
       
  1292 	_LIT(Ktable,"table");
       
  1293 	_LIT(Knoop,"noop");
       
  1294 	_LIT(Ktask,"%task");
       
  1295 	_LIT(Kdo,"do");
       
  1296 	_LIT(Knavelmts,"%navelmts");
       
  1297 	_LIT(Konevent,"onevent");
       
  1298 	_LIT(Kflow,"%flow");
       
  1299 	_LIT(KEMPTY,"EMPTY");
       
  1300 	_LIT(Kbottom,"bottom");
       
  1301 	_LIT(KIAlign,"%IAlign");
       
  1302 	_LIT(Kgo,"go");
       
  1303 	_LIT(Kprev,"prev");
       
  1304 	_LIT(Krefresh,"refresh");
       
  1305 	_LIT(Ktr,"tr");
       
  1306 	_LIT(Kpostfield,"postfield");
       
  1307 	_LIT(Ksetvar,"setvar");
       
  1308 	_LIT(Khead,"head");
       
  1309 	_LIT(Ktemplate,"template");
       
  1310 	_LIT(Kcard,"card");
       
  1311 	_LIT(Kwml,"wml");
       
  1312 	_LIT(Kaccess,"access");
       
  1313 	_LIT(Kmeta,"meta");
       
  1314 	_LIT(Kcardev,"%cardev");
       
  1315 	_LIT(Kp,"p");
       
  1316 	_LIT(Ktimer,"timer");
       
  1317 	_LIT(Kinput,"input");
       
  1318 	_LIT(Kselect,"select");
       
  1319 	_LIT(Kfieldset,"fieldset");
       
  1320 	_LIT(Kfields,"%fields");
       
  1321 	_LIT(Koption,"option");
       
  1322 	_LIT(Koptgroup,"optgroup");
       
  1323 	_LIT(KTAlign,"%TAlign");
       
  1324 	_LIT(KWrapMode,"%WrapMode");
       
  1325 	_LIT(Ktd,"td");
       
  1326 
       
  1327 	_LIT(Kleft,"left");
       
  1328 	_LIT(Ktop,"top");
       
  1329 	_LIT(Kmiddle,"middle");
       
  1330 	_LIT(Kright,"right");
       
  1331 	_LIT(Kcenter,"center");
       
  1332 	_LIT(Kwrap,"wrap");
       
  1333 	_LIT(Knowrap,"nowrap");
       
  1334 
       
  1335 
       
  1336 	_LIT(Kxmllang, "xml:lang");
       
  1337 	const TDesC* xmllangAttributeId = iLUT.Des2IDL(Kxmllang);
       
  1338 	_LIT(Ktitle, "title");
       
  1339 	const TDesC* titleAttributeId = iLUT.Des2IDL(Ktitle);
       
  1340 	_LIT(Khref, "href");
       
  1341 	const TDesC* hrefAttributeId = iLUT.Des2IDL(Khref);
       
  1342 	_LIT(Kvalue, "value");
       
  1343 	const TDesC* valueAttributeId = iLUT.Des2IDL(Kvalue);
       
  1344 	_LIT(Ktabindex, "tabindex");
       
  1345 	const TDesC* tabindexAttributeId = iLUT.Des2IDL(Ktabindex);
       
  1346 	_LIT(Ktype, "type");
       
  1347 	const TDesC* typeAttributeId = iLUT.Des2IDL(Ktype);
       
  1348 	_LIT(Kname, "name");
       
  1349 	const TDesC* nameAttributeId = iLUT.Des2IDL(Kname);
       
  1350 	_LIT(Kalign, "align");
       
  1351 	const TDesC* alignAttributeId = iLUT.Des2IDL(Kalign);
       
  1352 
       
  1353 
       
  1354 	// <!ENTITY % length  "CDATA">
       
  1355 	CBNFNode& length = NewRuleL(dtdRoot, Klength, EAnd, NULL, NULL, NULL);
       
  1356 	NewComponentL(dtdRoot, length,KCDATA);
       
  1357 
       
  1358 
       
  1359 	// <!ENTITY % vdata   "CDATA">
       
  1360 	CBNFNode& vdata = NewRuleL(dtdRoot, Kvdata, EAnd, NULL, NULL, NULL);
       
  1361 	NewComponentL(dtdRoot, vdata,KCDATA);
       
  1362 
       
  1363 
       
  1364 	// <!ENTITY % HREF    "%vdata;">
       
  1365 	CBNFNode& href = NewRuleL(dtdRoot, KHREF, EAnd, NULL, NULL, NULL);
       
  1366 	NewComponentL(dtdRoot, href,Kvdata);
       
  1367 
       
  1368 
       
  1369 	// <!ENTITY % boolean	"(true|false)">
       
  1370 	CBNFNode& boolean = NewRuleL(dtdRoot, Kboolean, EOr, NULL, NULL, NULL);
       
  1371 	NewComponentL(dtdRoot, boolean, Ktrue);
       
  1372 	NewComponentL(dtdRoot, boolean, Kfalse);
       
  1373 
       
  1374 
       
  1375 	// <!ENTITY % number  "NMTOKEN">  <!-- a number, with format [0-9]+ -->
       
  1376 	CBNFNode& number = NewRuleL(dtdRoot, Knumber, EAnd, NULL, NULL, NULL);
       
  1377 	NewComponentL(dtdRoot, number, KNMTOKEN);
       
  1378 
       
  1379 	CDTDElementAttribute* newAttribute = NULL;
       
  1380 
       
  1381 
       
  1382 	// !ENTITY % coreattrs  "id    ID     #IMPLIED  class CDATA  #IMPLIED">
       
  1383 	CBNFNode& coreattrs = NewRuleL(dtdRoot, Kcoreattrs, EIncomplete, NULL, NULL, NULL);
       
  1384 	// Attributes
       
  1385 	//  id ID #IMPLIED
       
  1386 	_LIT(KidAttrName, "id");
       
  1387 	_LIT(KID, "ID");
       
  1388 	AddNewAttributeL(coreattrs, iLUT.Des2IDL(KidAttrName), KID, CDTDElementAttribute::EImplied, dtdRoot);
       
  1389 	// class CDATA #IMPLIED
       
  1390 	_LIT(Kclass, "class");
       
  1391 	AddNewAttributeL(coreattrs, iLUT.Des2IDL(Kclass), KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1392 
       
  1393 
       
  1394 	// <!ENTITY % emph    "em | strong | b | i | u | big | small">
       
  1395 	CBNFNode& emph = NewRuleL(dtdRoot, Kemph, EOr, NULL, NULL, NULL);
       
  1396 	NewComponentL(dtdRoot, emph, Kem);
       
  1397 	NewComponentL(dtdRoot, emph, Kstrong);
       
  1398 	NewComponentL(dtdRoot, emph, Kb);
       
  1399 	NewComponentL(dtdRoot, emph, Ki);
       
  1400 	NewComponentL(dtdRoot, emph, Ku);
       
  1401 	NewComponentL(dtdRoot, emph, Kbig);
       
  1402 	NewComponentL(dtdRoot, emph, Ksmall);
       
  1403 
       
  1404 	// <!ENTITY % layout  "br">
       
  1405 	CBNFNode& layout = NewRuleL(dtdRoot, Klayout, EAnd, NULL, NULL, NULL);
       
  1406 	NewComponentL(dtdRoot, layout, Kbr);
       
  1407 
       
  1408 
       
  1409 	// <!ENTITY % text     "#PCDATA | %emph;">
       
  1410 	CBNFNode& text = NewRuleL(dtdRoot, Ktext, EOr, NULL, NULL, NULL);
       
  1411 	NewComponentL(dtdRoot, text, KPCDATA);
       
  1412 	NewComponentL(dtdRoot, text, Kemph);
       
  1413 
       
  1414 
       
  1415 	// <!ENTITY % flow     "%text; | %layout; | img | anchor | a | table">
       
  1416 	CBNFNode& flow = NewRuleL(dtdRoot, Kflow, EOr, NULL, NULL, NULL);
       
  1417 	NewComponentL(dtdRoot, flow, Ktext);
       
  1418 	NewComponentL(dtdRoot, flow, Klayout);
       
  1419 	NewComponentL(dtdRoot, flow, Kimg);
       
  1420 	NewComponentL(dtdRoot, flow, Kanchor);
       
  1421 	NewComponentL(dtdRoot, flow, Ka);
       
  1422 	NewComponentL(dtdRoot, flow, Ktable);
       
  1423 
       
  1424 	// <!ENTITY % task   "go | prev | noop | refresh">
       
  1425 	CBNFNode& task = NewRuleL(dtdRoot, Ktask, EOr, NULL, NULL, NULL);
       
  1426 	NewComponentL(dtdRoot, task, Kgo);
       
  1427 	NewComponentL(dtdRoot, task, Kprev);
       
  1428 	NewComponentL(dtdRoot, task, Knoop);
       
  1429 	NewComponentL(dtdRoot, task, Krefresh);
       
  1430 
       
  1431 
       
  1432 	// <!ENTITY % navelmts "do | onevent">
       
  1433 	CBNFNode& navelmts = NewRuleL(dtdRoot, Knavelmts, EOr, NULL, NULL, NULL);
       
  1434 	NewComponentL(dtdRoot, navelmts, Kdo);
       
  1435 	NewComponentL(dtdRoot, navelmts, Konevent);
       
  1436 
       
  1437 
       
  1438 	// <!ELEMENT wml ( head?, template?, card+ )>
       
  1439 	CBNFNode& wml = NewRuleL(dtdRoot, Kwml, EAnd, NULL, NULL, NULL);
       
  1440 	CBNFNode& wml1 = NewComponentL( wml, EOptional);
       
  1441 		NewComponentL(dtdRoot, wml1,Khead);
       
  1442 	CBNFNode& wml2 = NewComponentL( wml, EOptional);
       
  1443 		NewComponentL(dtdRoot, wml2, Ktemplate);
       
  1444 	CBNFNode& wml3 = NewComponentL( wml, ENMore);
       
  1445 	AddComponentAttributeL( wml3, CBNFNode::KNMoreMinimum(), 1);
       
  1446 		NewComponentL(dtdRoot, wml3, Kcard);
       
  1447 	// Attributes
       
  1448 	// xml:lang NMTOKEN #IMPLIED
       
  1449 	AddNewAttributeL(wml, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1450 	// %coreattrs
       
  1451 	AddNewReferenceAttributeL(wml, Kcoreattrs, dtdRoot);
       
  1452 
       
  1453 
       
  1454 	// <!ENTITY % cardev
       
  1455 	CBNFNode& cardev = NewRuleL(dtdRoot, Kcardev, EIncomplete, NULL, NULL, NULL);
       
  1456 	// Attributes
       
  1457 	// onenterforward %HREF #IMPLIED
       
  1458 	_LIT(Konenterforward, "onenterforward");
       
  1459 	AddNewAttributeL(cardev, iLUT.Des2IDL(Konenterforward), KHREF, CDTDElementAttribute::EImplied, dtdRoot);
       
  1460 	// onenterbackward %HREF #IMPLIED
       
  1461 	_LIT(Konenterbackward, "onenterbackward");
       
  1462 	AddNewAttributeL(cardev, iLUT.Des2IDL(Konenterbackward), KHREF, CDTDElementAttribute::EImplied, dtdRoot);
       
  1463 	// ontimer %HREF #IMPLIED
       
  1464 	_LIT(Kontimer, "ontimer");
       
  1465 	AddNewAttributeL(cardev, iLUT.Des2IDL(Kontimer), KHREF, CDTDElementAttribute::EImplied, dtdRoot);
       
  1466 
       
  1467 
       
  1468 	// <!ENTITY % fields  "%flow; | input | select | fieldset">
       
  1469 	CBNFNode& fields = NewRuleL(dtdRoot, Kfields, EOr, NULL, NULL, NULL);
       
  1470 	NewComponentL(dtdRoot, fields, Kflow);
       
  1471 	NewComponentL(dtdRoot, fields, Kinput);
       
  1472 	NewComponentL(dtdRoot, fields, Kselect);
       
  1473 	NewComponentL(dtdRoot, fields, Kfieldset);
       
  1474 
       
  1475 
       
  1476 	// <!ELEMENT card (onevent*, timer?, (do | p)*)>
       
  1477 	CBNFNode& card = NewRuleL(dtdRoot, Kcard, EAnd, NULL, NULL, NULL);
       
  1478 	CBNFNode& card1 = NewComponentL( card, ENMore);
       
  1479 		NewComponentL(dtdRoot, card1, Konevent);
       
  1480 	CBNFNode& card2 = NewComponentL( card, EOptional);
       
  1481 		NewComponentL(dtdRoot, card2, Ktimer);
       
  1482 	CBNFNode& card3 = NewComponentL( card, ENMore);
       
  1483 		CBNFNode& card31 = NewComponentL( card3, EOr);
       
  1484 			NewComponentL(dtdRoot, card31, Kdo);
       
  1485 			NewComponentL(dtdRoot, card31, Kp);
       
  1486 	// Attributes
       
  1487 	// title %vdata #IMPLIED
       
  1488 	AddNewAttributeL(card, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1489 	// newcontext %boolean "false"
       
  1490 	_LIT(Knewcontext, "newcontext");
       
  1491 	AddNewAttributeWithValueL(card, iLUT.Des2IDL(Knewcontext), Kboolean, Kfalse, dtdRoot);
       
  1492 	// ordered %boolean "true"
       
  1493 	_LIT(Kordered, "ordered");
       
  1494 	AddNewAttributeWithValueL(card, iLUT.Des2IDL(Kordered), Kboolean, Ktrue, dtdRoot);
       
  1495 	// xml:lang NMTOKEN #IMPLIED
       
  1496 	AddNewAttributeL(card, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1497 	// %cardev
       
  1498 	AddNewReferenceAttributeL(card, Kcardev, dtdRoot );
       
  1499 	// %coreattrs
       
  1500 	AddNewReferenceAttributeL(card, Kcoreattrs, dtdRoot);
       
  1501 
       
  1502 
       
  1503 	// <!ELEMENT do (%task;)>
       
  1504 	CBNFNode& doElement = NewRuleL(dtdRoot, Kdo, EAnd, NULL, NULL, NULL);
       
  1505 	NewComponentL(dtdRoot, doElement, Ktask);
       
  1506 	// Attributes
       
  1507 	// type CDATA #REQUIRED
       
  1508 	AddNewAttributeL(doElement, typeAttributeId, KCDATA, CDTDElementAttribute::ERequired, dtdRoot);
       
  1509 	// label %vdata #IMPLIED
       
  1510 	_LIT(Klabel, "label");
       
  1511 	AddNewAttributeL(doElement, iLUT.Des2IDL(Klabel), Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1512 	// name NMTOKEN #IMPLIED
       
  1513 	AddNewAttributeL(doElement, nameAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1514 	// optional %boolean "false"
       
  1515 	_LIT(Koptional, "optional");
       
  1516 	AddNewAttributeWithValueL(doElement, iLUT.Des2IDL(Koptional), Kboolean, Kfalse, dtdRoot);
       
  1517 	// xml:lang NMTOKEN #IMPLIED
       
  1518 	AddNewAttributeL(doElement, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1519 	// %coreattrs
       
  1520 	AddNewReferenceAttributeL(doElement, Kcoreattrs, dtdRoot);
       
  1521 
       
  1522 
       
  1523 	// <!ELEMENT onevent (%task;)>
       
  1524 	CBNFNode& onevent = NewRuleL(dtdRoot, Konevent, EAnd, NULL, NULL, NULL);
       
  1525 	NewComponentL(dtdRoot, onevent, Ktask);
       
  1526 	// Attributes
       
  1527 	// type CDATA #REQUIRED
       
  1528 	AddNewAttributeL(onevent, typeAttributeId, KCDATA, CDTDElementAttribute::ERequired, dtdRoot);
       
  1529 	// %coreattrs
       
  1530 	AddNewReferenceAttributeL(onevent, Kcoreattrs, dtdRoot);
       
  1531 
       
  1532 
       
  1533 	// <!ELEMENT head ( access | meta )+>
       
  1534 	CBNFNode& head = NewRuleL(dtdRoot, Khead, EAnd, NULL, NULL, NULL);
       
  1535 	CBNFNode& head1 = NewComponentL( head, ENMore);
       
  1536 	AddComponentAttributeL( head1, CBNFNode::KNMoreMinimum(), 1);
       
  1537 		CBNFNode& head11 = NewComponentL( head1, EOr);
       
  1538 			NewComponentL(dtdRoot, head11, Kaccess);
       
  1539 			NewComponentL(dtdRoot, head11, Kmeta);
       
  1540 	// Attributes
       
  1541 	// %coreattrs
       
  1542 	AddNewReferenceAttributeL(head, Kcoreattrs, dtdRoot);
       
  1543 
       
  1544 
       
  1545 	// <!ELEMENT template (%navelmts;)*>
       
  1546 	CBNFNode& templateElement = NewRuleL(dtdRoot, Ktemplate, EAnd, NULL, NULL, NULL);
       
  1547 	CBNFNode& templateElement1 = NewComponentL( templateElement, ENMore);
       
  1548 		NewComponentL(dtdRoot, templateElement1, Knavelmts);
       
  1549 	// Attributes
       
  1550 	// %cardev
       
  1551 	AddNewReferenceAttributeL(templateElement, Kcardev, dtdRoot );
       
  1552 	// %coreattrs
       
  1553 	AddNewReferenceAttributeL(templateElement, Kcoreattrs, dtdRoot);
       
  1554 
       
  1555 
       
  1556 	// <!ELEMENT access EMPTY>
       
  1557 	CBNFNode& access = NewRuleL(dtdRoot, Kaccess, EAnd, NULL, NULL, NULL);
       
  1558 	NewComponentL(dtdRoot, access, KEMPTY);
       
  1559 	// Attributes
       
  1560 	// domain CDATA #IMPLIED
       
  1561 	_LIT(Kdomain, "domain");
       
  1562 	AddNewAttributeL(access, iLUT.Des2IDL(Kdomain), KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1563 	// path CDATA #IMPLIED
       
  1564 	_LIT(Kpath, "path");
       
  1565 	AddNewAttributeL(access, iLUT.Des2IDL(Kpath), KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1566 	// %coreattrs
       
  1567 	AddNewReferenceAttributeL(access, Kcoreattrs, dtdRoot);
       
  1568 
       
  1569 
       
  1570 	// <!ELEMENT meta EMPTY>
       
  1571 	CBNFNode& meta = NewRuleL(dtdRoot, Kmeta, EAnd, NULL, NULL, NULL);
       
  1572 	NewComponentL(dtdRoot, meta, KEMPTY);
       
  1573 	// Attributes
       
  1574 	// http-equiv CDATA #IMPLIED
       
  1575 	_LIT(Khttpequiv, "http-equiv");
       
  1576 	AddNewAttributeL(meta, iLUT.Des2IDL(Khttpequiv), KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1577 	// name CDATA #IMPLIED
       
  1578 	AddNewAttributeL(meta, nameAttributeId, KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1579 	// forua %boolean #IMPLIED
       
  1580 	_LIT(Kforua, "forua");
       
  1581 	AddNewAttributeL(meta, iLUT.Des2IDL(Kforua), Kboolean, CDTDElementAttribute::EImplied, dtdRoot);
       
  1582 	// content CDATA #REQUIRED
       
  1583 	_LIT(Kcontent, "content");
       
  1584 	AddNewAttributeL(meta, iLUT.Des2IDL(Kcontent), KCDATA, CDTDElementAttribute::ERequired, dtdRoot);
       
  1585 	// scheme CDATA #IMPLIED
       
  1586 	_LIT(Kscheme, "scheme");
       
  1587 	AddNewAttributeL(meta, iLUT.Des2IDL(Kscheme), KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1588 	// %coreattrs
       
  1589 	AddNewReferenceAttributeL(meta, Kcoreattrs, dtdRoot);
       
  1590 
       
  1591 
       
  1592 	// <!ELEMENT go (postfield | setvar)*>
       
  1593 	CBNFNode& go = NewRuleL(dtdRoot, Kgo, EAnd, NULL, NULL, NULL);
       
  1594 	CBNFNode& go1 = NewComponentL( go, ENMore);
       
  1595 		CBNFNode& go11 = NewComponentL( go1, EOr);
       
  1596 			NewComponentL(dtdRoot, go11, Kpostfield);
       
  1597 			NewComponentL(dtdRoot, go11, Ksetvar);
       
  1598 	// Attributes
       
  1599 	// href %HREF #REQUIRED
       
  1600 	AddNewAttributeL(go, hrefAttributeId, KHREF, CDTDElementAttribute::ERequired, dtdRoot);
       
  1601 	// sendreferer %boolean "false"
       
  1602 	_LIT(Ksendreferer, "sendreferer");
       
  1603 	AddNewAttributeWithValueL(go, iLUT.Des2IDL(Ksendreferer), Kboolean, Kfalse, dtdRoot);
       
  1604 	// method post | get "get"
       
  1605 	newAttribute = new(ELeave) CDTDElementAttribute();
       
  1606 	CleanupStack::PushL(newAttribute);
       
  1607 	_LIT(Kpost, "post");
       
  1608 	_LIT(Kget, "get");
       
  1609 	CBNFNode* methodTypeTree = NewComponentL(EOr);
       
  1610 	newAttribute->iType = methodTypeTree;
       
  1611 		NewComponentL(dtdRoot, *methodTypeTree, Kpost);
       
  1612 		NewComponentL(dtdRoot, *methodTypeTree, Kget);
       
  1613 	newAttribute->iValue = NewComponentL(EExact, Kget);
       
  1614 	_LIT(Kmethod, "method");
       
  1615 	go.AddAttributeL(iLUT.Des2IDL(Kmethod), newAttribute);
       
  1616 	CleanupStack::Pop(); // newAttribute
       
  1617 	// accept-charset CDATA #IMPLIED
       
  1618 	_LIT(Kacceptcharset, "accept-charset");
       
  1619 	AddNewAttributeL(go, iLUT.Des2IDL(Kacceptcharset), KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1620 	// %coreattrs
       
  1621 	AddNewReferenceAttributeL(go, Kcoreattrs, dtdRoot);
       
  1622 
       
  1623 
       
  1624 	// <!ELEMENT prev (setvar)*>
       
  1625 	CBNFNode& prev = NewRuleL(dtdRoot, Kprev, EAnd, NULL, NULL, NULL);
       
  1626 	CBNFNode& prev1 = NewComponentL( prev, ENMore);
       
  1627 		NewComponentL(dtdRoot, prev1, Ksetvar);
       
  1628 	// Attributes
       
  1629 	// %coreattrs
       
  1630 	AddNewReferenceAttributeL(prev, Kcoreattrs, dtdRoot);
       
  1631 
       
  1632 
       
  1633 	// <!ELEMENT refresh (setvar)*>
       
  1634 	CBNFNode& refresh = NewRuleL(dtdRoot, Krefresh, EAnd, NULL, NULL, NULL);
       
  1635 	CBNFNode& refresh1 = NewComponentL( refresh, ENMore);
       
  1636 		NewComponentL(dtdRoot, refresh1,Ksetvar);
       
  1637 	// Attributes
       
  1638 	// %coreattrs
       
  1639 	AddNewReferenceAttributeL(refresh, Kcoreattrs, dtdRoot);
       
  1640 
       
  1641 
       
  1642 	// <!ELEMENT noop EMPTY>
       
  1643 	CBNFNode& noop = NewRuleL(dtdRoot, Knoop, EAnd, NULL, NULL, NULL);
       
  1644 	NewComponentL(dtdRoot, noop, KEMPTY);
       
  1645 	// Attributes
       
  1646 	// %coreattrs
       
  1647 	AddNewReferenceAttributeL(noop, Kcoreattrs, dtdRoot);
       
  1648 
       
  1649 
       
  1650 	// <!ELEMENT postfield EMPTY>
       
  1651 	CBNFNode& postfield = NewRuleL(dtdRoot, Kpostfield, EAnd, NULL, NULL, NULL);
       
  1652 	NewComponentL(dtdRoot, postfield, KEMPTY);
       
  1653 	// Attributes
       
  1654 	// name %vdata #REQUIRED
       
  1655 	AddNewAttributeL(postfield, nameAttributeId, Kvdata, CDTDElementAttribute::ERequired, dtdRoot);
       
  1656 	// value %vdata #REQUIRED
       
  1657 	AddNewAttributeL(postfield, valueAttributeId, Kvdata, CDTDElementAttribute::ERequired, dtdRoot);
       
  1658 	// %coreattrs
       
  1659 	AddNewReferenceAttributeL(postfield, Kcoreattrs, dtdRoot);
       
  1660 
       
  1661 
       
  1662 	// <!ELEMENT setvar EMPTY>
       
  1663 	CBNFNode& setvar = NewRuleL(dtdRoot, Ksetvar, EAnd, NULL, NULL, NULL);
       
  1664 	NewComponentL(dtdRoot, setvar, KEMPTY);
       
  1665 	// Attributes
       
  1666 	// name %vdata #REQUIRED
       
  1667 	AddNewAttributeL(setvar, nameAttributeId, Kvdata, CDTDElementAttribute::ERequired, dtdRoot);
       
  1668 	// value %vdata #REQUIRED
       
  1669 	AddNewAttributeL(setvar, valueAttributeId, Kvdata, CDTDElementAttribute::ERequired, dtdRoot);
       
  1670 	// %coreattrs
       
  1671 	AddNewReferenceAttributeL(setvar, Kcoreattrs, dtdRoot);
       
  1672 
       
  1673 
       
  1674 	// <!ELEMENT select (optgroup|option)+>
       
  1675 	CBNFNode& select = NewRuleL(dtdRoot, Kselect, EAnd, NULL, NULL, NULL);
       
  1676 	CBNFNode& select1 = NewComponentL( select, ENMore);
       
  1677 	AddComponentAttributeL( select1, CBNFNode::KNMoreMinimum(), 1);
       
  1678 		CBNFNode& select12 = NewComponentL( select1, EOr);
       
  1679 			NewComponentL(dtdRoot, select12, Koptgroup);
       
  1680 			NewComponentL(dtdRoot, select12, Koption);
       
  1681 	// Attributes
       
  1682 	// title %vdata #IMPLIED
       
  1683 	AddNewAttributeL(select, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1684 	// name NMTOKEN #IMPLIED
       
  1685 	AddNewAttributeL(select, nameAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1686 	// value %vdata #IMPLIED
       
  1687 	AddNewAttributeL(select, valueAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1688 	// iname NMTOKEN #IMPLIED
       
  1689 	_LIT(Kiname, "iname");
       
  1690 	AddNewAttributeL(select, iLUT.Des2IDL(Kiname), KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1691 	// ivalue %vdata #IMPLIED
       
  1692 	_LIT(Kivalue, "ivalue");
       
  1693 	AddNewAttributeL(select, iLUT.Des2IDL(Kivalue), Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1694 	// multiple %boolean "false"
       
  1695 	_LIT(Kmultiple, "multiple");
       
  1696 	AddNewAttributeWithValueL(select, iLUT.Des2IDL(Kmultiple), Kboolean, Kfalse, dtdRoot);
       
  1697 	// tabindex %number #IMPLIED
       
  1698 	AddNewAttributeL(select, tabindexAttributeId, Knumber, CDTDElementAttribute::EImplied, dtdRoot);
       
  1699 	// xml:lang NMTOKEN #IMPLIED
       
  1700 	AddNewAttributeL(select, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1701 	// %coreattrs
       
  1702 	AddNewReferenceAttributeL(select, Kcoreattrs, dtdRoot);
       
  1703 
       
  1704 
       
  1705 	// <!ELEMENT optgroup (optgroup|option)+ >
       
  1706 	CBNFNode& optgroup = NewRuleL(dtdRoot, Koptgroup, EAnd, NULL, NULL, NULL);
       
  1707 	CBNFNode& optgroup1 = NewComponentL( optgroup, ENMore);
       
  1708 	AddComponentAttributeL( optgroup1, CBNFNode::KNMoreMinimum(), 1);
       
  1709 		CBNFNode& optgroup11 = NewComponentL( optgroup1, EOr);
       
  1710 			NewComponentL(dtdRoot, optgroup11, Koptgroup);
       
  1711 			NewComponentL(dtdRoot, optgroup11, Koption);
       
  1712 	// Attributes
       
  1713 	// title %vdata #IMPLIED
       
  1714 	AddNewAttributeL(optgroup, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1715 	// xml:lang NMTOKEN #IMPLIED
       
  1716 	AddNewAttributeL(optgroup, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1717 	// %coreattrs
       
  1718 	AddNewReferenceAttributeL(optgroup, Kcoreattrs, dtdRoot);
       
  1719 
       
  1720 
       
  1721 	// <!ELEMENT option (#PCDATA | onevent)*>
       
  1722 	CBNFNode& option = NewRuleL(dtdRoot, Koption, EAnd, NULL, NULL, NULL);
       
  1723 	CBNFNode& option1 = NewComponentL( option, ENMore);
       
  1724 		CBNFNode& option11 = NewComponentL( option1, EOr);
       
  1725 			NewComponentL(dtdRoot, option11, KPCDATA);
       
  1726 			NewComponentL(dtdRoot, option11, Konevent);
       
  1727 	// Attributes
       
  1728 	// value %vdata #IMPLIED
       
  1729 	AddNewAttributeL(option, valueAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1730 	// title %vdata #IMPLIED
       
  1731 	AddNewAttributeL(option, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1732 	// onpick %HREF #IMPLIED
       
  1733 	_LIT(Konpick, "onpick");
       
  1734 	AddNewAttributeL(option, iLUT.Des2IDL(Konpick), KHREF, CDTDElementAttribute::EImplied, dtdRoot);
       
  1735 	// xml:lang NMTOKEN #IMPLIED
       
  1736 	AddNewAttributeL(option, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1737 	// %coreattrs
       
  1738 	AddNewReferenceAttributeL(option, Kcoreattrs, dtdRoot);
       
  1739 
       
  1740 
       
  1741 	// <!ELEMENT input EMPTY>
       
  1742 	CBNFNode& input = NewRuleL(dtdRoot, Kinput, EAnd, NULL, NULL, NULL);
       
  1743 	NewComponentL(dtdRoot, input,KEMPTY);
       
  1744 	// Attributes
       
  1745 	// name NMTOKEN #REQUIRED
       
  1746 	AddNewAttributeL(input, nameAttributeId, KNMTOKEN, CDTDElementAttribute::ERequired, dtdRoot);
       
  1747 	// type text | password "text"
       
  1748 	newAttribute = new(ELeave) CDTDElementAttribute();
       
  1749 	CleanupStack::PushL(newAttribute);
       
  1750 	_LIT(KtextLit, "text");
       
  1751 	_LIT(Kpassword, "password");
       
  1752 	CBNFNode* inputtypeTypeTree = NewComponentL(EOr);
       
  1753 	newAttribute->iType = inputtypeTypeTree;
       
  1754 		NewComponentL(dtdRoot, *inputtypeTypeTree, KtextLit);
       
  1755 		NewComponentL(dtdRoot, *inputtypeTypeTree, Kpassword);
       
  1756 	newAttribute->iValue = NewComponentL(EExact, KtextLit);
       
  1757 	input.AddAttributeL(typeAttributeId, newAttribute);
       
  1758 	CleanupStack::Pop(); // newAttribute
       
  1759 	// value %vdata #IMPLIED
       
  1760 	AddNewAttributeL(input, valueAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1761 	// format CDATA #IMPLIED
       
  1762 	_LIT(Kformat, "format");
       
  1763 	AddNewAttributeL(input, iLUT.Des2IDL(Kformat), KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1764 	// emptyok %boolean "false"
       
  1765 	_LIT(Kemptyok, "emptyok");
       
  1766 	AddNewAttributeWithValueL(input, iLUT.Des2IDL(Kemptyok), Kboolean, Kfalse, dtdRoot);
       
  1767 	// size %number #IMPLIED
       
  1768 	_LIT(Ksize, "size");
       
  1769 	AddNewAttributeL(input, iLUT.Des2IDL(Ksize), Knumber, CDTDElementAttribute::EImplied, dtdRoot);
       
  1770 	// maxlength %number #IMPLIED
       
  1771 	_LIT(Kmaxlength, "maxlength");
       
  1772 	AddNewAttributeL(input, iLUT.Des2IDL(Kmaxlength), Knumber, CDTDElementAttribute::EImplied, dtdRoot);
       
  1773 	// tabindex %number #IMPLIED
       
  1774 	AddNewAttributeL(input, tabindexAttributeId, Knumber, CDTDElementAttribute::EImplied, dtdRoot);
       
  1775 	// title %vdata #IMPLIED
       
  1776 	AddNewAttributeL(input, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1777 	// xml:lang NMTOKEN #IMPLIED
       
  1778 	AddNewAttributeL(input, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1779 	// %coreattrs
       
  1780 	AddNewReferenceAttributeL(input, Kcoreattrs, dtdRoot);
       
  1781 
       
  1782 
       
  1783 	// <!ELEMENT fieldset (%fields; | do)* >
       
  1784 	CBNFNode& fieldset = NewRuleL(dtdRoot, Kfieldset, EAnd, NULL, NULL, NULL);
       
  1785 	CBNFNode& fieldset1 = NewComponentL( fieldset, ENMore);
       
  1786 		CBNFNode& fieldset11 = NewComponentL( fieldset1, EOr);
       
  1787 			NewComponentL(dtdRoot, fieldset11, Kfields);
       
  1788 			NewComponentL(dtdRoot, fieldset11, Kdo);
       
  1789 	// Attributes
       
  1790 	// title %vdata #IMPLIED
       
  1791 	AddNewAttributeL(fieldset, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1792 	// xml:lang NMTOKEN #IMPLIED
       
  1793 	AddNewAttributeL(fieldset, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1794 	// %coreattrs
       
  1795 	AddNewReferenceAttributeL(fieldset, Kcoreattrs, dtdRoot);
       
  1796 
       
  1797 
       
  1798 	// <!ELEMENT timer EMPTY>
       
  1799 	CBNFNode& timer = NewRuleL(dtdRoot, Ktimer, EAnd, NULL, NULL, NULL);
       
  1800 	NewComponentL(dtdRoot, timer, KEMPTY);
       
  1801 	// Attributes
       
  1802 	// name NMTOKEN #IMPLIED
       
  1803 	AddNewAttributeL(timer, nameAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1804 	// value %vdata #REQUIRED
       
  1805 	AddNewAttributeL(timer, valueAttributeId, Kvdata, CDTDElementAttribute::ERequired, dtdRoot);
       
  1806 	// %coreattrs
       
  1807 	AddNewReferenceAttributeL(timer, Kcoreattrs, dtdRoot);
       
  1808 
       
  1809 
       
  1810 	// <!ENTITY % IAlign "(top|middle|bottom)" >
       
  1811 	CBNFNode& ialign = NewRuleL(dtdRoot, KIAlign, EOr, NULL, NULL, NULL);
       
  1812 	NewComponentL(dtdRoot, ialign,Ktop);
       
  1813 	NewComponentL(dtdRoot, ialign, Kmiddle);
       
  1814 	NewComponentL(dtdRoot, ialign, Kbottom);
       
  1815 
       
  1816 
       
  1817 	// <!ELEMENT img EMPTY>
       
  1818 	CBNFNode& img = NewRuleL(dtdRoot, Kimg, EAnd, NULL, NULL, NULL);
       
  1819 	NewComponentL(dtdRoot, img, KEMPTY);
       
  1820 	// Attributes
       
  1821 	// alt %vdata #REQUIRED
       
  1822 	_LIT(Kalt, "alt");
       
  1823 	AddNewAttributeL(img, iLUT.Des2IDL(Kalt), Kvdata, CDTDElementAttribute::ERequired, dtdRoot);
       
  1824 	// src %HREF #REQUIRED
       
  1825 	_LIT(Ksrc, "src");
       
  1826 	AddNewAttributeL(img, iLUT.Des2IDL(Ksrc), KHREF, CDTDElementAttribute::ERequired, dtdRoot);
       
  1827 	// localsrc %vdata #IMPLIED
       
  1828 	_LIT(Klocalsrc, "localsrc");
       
  1829 	AddNewAttributeL(img, iLUT.Des2IDL(Klocalsrc), Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1830 	// vspace %length "0"
       
  1831 	_LIT(KNILL, "0");
       
  1832 	_LIT(Kvspace, "vspace");
       
  1833 	AddNewAttributeWithValueL(img, iLUT.Des2IDL(Kvspace), Klength, KNILL, dtdRoot);
       
  1834 	// hspace %length "0"
       
  1835 	_LIT(Khspace, "hspace");
       
  1836 	AddNewAttributeWithValueL(img, iLUT.Des2IDL(Khspace), Klength, KNILL, dtdRoot);
       
  1837 	// align %IAlign "bottom"
       
  1838 	AddNewAttributeWithValueL(img, alignAttributeId, KIAlign, Kbottom, dtdRoot);
       
  1839 	// height %length #IMPLIED
       
  1840 	_LIT(Kheight , "height");
       
  1841 	AddNewAttributeL(img, iLUT.Des2IDL(Kheight), Klength, CDTDElementAttribute::EImplied, dtdRoot);
       
  1842 	// width %length #IMPLIED
       
  1843 	_LIT(Kwidth, "width");
       
  1844 	AddNewAttributeL(img, iLUT.Des2IDL(Kwidth), Klength, CDTDElementAttribute::EImplied, dtdRoot);
       
  1845 	// xml:lang NMTOKEN #IMPLIED
       
  1846 	AddNewAttributeL(img, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1847 	// %coreattrs
       
  1848 	AddNewReferenceAttributeL(img, Kcoreattrs, dtdRoot);
       
  1849 
       
  1850 
       
  1851 	// <!ELEMENT anchor ( #PCDATA | br | img | go | prev | refresh )*>
       
  1852 	CBNFNode& anchor = NewRuleL(dtdRoot, Kanchor, EAnd, NULL, NULL, NULL);
       
  1853 	CBNFNode& anchor1 = NewComponentL( anchor, ENMore);
       
  1854 	CBNFNode& anchor11 = NewComponentL( anchor1, EOr);
       
  1855 		NewComponentL(dtdRoot, anchor11, KPCDATA);
       
  1856 		NewComponentL(dtdRoot, anchor11, Kbr);
       
  1857 		NewComponentL(dtdRoot, anchor11, Kimg);
       
  1858 		NewComponentL(dtdRoot, anchor11, Kgo);
       
  1859 		NewComponentL(dtdRoot, anchor11, Kprev);
       
  1860 		NewComponentL(dtdRoot, anchor11,Krefresh);
       
  1861 	// Attributes
       
  1862 	// title %vdata #IMPLIED
       
  1863 	AddNewAttributeL(anchor, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1864 	// xml:lang NMTOKEN #IMPLIED
       
  1865 	AddNewAttributeL(anchor, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1866 	// %coreattrs
       
  1867 	AddNewReferenceAttributeL(anchor, Kcoreattrs, dtdRoot);
       
  1868 
       
  1869 
       
  1870 	// <!ELEMENT a ( #PCDATA | br | img )*>
       
  1871 	CBNFNode& a = NewRuleL(dtdRoot, Ka, EAnd, NULL, NULL, NULL);
       
  1872 	CBNFNode& a1 = NewComponentL( a, ENMore);
       
  1873 		CBNFNode& a11 = NewComponentL( a1, EOr);
       
  1874 			NewComponentL(dtdRoot, a11, KPCDATA);
       
  1875 			NewComponentL(dtdRoot, a11, Kbr);
       
  1876 			NewComponentL(dtdRoot, a11, Kimg);
       
  1877 	// Attributes
       
  1878 	// href %HREF #REQUIRED
       
  1879 	AddNewAttributeL(a, hrefAttributeId, KHREF, CDTDElementAttribute::ERequired, dtdRoot);
       
  1880 	// title %vdata #IMPLIED
       
  1881 	AddNewAttributeL(a, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1882 	// xml:lang NMTOKEN #IMPLIED
       
  1883 	AddNewAttributeL(a, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1884 	// %coreattrs
       
  1885 	AddNewReferenceAttributeL(a, Kcoreattrs, dtdRoot);
       
  1886 
       
  1887 
       
  1888 	// <!ELEMENT table (tr)+>
       
  1889 	CBNFNode& table = NewRuleL(dtdRoot, Ktable, EAnd, NULL, NULL, NULL);
       
  1890 	CBNFNode& table1 = NewComponentL( table, ENMore);
       
  1891 		AddComponentAttributeL( table1, CBNFNode::KNMoreMinimum(), 1);
       
  1892 		NewComponentL(dtdRoot, table1, Ktr);
       
  1893 	// Attributes
       
  1894 	// title %vdata #IMPLIED
       
  1895 	AddNewAttributeL(table, titleAttributeId, Kvdata, CDTDElementAttribute::EImplied, dtdRoot);
       
  1896 	// align CDATA #IMPLIED
       
  1897 	AddNewAttributeL(table, alignAttributeId, KCDATA, CDTDElementAttribute::EImplied, dtdRoot);
       
  1898 	// columns %number #REQUIRED
       
  1899 	_LIT(Kcolumns, "columns");
       
  1900 	AddNewAttributeL(table, iLUT.Des2IDL(Kcolumns), Knumber, CDTDElementAttribute::ERequired, dtdRoot);
       
  1901 	// xml:lang NMTOKEN #IMPLIED
       
  1902 	AddNewAttributeL(table, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1903 	// %coreattrs
       
  1904 	AddNewReferenceAttributeL(table, Kcoreattrs, dtdRoot);
       
  1905 
       
  1906 
       
  1907 	// <!ELEMENT tr (td)+>
       
  1908 	CBNFNode& tr = NewRuleL(dtdRoot, Ktr, EAnd, NULL, NULL, NULL);
       
  1909 	CBNFNode& tr1 = NewComponentL( tr, ENMore);
       
  1910 	AddComponentAttributeL( tr1, CBNFNode::KNMoreMinimum(), 1);
       
  1911 		NewComponentL(dtdRoot, tr1, Ktd);
       
  1912 	// Attributes
       
  1913 	// %coreattrs
       
  1914 	AddNewReferenceAttributeL(tr, Kcoreattrs, dtdRoot);
       
  1915 
       
  1916 
       
  1917 	// <!ELEMENT td ( %text; | %layout; | img | anchor | a )*>
       
  1918 	CBNFNode& td = NewRuleL(dtdRoot, Ktd, EAnd, NULL, NULL, NULL);
       
  1919 	CBNFNode& td1 = NewComponentL( td, ENMore);
       
  1920 		CBNFNode& td11 = NewComponentL( td1, EOr);
       
  1921 			NewComponentL(dtdRoot, td11, Ktext);
       
  1922 			NewComponentL(dtdRoot, td11, Klayout);
       
  1923 			NewComponentL(dtdRoot, td11, Kimg);
       
  1924 			NewComponentL(dtdRoot, td11, Kanchor);
       
  1925 			NewComponentL(dtdRoot, td11, Ka);
       
  1926 	// Attributes
       
  1927 	// xml:lang NMTOKEN #IMPLIED
       
  1928 	AddNewAttributeL(td, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1929 	// %coreattrs
       
  1930 	AddNewReferenceAttributeL(td, Kcoreattrs, dtdRoot);
       
  1931 
       
  1932 
       
  1933 	// <!ELEMENT em     (%flow;)*>
       
  1934 	CBNFNode& em = NewRuleL(dtdRoot, Kem, EAnd, NULL, NULL, NULL);
       
  1935 	CBNFNode& em1 = NewComponentL( em, ENMore);
       
  1936 	NewComponentL(dtdRoot, em1, Kflow);
       
  1937 	// Attributes
       
  1938 	// xml:lang NMTOKEN #IMPLIED
       
  1939 	AddNewAttributeL(em, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1940 	// %coreattrs
       
  1941 	AddNewReferenceAttributeL(em, Kcoreattrs, dtdRoot);
       
  1942 
       
  1943 
       
  1944 	// <!ELEMENT strong (%flow;)*>
       
  1945 	CBNFNode& strong = NewRuleL(dtdRoot, Kstrong, EAnd, NULL, NULL, NULL);
       
  1946 	CBNFNode& strong1 = NewComponentL( strong, ENMore);
       
  1947 	NewComponentL(dtdRoot, strong1, Kflow);
       
  1948 	// Attributes
       
  1949 	// xml:lang NMTOKEN #IMPLIED
       
  1950 	AddNewAttributeL(strong, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1951 	// %coreattrs
       
  1952 	AddNewReferenceAttributeL(strong, Kcoreattrs, dtdRoot);
       
  1953 
       
  1954 
       
  1955 	//<!ELEMENT b      (%flow;)*>
       
  1956 	CBNFNode& b = NewRuleL(dtdRoot, Kb, EAnd, NULL, NULL, NULL);
       
  1957 	CBNFNode& b1 = NewComponentL( b, ENMore);
       
  1958 	NewComponentL(dtdRoot, b1, Kflow);
       
  1959 	// Attributes
       
  1960 	// xml:lang NMTOKEN #IMPLIED
       
  1961 	AddNewAttributeL(b, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1962 	// %coreattrs
       
  1963 	AddNewReferenceAttributeL(b, Kcoreattrs, dtdRoot);
       
  1964 
       
  1965 
       
  1966 	// <!ELEMENT i      (%flow;)*>
       
  1967 	CBNFNode& i = NewRuleL(dtdRoot, Ki, EAnd, NULL, NULL, NULL);
       
  1968 	CBNFNode& i1 = NewComponentL( i, ENMore);
       
  1969 	NewComponentL(dtdRoot, i1, Kflow);
       
  1970 	// Attributes
       
  1971 	// xml:lang NMTOKEN #IMPLIED
       
  1972 	AddNewAttributeL(i, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1973 	// %coreattrs
       
  1974 	AddNewReferenceAttributeL(i, Kcoreattrs, dtdRoot);
       
  1975 
       
  1976 
       
  1977 	// <!ELEMENT u      (%flow;)*>
       
  1978 	CBNFNode& u = NewRuleL(dtdRoot, Ku, EAnd, NULL, NULL, NULL);
       
  1979 	CBNFNode& u1 = NewComponentL( u, ENMore);
       
  1980 	NewComponentL(dtdRoot, u1, Kflow);
       
  1981 	// Attributes
       
  1982 	// xml:lang NMTOKEN #IMPLIED
       
  1983 	AddNewAttributeL(u, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1984 	// %coreattrs
       
  1985 	AddNewReferenceAttributeL(u, Kcoreattrs, dtdRoot);
       
  1986 
       
  1987 
       
  1988 	// <!ELEMENT big    (%flow;)*>
       
  1989 	CBNFNode& big = NewRuleL(dtdRoot, Kbig, EAnd, NULL, NULL, NULL);
       
  1990 	CBNFNode& big1 = NewComponentL( big, ENMore);
       
  1991 	NewComponentL(dtdRoot, big1,Kflow);
       
  1992 	// Attributes
       
  1993 	// xml:lang NMTOKEN #IMPLIED
       
  1994 	AddNewAttributeL(big, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  1995 	// %coreattrs
       
  1996 	AddNewReferenceAttributeL(big, Kcoreattrs, dtdRoot);
       
  1997 
       
  1998 
       
  1999 	// <!ELEMENT small  (%flow;)*>
       
  2000 	CBNFNode& small = NewRuleL(dtdRoot, Ksmall, EAnd, NULL, NULL, NULL);
       
  2001 	CBNFNode& small1 = NewComponentL( small, ENMore);
       
  2002 	NewComponentL(dtdRoot, small1,Kflow);
       
  2003 	// Attributes
       
  2004 	// xml:lang NMTOKEN #IMPLIED
       
  2005 	AddNewAttributeL(small, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  2006 	// %coreattrs
       
  2007 	AddNewReferenceAttributeL(small, Kcoreattrs, dtdRoot);
       
  2008 
       
  2009 
       
  2010 	// <!ENTITY % TAlign "(left|right|center)">
       
  2011 	CBNFNode& talign = NewRuleL(dtdRoot, KTAlign, EOr, NULL, NULL, NULL);
       
  2012 	NewComponentL(dtdRoot, talign,Kleft);
       
  2013 	NewComponentL(dtdRoot, talign, Kright);
       
  2014 	NewComponentL(dtdRoot, talign, Kcenter);
       
  2015 
       
  2016 
       
  2017 	// <!ENTITY % WrapMode "(wrap|nowrap)" >
       
  2018 	CBNFNode& wrapmode = NewRuleL(dtdRoot, KWrapMode, EOr, NULL, NULL, NULL);
       
  2019 	NewComponentL(dtdRoot, wrapmode, Kwrap);
       
  2020 	NewComponentL(dtdRoot, wrapmode, Knowrap);
       
  2021 
       
  2022 
       
  2023 	// <!ELEMENT p (%fields; | do)*>
       
  2024 	CBNFNode& p = NewRuleL(dtdRoot, Kp, EAnd, NULL, NULL, NULL);
       
  2025 	CBNFNode& p1 = NewComponentL( p, ENMore);
       
  2026 		CBNFNode& p11 = NewComponentL( p1, EOr);
       
  2027 			NewComponentL(dtdRoot, p11, Kfields);
       
  2028 			NewComponentL(dtdRoot, p11,Kdo);
       
  2029 	// Attributes
       
  2030 	// align %TAlign "left"
       
  2031 	AddNewAttributeWithValueL(p, alignAttributeId, KTAlign, Kleft, dtdRoot);
       
  2032 	// mode %WrapMode #IMPLIED
       
  2033 	_LIT(Kmode, "mode");
       
  2034 	AddNewAttributeL(p, iLUT.Des2IDL(Kmode), KWrapMode, CDTDElementAttribute::EImplied, dtdRoot);
       
  2035 	// xml:lang NMTOKEN #IMPLIED
       
  2036 	AddNewAttributeL(p, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  2037 	// %coreattrs
       
  2038 	AddNewReferenceAttributeL(p, Kcoreattrs, dtdRoot);
       
  2039 
       
  2040 
       
  2041 	// <!ELEMENT br EMPTY>
       
  2042 	CBNFNode& br = NewRuleL(dtdRoot, Kbr, EAnd, NULL, NULL, NULL);
       
  2043 	NewComponentL(dtdRoot, br, KEMPTY);
       
  2044 	// Attributes
       
  2045 	// xml:lang NMTOKEN #IMPLIED
       
  2046 	AddNewAttributeL(br, xmllangAttributeId, KNMTOKEN, CDTDElementAttribute::EImplied, dtdRoot);
       
  2047 	// %coreattrs
       
  2048 	AddNewReferenceAttributeL(br, Kcoreattrs, dtdRoot);
       
  2049 
       
  2050 
       
  2051 	_LIT(Kquot,"quot");
       
  2052 	CBNFNode& quot = NewRuleL(dtdRoot, Kquot, EAnd, NULL, NULL, NULL);
       
  2053 		_LIT(Kquote , "\"");
       
  2054 		NewComponentL( quot, EExact, Kquote );
       
  2055 
       
  2056 
       
  2057 	_LIT(Kamp,"amp");
       
  2058 	CBNFNode& amp = NewRuleL(dtdRoot, Kamp, EAnd, NULL, NULL, NULL);
       
  2059 		_LIT(Kampersand , "&#38;");
       
  2060 		NewComponentL( amp, EExact, Kampersand );
       
  2061 
       
  2062 	_LIT(Kapos,"apos");
       
  2063 	CBNFNode& apos = NewRuleL(dtdRoot, Kapos, EAnd, NULL, NULL, NULL);
       
  2064 		_LIT(Kapostrophe , "'");
       
  2065 		NewComponentL( apos, EExact, Kapostrophe );
       
  2066 
       
  2067 	_LIT(Klt,"lt");
       
  2068 	CBNFNode& lt = NewRuleL(dtdRoot, Klt, EAnd, NULL, NULL, NULL);
       
  2069 		_LIT(Klessthan , "&#60;");
       
  2070 		NewComponentL( lt, EExact, Klessthan );
       
  2071 
       
  2072 	_LIT(Kgt,"gt");
       
  2073 	CBNFNode& gt = NewRuleL(dtdRoot, Kgt, EAnd, NULL, NULL, NULL);
       
  2074 		_LIT(Kgreaterthan , ">");
       
  2075 		NewComponentL( gt, EExact, Kgreaterthan );
       
  2076 
       
  2077 	_LIT(Knbsp,"nbsp");
       
  2078 	CBNFNode& nbsp = NewRuleL(dtdRoot, Knbsp, EAnd, NULL, NULL, NULL);
       
  2079 		_LIT(Knonbreakingspace , "\xA0");
       
  2080 		NewComponentL( nbsp, EExact, Knonbreakingspace );
       
  2081 
       
  2082 	_LIT(Kshy,"shy");
       
  2083 	CBNFNode& shy = NewRuleL(dtdRoot, Kshy, EAnd, NULL, NULL, NULL);
       
  2084 		_LIT(Kshorthyphen , "\xad");
       
  2085 		NewComponentL( shy, EExact, Kshorthyphen );
       
  2086 }