void CSenPropertiesElement::Set( const TDesC8& aNamespaceURI, const TDesC8& aLocalName, const TDesC8& aQName ) { if ( !ipStringPool ) { CSenXmlElement::Set(aNamespaceURI, aLocalName, aQName); } else { RString localName; TInt leaveCode(KErrNone); TRAP( leaveCode, localName = ipStringPool->OpenStringL(aLocalName); ) if( !leaveCode ) { iLocalName.Close(); iLocalName = localName; TPtrC8 prefix(KNullDesC8); if(aQName != KNullDesC8) { TInt colon(KErrNotFound); colon = aQName.Locate(':'); if(colon!=KErrNotFound) { prefix.Set(aQName.Left(colon)); } } TRAP( leaveCode, SetNamespaceL(prefix, aNamespaceURI); )
void CSenPropertiesElement::BaseConstructL(const TDesC8& aNsUri, const TDesC8& aLocalName, const TDesC8& aQName, RStringPool* aStringPool) { ipStringPool = aStringPool; if (aLocalName == KNullDesC8) { User::Leave(KErrSenZeroLengthDescriptor); } SenXmlUtils::LeaveOnXmlEscapesL(aLocalName); if (aQName == KNullDesC8) { User::Leave(KErrSenZeroLengthDescriptor); } SenXmlUtils::LeaveOnXmlEscapesL(aQName); if ( ipStringPool ) { iLocalName = ipStringPool->OpenStringL(aLocalName); } else { Set(KNullDesC8, aLocalName, aLocalName); } TPtrC8 ptrPrefix(KNullDesC8); if (aQName.Length() > 0 ) { TInt colon = aQName.Locate(':'); if (colon > 0) // Note: 0 also treated as no prefix { ptrPrefix.Set(aQName.Ptr(),colon); } } SetNamespaceL(ptrPrefix, aNsUri); }
void CSenPropertiesElement::BaseConstructL(const TDesC8& aNsUri, const TDesC8& aLocalName, RStringPool* aStringPool) { ipStringPool = aStringPool; if (aLocalName == KNullDesC8) { User::Leave(KErrSenZeroLengthDescriptor); } SenXmlUtils::LeaveOnXmlEscapesL(aLocalName); if(aNsUri.Length()>0) { SetNamespaceL(aNsUri); } if ( ipStringPool ) { iLocalName = ipStringPool->OpenStringL(aLocalName); } else { Set(KNullDesC8, aLocalName, aLocalName); } }
EXPORT_C void CSyGeneratorBase::SetNamespaceL(const TDesC& aURI) { SetNamespaceL(KEmptyPrefix, aURI); }
void CSenPropertiesElement::CopyFromL(CSenElement& aSource) { TPtrC8 sourceContent = aSource.Content(); if (sourceContent.Length() > 0) { SetContentL(sourceContent); } RPointerArray<CSenElement> sourceElements = aSource.ElementsL(); if (sourceElements.Count() > 0) { for (TInt i=0;i<sourceElements.Count(); i++) { CSenElement* pElement = sourceElements[i]; CSenElement* pNewElement = CSenPropertiesElement::NewL(pElement->LocalName(), ipStringPool); pNewElement->CopyFromL(*pElement); CSenXmlElement::AddElementL(*pNewElement); } } RPointerArray<CSenBaseAttribute> sourceAttributes = aSource.AttributesL(); if (sourceAttributes.Count() > 0) { for (TInt i=0;i<sourceAttributes.Count(); i++) { CSenBaseAttribute* pBaseAttribute = sourceAttributes[i]; // 2005-04-28: check for duplicate and override existing value if // attribute already exists. CSenBaseAttribute* pOriginal = FindAttr(pBaseAttribute->Name()); if (pOriginal) { pOriginal->SetValueL(pBaseAttribute->Value()); continue; } CSenBaseAttribute* pNewBaseAttribute = CSenBaseAttribute::NewL(pBaseAttribute->Name(), pBaseAttribute->Value()); CSenXmlElement::AddAttributeL(pNewBaseAttribute); } } RPointerArray<CSenNamespace> sourceNamespaces = aSource.NamespacesL(); if (sourceNamespaces.Count() > 0) { for (TInt i=0;i<sourceNamespaces.Count(); i++) { CSenNamespace* pNamespace = sourceNamespaces[i]; CSenNamespace* pNewNamespace = CSenNamespace::NewL(pNamespace->Prefix(),pNamespace->URI()); CleanupStack::PushL(pNewNamespace); CSenXmlElement::AddNamespaceL(*pNewNamespace, EFalse); CleanupStack::Pop(); } } SetNamespaceL(aSource.NamespaceURI()); }