コード例 #1
0
CXMLElement* Engine::FileSystem::Config::CXMLDocument::NewElement( const char* name )
{
	CXMLElement* ele = new (elementPool.Alloc()) CXMLElement( this );
	ele->XMLMemPool = &elementPool;
	ele->SetName( name );
	return ele;
}
コード例 #2
0
ファイル: XML.cpp プロジェクト: lemonxiao0/peerproject
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;
}
コード例 #3
0
ファイル: CollectionFile.cpp プロジェクト: GetEnvy/Envy
CXMLElement* CCollectionFile::CloneMetadata(CXMLElement* pMetadata)
{
	CString strURI = pMetadata->GetAttributeValue( L"xmlns:s" );
	if ( strURI.IsEmpty() ) return NULL;

	CXMLElement* pCore = pMetadata->GetFirstElement();
	if ( pCore == NULL ) return NULL;

	if ( CSchemaPtr pSchema = SchemaCache.Get( strURI ) )
	{
		pMetadata = pSchema->Instantiate();
	}
	else
	{
		pMetadata = new CXMLElement( NULL, pCore->GetName() + 's' );
		pMetadata->AddAttribute( CXMLAttribute::schemaName, strURI );
	}

	pCore = pCore->Clone();
	pMetadata->AddElement( pCore );

	CString strName = pMetadata->GetName();
	if ( _tcsnicmp( strName, L"s:", 2 ) == 0 )
		pMetadata->SetName( strName.Mid( 2 ) );

	strName = pCore->GetName();
	if ( _tcsnicmp( strName, L"s:", 2 ) == 0 )
		pCore->SetName( strName.Mid( 2 ) );

	for ( POSITION pos = pCore->GetElementIterator(); pos; )
	{
		CXMLNode* pNode = pCore->GetNextElement( pos );
		CString strNodeName = pNode->GetName();
		if ( _tcsnicmp( strNodeName, L"s:", 2 ) == 0 )
			pNode->SetName( strNodeName.Mid( 2 ) );
	}

	for ( POSITION pos = pCore->GetAttributeIterator(); pos; )
	{
		CXMLNode* pNode = pCore->GetNextAttribute( pos );
		CString strNodeName = pNode->GetName();
		if ( _tcsnicmp( strNodeName, L"s:", 2 ) == 0 )
			pNode->SetName( strNodeName.Mid( 2 ) );
	}

	return pMetadata;
}
コード例 #4
0
void CPlayProfilePage::OnAdd() 
{
	int nItem = m_wndList.GetNextItem( -1, LVNI_SELECTED );
	CXMLElement* pXML = ( nItem != -1 ) ? (CXMLElement*)m_wndList.GetItemData(nItem) : NULL;
	
	if ( pXML ) pXML = pXML->Clone();
	else pXML = new CXMLElement( NULL, _T("Album") );
	
	if ( pXML = m_pXML->AddElement( pXML ) )
	{
		CString strValue;
		m_wndClass.GetWindowText( strValue );
		
		pXML->SetName( strValue.CompareNoCase("子类") == 0 ? _T("Album") : _T("Play") );
		
		m_wndKey.GetWindowText( strValue );
		pXML->AddAttribute( _T("ID"), strValue );
		
		int nItem = m_wndList.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, m_wndList.GetItemCount(),
			strValue, 0, 0, pXML->IsNamed( "Album" ) ? 23 : 24, (LPARAM)pXML );
		
		m_wndName.GetWindowText( strValue );
		pXML->AddAttribute( _T("Play"), strValue );
		m_wndList.SetItemText( nItem, 1, strValue );
		
		m_wndClass.GetWindowText( strValue );
		pXML->AddAttribute( _T("Class"), strValue );
		
		m_wndHost.GetWindowText( strValue );
		pXML->AddAttribute( _T("Host"), strValue );
		m_wndList.SetItemText( nItem, 2, strValue );
		
		m_wndAdmin.GetWindowText( strValue );
		pXML->AddAttribute( _T("Admin"), strValue );
		
		m_wndGroup.GetWindowText( strValue );
		pXML->AddAttribute( _T("Group"), strValue );
	}
}