CXMLAttribute* Engine::FileSystem::Config::CXMLElement::FindOrCreateAttribute( const char* name ) { CXMLAttribute* last = 0; CXMLAttribute* attrib = 0; for( attrib = rootAttribute; attrib; last = attrib, attrib = attrib->next ) { if ( CXMLUtil::StringEqual( attrib->Name(), name ) ) { break; } } if ( !attrib ) { attrib = new (document->attributePool.Alloc() ) CXMLAttribute(); attrib->XMLMemPool = &document->attributePool; if ( last ) { last->next = attrib; } else { rootAttribute = attrib; } attrib->SetName( name ); } return attrib; }
CXMLElement* CXMLElement::Prefix(const CString& sPrefix, CXMLElement* pParent) const { CXMLElement* pCloned = Clone( pParent ); if ( pCloned ) { pCloned->SetName( sPrefix + pCloned->GetName() ); for ( POSITION pos = pCloned->GetElementIterator() ; pos ; ) { CXMLElement* pNode = pCloned->GetNextElement( pos ); pNode->SetName( sPrefix + pNode->GetName() ); } for ( POSITION pos = pCloned->GetAttributeIterator() ; pos ; ) { CXMLAttribute* pNode = pCloned->GetNextAttribute( pos ); pNode->SetName( sPrefix + pNode->GetName() ); } } return pCloned; }