Commit 41482dcc authored by Erwan Tulou's avatar Erwan Tulou

skins2: cleanup and remove a now highly dubious useDTD parameter

parent fe659105
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include <math.h> #include <math.h>
SkinParser::SkinParser( intf_thread_t *pIntf, const string &rFileName, SkinParser::SkinParser( intf_thread_t *pIntf, const string &rFileName,
const string &rPath, bool useDTD, BuilderData *pData ): const string &rPath, BuilderData *pData ):
XMLParser( pIntf, rFileName, useDTD ), m_path( rPath), m_pData(pData), XMLParser( pIntf, rFileName ), m_path( rPath ), m_pData( pData ),
m_ownData(pData == NULL), m_xOffset( 0 ), m_yOffset( 0 ) m_ownData( pData == NULL ), m_xOffset( 0 ), m_yOffset( 0 )
{ {
// Make sure the data is allocated // Make sure the data is allocated
if( m_pData == NULL ) if( m_pData == NULL )
...@@ -76,9 +76,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr ) ...@@ -76,9 +76,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
OSFactory *pFactory = OSFactory::instance( getIntf() ); OSFactory *pFactory = OSFactory::instance( getIntf() );
string fullPath = m_path + pFactory->getDirSeparator() + attr["file"]; string fullPath = m_path + pFactory->getDirSeparator() + attr["file"];
msg_Dbg( getIntf(), "opening included XML file: %s", fullPath.c_str() ); msg_Dbg( getIntf(), "opening included XML file: %s", fullPath.c_str() );
// FIXME: We do not use the DTD to validate the included XML file, SkinParser subParser( getIntf(), fullPath.c_str(), m_path, m_pData );
// as the parser seems to dislike it otherwise...
SkinParser subParser( getIntf(), fullPath.c_str(), m_path, false, m_pData );
subParser.parse(); subParser.parse();
} }
......
...@@ -44,8 +44,7 @@ public: ...@@ -44,8 +44,7 @@ public:
}; };
SkinParser( intf_thread_t *pIntf, const string &rFileName, SkinParser( intf_thread_t *pIntf, const string &rFileName,
const string &rPath, bool useDTD = true, const string &rPath, BuilderData *pData = NULL );
BuilderData *pData = NULL );
virtual ~SkinParser(); virtual ~SkinParser();
const BuilderData &getData() const { return *m_pData; } const BuilderData &getData() const { return *m_pData; }
......
...@@ -29,35 +29,28 @@ ...@@ -29,35 +29,28 @@
# include <sys/stat.h> # include <sys/stat.h>
#endif #endif
XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName, XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName )
bool useDTD ): : SkinObject( pIntf ), m_pXML( NULL ), m_pReader( NULL ), m_pStream( NULL )
SkinObject( pIntf )
{ {
m_pReader = NULL; m_pXML = xml_Create( pIntf );
m_pStream = NULL; if( !m_pXML )
if( useDTD )
{ {
m_pXML = xml_Create( pIntf ); msg_Err( getIntf(), "cannot initialize xml" );
if( m_pXML ) return;
LoadCatalog();
else
msg_Err( getIntf(), "DTD not supported" );
} }
else
m_pXML = NULL; LoadCatalog();
char* psz_uri = make_URI( rFileName.c_str(), NULL ); char* psz_uri = make_URI( rFileName.c_str(), NULL );
m_pStream = stream_UrlNew( pIntf, psz_uri ); m_pStream = stream_UrlNew( pIntf, psz_uri );
free( psz_uri ); free( psz_uri );
if( !m_pStream ) if( !m_pStream )
{ {
msg_Err( getIntf(), "failed to open %s for reading", msg_Err( getIntf(), "failed to open %s for reading",
rFileName.c_str() ); rFileName.c_str() );
m_pReader = NULL;
return; return;
} }
m_pReader = xml_ReaderCreate( m_pXML, m_pStream ); m_pReader = xml_ReaderCreate( m_pXML, m_pStream );
if( !m_pReader ) if( !m_pReader )
{ {
...@@ -66,8 +59,7 @@ XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName, ...@@ -66,8 +59,7 @@ XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName,
return; return;
} }
if( m_pXML ) xml_ReaderUseDTD( m_pReader );
xml_ReaderUseDTD( m_pReader );
} }
...@@ -105,7 +97,7 @@ void XMLParser::LoadCatalog() ...@@ -105,7 +97,7 @@ void XMLParser::LoadCatalog()
if( it == resPath.end() ) if( it == resPath.end() )
{ {
// Ok, try the default one // Ok, try the default one
xml_CatalogLoad( m_pXML, 0 ); xml_CatalogLoad( m_pXML, NULL );
} }
for( it = resPath.begin(); it != resPath.end(); ++it ) for( it = resPath.begin(); it != resPath.end(); ++it )
......
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
class XMLParser: public SkinObject class XMLParser: public SkinObject
{ {
public: public:
XMLParser( intf_thread_t *pIntf, const string &rFileName, XMLParser( intf_thread_t *pIntf, const string &rFileName );
bool useDTD = true );
virtual ~XMLParser(); virtual ~XMLParser();
/// Parse the file. Returns true on success /// Parse the file. Returns true on success
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment