summaryrefslogtreecommitdiff
path: root/sax/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sax/qa')
-rw-r--r--sax/qa/cppunit/xmlimport.cxx33
-rw-r--r--sax/qa/data/manifestwithnsdecl.xml12
-rw-r--r--sax/qa/data/manifestwithoutnsdecl.xml12
3 files changed, 55 insertions, 2 deletions
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index c0320fc00351..f7fcd739d4c3 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -278,10 +278,12 @@ public:
XMLImportTest() : BootstrapFixture(true, false) {}
void parse();
+ void testMissingNamespaceDeclaration();
void testIllegalNamespaceUse();
CPPUNIT_TEST_SUITE( XMLImportTest );
CPPUNIT_TEST( parse );
+ CPPUNIT_TEST( testMissingNamespaceDeclaration );
CPPUNIT_TEST( testIllegalNamespaceUse );
CPPUNIT_TEST_SUITE_END();
};
@@ -317,11 +319,11 @@ void XMLImportTest::parse()
source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] );
m_xParser->parseStream(source);
- const OUString& rParserStr = m_xDocumentHandler->getString();
+ const OUString rParserStr = m_xDocumentHandler->getString();
source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] );
m_xLegacyFastParser->parseStream(source);
- const OUString& rLegacyFastParserStr = m_xDocumentHandler->getString();
+ const OUString rLegacyFastParserStr = m_xDocumentHandler->getString();
CPPUNIT_ASSERT_EQUAL( rParserStr, rLegacyFastParserStr );
// OString o = OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US );
@@ -329,6 +331,33 @@ void XMLImportTest::parse()
}
}
+void XMLImportTest::testMissingNamespaceDeclaration()
+{
+ OUString fileNames[] = { "manifestwithnsdecl.xml", "manifestwithoutnsdecl.xml" };
+
+ uno::Reference<lang::XInitialization> const xInit(m_xLegacyFastParser,
+ uno::UNO_QUERY_THROW);
+ uno::Sequence<uno::Any> args(1);
+ args[0] <<= OUString("IgnoreMissingNSDecl");
+ xInit->initialize( args );
+
+ for (sal_uInt16 i = 0; i < sizeof( fileNames ) / sizeof( OUString ); i++)
+ {
+ InputSource source;
+ source.sSystemId = "internal";
+
+ source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] );
+ m_xParser->parseStream(source);
+ const OUString rParserStr = m_xDocumentHandler->getString();
+
+ source.aInputStream = createStreamFromFile( m_sDirPath + fileNames[i] );
+ m_xLegacyFastParser->parseStream(source);
+ const OUString rLegacyFastParserStr = m_xDocumentHandler->getString();
+
+ CPPUNIT_ASSERT_EQUAL( rParserStr, rLegacyFastParserStr );
+ }
+}
+
void XMLImportTest::testIllegalNamespaceUse()
{
rtl::Reference< NSDocumentHandler > m_xNSDocumentHandler;
diff --git a/sax/qa/data/manifestwithnsdecl.xml b/sax/qa/data/manifestwithnsdecl.xml
new file mode 100644
index 000000000000..ac61c3e206f0
--- /dev/null
+++ b/sax/qa/data/manifestwithnsdecl.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">
+ <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.text"/>
+ <manifest:file-entry manifest:full-path="Thumbnails/thumbnail.png" manifest:media-type="image/png"/>
+ <manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="styles.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="meta.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="settings.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="Configurations2/accelerator/current.xml" manifest:media-type=""/>
+ <manifest:file-entry manifest:full-path="Configurations2/" manifest:media-type="application/vnd.sun.xml.ui.configuration"/>
+ <manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/>
+</manifest:manifest>
diff --git a/sax/qa/data/manifestwithoutnsdecl.xml b/sax/qa/data/manifestwithoutnsdecl.xml
new file mode 100644
index 000000000000..1c8f5359636d
--- /dev/null
+++ b/sax/qa/data/manifestwithoutnsdecl.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest:manifest>
+ <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.text"/>
+ <manifest:file-entry manifest:full-path="Thumbnails/thumbnail.png" manifest:media-type="image/png"/>
+ <manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="styles.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="meta.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="settings.xml" manifest:media-type="text/xml"/>
+ <manifest:file-entry manifest:full-path="Configurations2/accelerator/current.xml" manifest:media-type=""/>
+ <manifest:file-entry manifest:full-path="Configurations2/" manifest:media-type="application/vnd.sun.xml.ui.configuration"/>
+ <manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/>
+</manifest:manifest>