bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) { OpenElement( element.Name() ); while ( attribute ) { PushAttribute( attribute->Name(), attribute->Value() ); attribute = attribute->Next(); } return true; }
bool XMLPrinter::VisitEnter(const XMLElement& element, const XMLAttribute* attribute) { const XMLElement* parentElem = element.Parent()->ToElement(); bool compactMode = parentElem ? CompactMode(*parentElem) : _compactMode; OpenElement(element.Name(), compactMode); while (attribute) { PushAttribute(attribute->Name(), attribute->Value()); attribute = attribute->Next(); } return true; }
void XMLPrinter::PushAttribute( const char* name, double v ) { char buf[BUF_SIZE]; XMLUtil::ToStr( v, buf, BUF_SIZE ); PushAttribute( name, buf ); }
void TPodLexer::NextTokenL(TPtrC& aToken, TTokenType& aTokenType, TUint& aAttributes, TBool& aEop, TBool& aEos) { aTokenType = ETextBlock; iScratch.Zero(); TBool finished(EFalse); TBool setAttributes(ETrue); while (!iLex.Eos() && !finished && (iScratch.Length() < (iScratch.MaxLength() - 1))) { iLex.Mark(); TUint16 sequenceIdentifier; if ((iAttributeStackIndex > 0) && (iLex.Peek() == '>')) { if (iScratch.Length() > 0) { aAttributes = iAttributes; setAttributes = EFalse; finished = ETrue; } else { iLex.Get(); aTokenType = EAttributePop; aAttributes = PopAttribute(); setAttributes = EFalse; finished = ETrue; } } else if (IsInteriorSequenceStart(sequenceIdentifier)) { if (iScratch.Length() > 0) { iLex.UnGetToMark(); finished = ETrue; } else { switch (sequenceIdentifier) { case 'B': PushAttribute(EBold); aAttributes = EBold; setAttributes = EFalse; aTokenType = EAttributePush; finished = ETrue; break; case 'C': PushAttribute(ECode); aAttributes = ECode; setAttributes = EFalse; aTokenType = EAttributePush; finished = ETrue; break; case 'E': if (iLex.Remainder().Length() >= 3) { if (iLex.Remainder().Left(3) == _L("gt>")) { iLex.Inc(3); iScratch.Append('>'); } else if (iLex.Remainder().Left(3) == _L("lt>")) { iLex.Inc(3); iScratch.Append('<'); } else { TUint num; TInt err = iLex.Val(num); if (err == KErrNone) { iScratch.Append(num); } else { User::Leave(err); } } } break; case 'F': PushAttribute(EFileName); aAttributes = EFileName; setAttributes = EFalse; aTokenType = EAttributePush; finished = ETrue; break; case 'I': PushAttribute(EItalic); aAttributes = EItalic; setAttributes = EFalse; aTokenType = EAttributePush; finished = ETrue; break; case 'L': iLex.Mark(); SkipToClosingAngleBracket(); iLex.UnGet(); iScratch.Copy(iLex.MarkedToken()); iLex.Get(); aTokenType = ELink; finished = ETrue; break; case 'S': case 'X': PushAttribute(ENull); aAttributes = ENull; setAttributes = EFalse; aTokenType = EAttributePush; finished = ETrue; break; case 'Z': if (iLex.Peek() == '>') { iLex.Inc(); iLex.Mark(); } else { User::Leave(KErrArgument); } break; } } } else { iScratch.Append(iLex.Get()); } } if (setAttributes) { aAttributes = iAttributes; } aToken.Set(iScratch); aEop = Eop(); aEos = iLex.Eos(); }