Index: /trunk/libffado/src/SConscript =================================================================== --- /trunk/libffado/src/SConscript (revision 2590) +++ /trunk/libffado/src/SConscript (revision 2650) @@ -289,4 +289,7 @@ libenv.MergeFlags( env['LIBCONFIG_FLAGS'] ) if not env['SERIALIZE_USE_EXPAT']: + if 'LIBXML30_FLAGS' in env : + libenv.MergeFlags( env['LIBXML30_FLAGS'] ) + if not('LIBXML30_FLAGS' in env) : libenv.MergeFlags( env['LIBXML26_FLAGS'] ) else: Index: /trunk/libffado/src/libutil/serialize_libxml.cpp =================================================================== --- /trunk/libffado/src/libutil/serialize_libxml.cpp (revision 1763) +++ /trunk/libffado/src/libutil/serialize_libxml.cpp (revision 2650) @@ -76,9 +76,17 @@ Util::XMLSerialize::writeVersion() { +#if LIBXMLXX_MAJOR_VERSION == 3 + xmlpp::Element* pElem = m_doc.get_root_node()->add_child_element( "CacheVersion" ); +#else xmlpp::Node* pNode = m_doc.get_root_node(); xmlpp::Element* pElem = pNode->add_child( "CacheVersion" ); +#endif char* valstr; asprintf( &valstr, "%s", CACHE_VERSION ); +#if LIBXMLXX_MAJOR_VERSION == 3 + pElem->set_first_child_text( valstr ); +#else pElem->set_child_text( valstr ); +#endif free( valstr ); } @@ -100,12 +108,20 @@ } - xmlpp::Node* pNode = m_doc.get_root_node(); + xmlpp::Element* pNode = m_doc.get_root_node(); pNode = getNodePath( pNode, tokens ); // element to be added +#if LIBXMLXX_MAJOR_VERSION == 3 + xmlpp::Element* pElem = pNode->add_child_element( tokens[tokens.size() - 1] ); +#else xmlpp::Element* pElem = pNode->add_child( tokens[tokens.size() - 1] ); +#endif char* valstr; asprintf( &valstr, "%lld", value ); +#if LIBXMLXX_MAJOR_VERSION == 3 + pElem->set_first_child_text( valstr ); +#else pElem->set_child_text( valstr ); +#endif free( valstr ); @@ -128,16 +144,21 @@ } - xmlpp::Node* pNode = m_doc.get_root_node(); + xmlpp::Element* pNode = m_doc.get_root_node(); pNode = getNodePath( pNode, tokens ); // element to be added +#if LIBXMLXX_MAJOR_VERSION == 3 + xmlpp::Element* pElem = pNode->add_child_element( tokens[tokens.size() - 1] ); + pElem->set_first_child_text( str ); +#else xmlpp::Element* pElem = pNode->add_child( tokens[tokens.size() - 1] ); pElem->set_child_text( str ); +#endif return true; } -xmlpp::Node* -Util::XMLSerialize::getNodePath( xmlpp::Node* pRootNode, +xmlpp::Element* +Util::XMLSerialize::getNodePath( xmlpp::Element* pRootNode, std::vector& tokens ) { @@ -150,5 +171,5 @@ unsigned int iTokenIdx = 0; - xmlpp::Node* pCurNode = pRootNode; + xmlpp::Element* pCurNode = pRootNode; for (bool bFound = false; ( iTokenIdx < tokens.size() - 1 ); @@ -161,5 +182,5 @@ { if ( ( *it )->get_name() == tokens[iTokenIdx] ) { - pCurNode = *it; + pCurNode = (xmlpp::Element*) *it; bFound = true; break; @@ -172,5 +193,9 @@ for ( unsigned int i = iTokenIdx; i < tokens.size() - 1; i++, iTokenIdx++ ) { +#if LIBXMLXX_MAJOR_VERSION == 3 + pCurNode = pCurNode->add_child_element( tokens[iTokenIdx] ); +#else pCurNode = pCurNode->add_child( tokens[iTokenIdx] ); +#endif } return pCurNode; @@ -255,8 +280,15 @@ debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "pNode = %s\n", pNode->get_name().c_str() ); +#if LIBXMLXX_MAJOR_VERSION == 3 + xmlpp::Node::NodeSet nodeSet = pNode->find( strMemberName ); + for ( xmlpp::Node::NodeSet::iterator it = nodeSet.begin(); + it != nodeSet.end(); + ++it ) +#else xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); it != nodeSet.end(); ++it ) +#endif { const xmlpp::Element* pElement = @@ -264,6 +296,11 @@ if ( pElement && pElement->has_child_text() ) { char* tail; +#if LIBXMLXX_MAJOR_VERSION == 3 + value = strtoll( pElement->get_first_child_text()->get_content().c_str(), + &tail, 0 ); +#else value = strtoll( pElement->get_child_text()->get_content().c_str(), &tail, 0 ); +#endif debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "found %s = %lld\n", strMemberName.c_str(), value ); @@ -291,13 +328,24 @@ xmlpp::Node* pNode = pDoc->get_root_node(); +#if LIBXMLXX_MAJOR_VERSION == 3 + xmlpp::Node::NodeSet nodeSet = pNode->find( strMemberName ); + for ( xmlpp::Node::NodeSet::iterator it = nodeSet.begin(); + it != nodeSet.end(); + ++it ) +#else xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); for ( xmlpp::NodeSet::iterator it = nodeSet.begin(); it != nodeSet.end(); ++it ) +#endif { const xmlpp::Element* pElement = dynamic_cast< const xmlpp::Element* >( *it ); if ( pElement ) { if ( pElement->has_child_text() ) { +#if LIBXMLXX_MAJOR_VERSION == 3 + str = pElement->get_first_child_text()->get_content(); +#else str = pElement->get_child_text()->get_content(); +#endif } else { str = ""; @@ -323,5 +371,9 @@ } xmlpp::Node* pNode = pDoc->get_root_node(); +#if LIBXMLXX_MAJOR_VERSION == 3 + xmlpp::Node::NodeSet nodeSet = pNode->find( strMemberName ); +#else xmlpp::NodeSet nodeSet = pNode->find( strMemberName ); +#endif return nodeSet.size() > 0; } Index: /trunk/libffado/src/libutil/serialize_libxml.h =================================================================== --- /trunk/libffado/src/libutil/serialize_libxml.h (revision 1154) +++ /trunk/libffado/src/libutil/serialize_libxml.h (revision 2650) @@ -81,5 +81,5 @@ DECLARE_DEBUG_MODULE; - xmlpp::Node* getNodePath( xmlpp::Node* pRootNode, + xmlpp::Element* getNodePath( xmlpp::Element* pRootNode, std::vector& tokens ); }; Index: /trunk/libffado/tests/SConscript =================================================================== --- /trunk/libffado/tests/SConscript (revision 2141) +++ /trunk/libffado/tests/SConscript (revision 2650) @@ -33,4 +33,7 @@ env.MergeFlags( env['LIBRAW1394_FLAGS'] ) if not env['SERIALIZE_USE_EXPAT']: + if 'LIBXML30_FLAGS' in env : + env.MergeFlags( env['LIBXML30_FLAGS'] ) + if not('LIBXML30_FLAGS' in env) : env.MergeFlags( env['LIBXML26_FLAGS'] ) else: Index: /trunk/libffado/SConstruct =================================================================== --- /trunk/libffado/SConstruct (revision 2628) +++ /trunk/libffado/SConstruct (revision 2650) @@ -277,5 +277,8 @@ if not env['SERIALIZE_USE_EXPAT']: - pkgs['libxml++-2.6'] = '2.13.0' + if conf.CheckPKG('libxml++-3.0'): + pkgs['libxml++-3.0'] = '3.0.0' + if not('libxml++-3.0' in pkgs): + pkgs['libxml++-2.6'] = '2.13.0' # Provide a way for users to compile newer libffado which will work @@ -359,4 +362,6 @@ if conf.CheckPKG('libxml++-2.6 >= 2.39.1'): env.Append(CXXFLAGS = '-std=gnu++11') + if conf.CheckPKG('libxml++-3.0 >= 3.0.0'): + env.Append(CXXFLAGS = '-std=gnu++11') # Check for C99 lrint() and lrintf() functions used to convert from Index: /trunk/libffado/support/tools/SConscript =================================================================== --- /trunk/libffado/support/tools/SConscript (revision 2321) +++ /trunk/libffado/support/tools/SConscript (revision 2650) @@ -34,4 +34,7 @@ if not e.GetOption( "clean" ): if not env['SERIALIZE_USE_EXPAT']: + if 'LIBXML30_FLAGS' in env : + e.MergeFlags( env['LIBXML30_FLAGS'] ) + if not('LIBXML30_FLAGS' in env) : e.MergeFlags( env['LIBXML26_FLAGS'] ) else: Index: /trunk/libffado/support/firmware/SConscript =================================================================== --- /trunk/libffado/support/firmware/SConscript (revision 2089) +++ /trunk/libffado/support/firmware/SConscript (revision 2650) @@ -34,5 +34,8 @@ env.MergeFlags( env['LIBIEC61883_FLAGS'] ) if not env['SERIALIZE_USE_EXPAT']: - env.MergeFlags( env['LIBXML26_FLAGS'] ) + if 'LIBXML30_FLAGS' in env : + env.MergeFlags( env['LIBXML30_FLAGS'] ) + if not('LIBXML30_FLAGS' in env) : + env.MergeFlags( env['LIBXML26_FLAGS'] ) else: env.PrependUnique( LIBS=["expat"] ) Index: /trunk/libffado/support/dbus/SConscript =================================================================== --- /trunk/libffado/support/dbus/SConscript (revision 2165) +++ /trunk/libffado/support/dbus/SConscript (revision 2650) @@ -42,5 +42,8 @@ env.MergeFlags( env['LIBRAW1394_FLAGS'] ) if not env['SERIALIZE_USE_EXPAT']: - env.MergeFlags( env['LIBXML26_FLAGS'] ) + if 'LIBXML30_FLAGS' in env : + env.MergeFlags( env['LIBXML30_FLAGS'] ) + if not('LIBXML30_FLAGS' in env) : + env.MergeFlags( env['LIBXML26_FLAGS'] ) else: env.PrependUnique( LIBS=["expat"] )