diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-03 13:30:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-04 16:29:53 +0200 |
commit | a20f9a410fdd3f776f870434bc39219d5fc64b40 (patch) | |
tree | 079278e5859c5782fbe9bfcc34302d09bd8dfadd /package/source/manifest/ManifestReader.cxx | |
parent | bd6b41bce491ac5a5f562652b7e32045cc22c35c (diff) |
fdo#46808, Adapt xml::sax::XParser UNO service to new style
The xml.sax.Parser service already existed, it just did not have
a new-style service to create it.
Change-Id: I6f145a7504ff9e149c802f723991954a2801cbc9
Diffstat (limited to 'package/source/manifest/ManifestReader.cxx')
-rw-r--r-- | package/source/manifest/ManifestReader.cxx | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/package/source/manifest/ManifestReader.cxx b/package/source/manifest/ManifestReader.cxx index f57f43bf74b3..9ff714484b81 100644 --- a/package/source/manifest/ManifestReader.cxx +++ b/package/source/manifest/ManifestReader.cxx @@ -19,10 +19,11 @@ #include <ManifestReader.hxx> #include <ManifestImport.hxx> +#include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> -#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <vector> @@ -49,34 +50,31 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ManifestReader::readManifestSeque throw (::com::sun::star::uno::RuntimeException) { Sequence < Sequence < PropertyValue > > aManifestSequence; - Reference < XParser > xParser (xFactory->createInstance ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.xml.sax.Parser" ) ) ), UNO_QUERY ); - if (xParser.is()) + Reference < XParser > xParser = Parser::create(comphelper::getComponentContext(xFactory)); + try + { + vector < Sequence < PropertyValue > > aManVector; + Reference < XDocumentHandler > xFilter = new ManifestImport( aManVector ); + InputSource aParserInput; + aParserInput.aInputStream = rStream; + aParserInput.sSystemId = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) ); + xParser->setDocumentHandler ( xFilter ); + xParser->parseStream( aParserInput ); + aManifestSequence.realloc ( aManVector.size() ); + Sequence < PropertyValue > * pSequence = aManifestSequence.getArray(); + ::std::vector < Sequence < PropertyValue > >::const_iterator aIter = aManVector.begin(); + ::std::vector < Sequence < PropertyValue > >::const_iterator aEnd = aManVector.end(); + while( aIter != aEnd ) + *pSequence++ = (*aIter++); + } + catch (SAXParseException& ) + { + } + catch (SAXException& ) + { + } + catch (IOException& ) { - try - { - vector < Sequence < PropertyValue > > aManVector; - Reference < XDocumentHandler > xFilter = new ManifestImport( aManVector ); - InputSource aParserInput; - aParserInput.aInputStream = rStream; - aParserInput.sSystemId = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) ); - xParser->setDocumentHandler ( xFilter ); - xParser->parseStream( aParserInput ); - aManifestSequence.realloc ( aManVector.size() ); - Sequence < PropertyValue > * pSequence = aManifestSequence.getArray(); - ::std::vector < Sequence < PropertyValue > >::const_iterator aIter = aManVector.begin(); - ::std::vector < Sequence < PropertyValue > >::const_iterator aEnd = aManVector.end(); - while( aIter != aEnd ) - *pSequence++ = (*aIter++); - } - catch (SAXParseException& ) - { - } - catch (SAXException& ) - { - } - catch (IOException& ) - { - } } xParser->setDocumentHandler ( Reference < XDocumentHandler > () ); return aManifestSequence; |