18590a0fdSAndre Fischer /************************************************************** 28590a0fdSAndre Fischer * 38590a0fdSAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 48590a0fdSAndre Fischer * or more contributor license agreements. See the NOTICE file 58590a0fdSAndre Fischer * distributed with this work for additional information 68590a0fdSAndre Fischer * regarding copyright ownership. The ASF licenses this file 78590a0fdSAndre Fischer * to you under the Apache License, Version 2.0 (the 88590a0fdSAndre Fischer * "License"); you may not use this file except in compliance 98590a0fdSAndre Fischer * with the License. You may obtain a copy of the License at 108590a0fdSAndre Fischer * 118590a0fdSAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 128590a0fdSAndre Fischer * 138590a0fdSAndre Fischer * Unless required by applicable law or agreed to in writing, 148590a0fdSAndre Fischer * software distributed under the License is distributed on an 158590a0fdSAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 168590a0fdSAndre Fischer * KIND, either express or implied. See the License for the 178590a0fdSAndre Fischer * specific language governing permissions and limitations 188590a0fdSAndre Fischer * under the License. 198590a0fdSAndre Fischer * 208590a0fdSAndre Fischer *************************************************************/ 218590a0fdSAndre Fischer 228590a0fdSAndre Fischer // MARKER(update_precomp.py): autogen include statement, do not remove 23*421ed02eSdamjan #include "precompiled_webdav.hxx" 248590a0fdSAndre Fischer 25c1c10f68SAriel Constenla-Haile #include "webdavresponseparser.hxx" 268590a0fdSAndre Fischer #include <com/sun/star/xml/sax/XDocumentHandler.hpp> 278590a0fdSAndre Fischer #include <cppuhelper/implbase2.hxx> 288590a0fdSAndre Fischer #include <com/sun/star/xml/sax/XParser.hpp> 298590a0fdSAndre Fischer #include <com/sun/star/xml/sax/InputSource.hpp> 308590a0fdSAndre Fischer #include <comphelper/processfactory.hxx> 318590a0fdSAndre Fischer #include <comphelper/seqstream.hxx> 329c0c1533SAndrea Pescetti #include <com/sun/star/ucb/Lock.hpp> 339c0c1533SAndrea Pescetti #include <com/sun/star/ucb/LockDepth.hpp> 348590a0fdSAndre Fischer #include <com/sun/star/ucb/LockEntry.hpp> 358590a0fdSAndre Fischer #include <com/sun/star/ucb/LockScope.hpp> 368590a0fdSAndre Fischer #include <com/sun/star/ucb/LockType.hpp> 378590a0fdSAndre Fischer #include <map> 388590a0fdSAndre Fischer #include <hash_map> 398590a0fdSAndre Fischer 408590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 418590a0fdSAndre Fischer 428590a0fdSAndre Fischer using namespace com::sun::star; 438590a0fdSAndre Fischer 448590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 458590a0fdSAndre Fischer // WebDAVNamespace enum and StringToEnum converter 468590a0fdSAndre Fischer 478590a0fdSAndre Fischer namespace 488590a0fdSAndre Fischer { 498590a0fdSAndre Fischer enum WebDAVNamespace 508590a0fdSAndre Fischer { 518590a0fdSAndre Fischer WebDAVNamespace_unknown = 0, 528590a0fdSAndre Fischer WebDAVNamespace_DAV, 538590a0fdSAndre Fischer WebDAVNamespace_ucb_openoffice_org_dav_props, 548590a0fdSAndre Fischer 558590a0fdSAndre Fischer WebDAVNamespace_last 568590a0fdSAndre Fischer }; 578590a0fdSAndre Fischer StrToWebDAVNamespace(const rtl::OUString & rStr)588590a0fdSAndre Fischer WebDAVNamespace StrToWebDAVNamespace(const rtl::OUString& rStr) 598590a0fdSAndre Fischer { 608590a0fdSAndre Fischer static ::rtl::OUString aStrDAV(::rtl::OUString::createFromAscii("DAV:")); 618590a0fdSAndre Fischer static ::rtl::OUString aStrUcbOpenofficeOrgDAVProps(::rtl::OUString::createFromAscii("http://ucb.openoffice.org/dav/props/")); 628590a0fdSAndre Fischer 638590a0fdSAndre Fischer if(rStr.equals(aStrDAV)) 648590a0fdSAndre Fischer { 658590a0fdSAndre Fischer return WebDAVNamespace_DAV; 668590a0fdSAndre Fischer } 678590a0fdSAndre Fischer else if(rStr.equals(aStrUcbOpenofficeOrgDAVProps)) 688590a0fdSAndre Fischer { 698590a0fdSAndre Fischer return WebDAVNamespace_ucb_openoffice_org_dav_props; 708590a0fdSAndre Fischer } 718590a0fdSAndre Fischer 728590a0fdSAndre Fischer return WebDAVNamespace_unknown; 738590a0fdSAndre Fischer } 748590a0fdSAndre Fischer } // end of anonymous namespace 758590a0fdSAndre Fischer 768590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 778590a0fdSAndre Fischer // WebDAVName enum and StringToEnum converter using hash_map 788590a0fdSAndre Fischer 798590a0fdSAndre Fischer namespace 808590a0fdSAndre Fischer { 818590a0fdSAndre Fischer enum WebDAVName 828590a0fdSAndre Fischer { 838590a0fdSAndre Fischer WebDAVName_unknown = 0, 848590a0fdSAndre Fischer WebDAVName_multistatus, 858590a0fdSAndre Fischer WebDAVName_response, 868590a0fdSAndre Fischer WebDAVName_href, 878590a0fdSAndre Fischer WebDAVName_propstat, 888590a0fdSAndre Fischer WebDAVName_prop, 898590a0fdSAndre Fischer WebDAVName_resourcetype, 908590a0fdSAndre Fischer WebDAVName_collection, 918590a0fdSAndre Fischer WebDAVName_getcontenttype, 928590a0fdSAndre Fischer WebDAVName_supportedlock, 938590a0fdSAndre Fischer WebDAVName_lockentry, 948590a0fdSAndre Fischer WebDAVName_lockscope, 958590a0fdSAndre Fischer WebDAVName_exclusive, 968590a0fdSAndre Fischer WebDAVName_locktype, 978590a0fdSAndre Fischer WebDAVName_write, 988590a0fdSAndre Fischer WebDAVName_shared, 999c0c1533SAndrea Pescetti WebDAVName_lockdiscovery, 1009c0c1533SAndrea Pescetti WebDAVName_activelock, 1019c0c1533SAndrea Pescetti WebDAVName_depth, 1029c0c1533SAndrea Pescetti WebDAVName_owner, 1039c0c1533SAndrea Pescetti WebDAVName_timeout, 1049c0c1533SAndrea Pescetti WebDAVName_locktoken, 1058590a0fdSAndre Fischer WebDAVName_status, 1068590a0fdSAndre Fischer WebDAVName_getlastmodified, 1078590a0fdSAndre Fischer WebDAVName_creationdate, 1088590a0fdSAndre Fischer WebDAVName_getcontentlength, 1098590a0fdSAndre Fischer 1108590a0fdSAndre Fischer WebDAVName_last 1118590a0fdSAndre Fischer }; 1128590a0fdSAndre Fischer StrToWebDAVName(const rtl::OUString & rStr)1138590a0fdSAndre Fischer WebDAVName StrToWebDAVName(const rtl::OUString& rStr) 1148590a0fdSAndre Fischer { 1158590a0fdSAndre Fischer typedef std::hash_map< rtl::OUString, WebDAVName, rtl::OUStringHash > WebDAVNameMapper; 1168590a0fdSAndre Fischer typedef std::pair< rtl::OUString, WebDAVName > WebDAVNameValueType; 1178590a0fdSAndre Fischer static WebDAVNameMapper aWebDAVNameMapperList; 1188590a0fdSAndre Fischer 1198590a0fdSAndre Fischer if(aWebDAVNameMapperList.empty()) 1208590a0fdSAndre Fischer { 1218590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("multistatus"), WebDAVName_multistatus)); 1228590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("response"), WebDAVName_response)); 1238590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("href"), WebDAVName_href)); 1248590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("propstat"), WebDAVName_propstat)); 1258590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("prop"), WebDAVName_prop)); 1268590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("resourcetype"), WebDAVName_resourcetype)); 1278590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("collection"), WebDAVName_collection)); 1288590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("getcontenttype"), WebDAVName_getcontenttype)); 1298590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("supportedlock"), WebDAVName_supportedlock)); 1308590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("lockentry"), WebDAVName_lockentry)); 1318590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("lockscope"), WebDAVName_lockscope)); 1328590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("exclusive"), WebDAVName_exclusive)); 1338590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("locktype"), WebDAVName_locktype)); 1348590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("write"), WebDAVName_write)); 1358590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("shared"), WebDAVName_shared)); 1369c0c1533SAndrea Pescetti aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("lockdiscovery"), WebDAVName_lockdiscovery)); 1379c0c1533SAndrea Pescetti aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("activelock"), WebDAVName_activelock)); 1389c0c1533SAndrea Pescetti aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("depth"), WebDAVName_depth)); 1399c0c1533SAndrea Pescetti aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("owner"), WebDAVName_owner)); 1409c0c1533SAndrea Pescetti aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("timeout"), WebDAVName_timeout)); 1419c0c1533SAndrea Pescetti aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("locktoken"), WebDAVName_locktoken)); 1428590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("status"), WebDAVName_status)); 1438590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("getlastmodified"), WebDAVName_getlastmodified)); 1448590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("creationdate"), WebDAVName_creationdate)); 1458590a0fdSAndre Fischer aWebDAVNameMapperList.insert(WebDAVNameValueType(rtl::OUString::createFromAscii("getcontentlength"), WebDAVName_getcontentlength)); 1468590a0fdSAndre Fischer } 1478590a0fdSAndre Fischer 1488590a0fdSAndre Fischer const WebDAVNameMapper::const_iterator aResult(aWebDAVNameMapperList.find(rStr)); 1498590a0fdSAndre Fischer 1508590a0fdSAndre Fischer if(aResult == aWebDAVNameMapperList.end()) 1518590a0fdSAndre Fischer { 1528590a0fdSAndre Fischer return WebDAVName_unknown; 1538590a0fdSAndre Fischer } 1548590a0fdSAndre Fischer else 1558590a0fdSAndre Fischer { 1568590a0fdSAndre Fischer return aResult->second; 1578590a0fdSAndre Fischer } 1588590a0fdSAndre Fischer } 1598590a0fdSAndre Fischer } // end of anonymous namespace 1608590a0fdSAndre Fischer 1618590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 1628590a0fdSAndre Fischer // WebDAVContext, holding information for each start/endElement pair 1638590a0fdSAndre Fischer 1648590a0fdSAndre Fischer namespace 1658590a0fdSAndre Fischer { 1668590a0fdSAndre Fischer typedef std::map< ::rtl::OUString, ::rtl::OUString > NamespaceMap; 1678590a0fdSAndre Fischer typedef std::pair< const ::rtl::OUString, ::rtl::OUString > NamespaceValueType; 1688590a0fdSAndre Fischer 1698590a0fdSAndre Fischer class WebDAVContext 1708590a0fdSAndre Fischer { 1718590a0fdSAndre Fischer private: 1728590a0fdSAndre Fischer WebDAVContext* mpParent; 1738590a0fdSAndre Fischer NamespaceMap maNamespaceMap; 1748590a0fdSAndre Fischer ::rtl::OUString maWhiteSpace; 1758590a0fdSAndre Fischer 1768590a0fdSAndre Fischer ::rtl::OUString maNamespace; 1778590a0fdSAndre Fischer ::rtl::OUString maName; 1788590a0fdSAndre Fischer 1798590a0fdSAndre Fischer WebDAVNamespace maWebDAVNamespace; 1808590a0fdSAndre Fischer WebDAVName maWebDAVName; 1818590a0fdSAndre Fischer 1828590a0fdSAndre Fischer // local helpers 1838590a0fdSAndre Fischer void parseForNamespaceTokens(const uno::Reference< xml::sax::XAttributeList >& xAttribs); 1848590a0fdSAndre Fischer ::rtl::OUString mapNamespaceToken(const ::rtl::OUString& rToken) const; 1858590a0fdSAndre Fischer void splitName(const ::rtl::OUString& rSource); 1868590a0fdSAndre Fischer 1878590a0fdSAndre Fischer public: 1888590a0fdSAndre Fischer WebDAVContext(WebDAVContext* pParent, const ::rtl::OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs); 1898590a0fdSAndre Fischer ~WebDAVContext(); 1908590a0fdSAndre Fischer getParent() const1918590a0fdSAndre Fischer WebDAVContext* getParent() const { return mpParent; } getWhiteSpace()1928590a0fdSAndre Fischer ::rtl::OUString& getWhiteSpace() { return maWhiteSpace; } setWhiteSpace(const::rtl::OUString & rNew)1938590a0fdSAndre Fischer void setWhiteSpace(const ::rtl::OUString& rNew) { maWhiteSpace = rNew; } 1948590a0fdSAndre Fischer getNamespace() const1958590a0fdSAndre Fischer const ::rtl::OUString& getNamespace() const { return maNamespace; } getName() const1968590a0fdSAndre Fischer const ::rtl::OUString& getName() const { return maName; } getWebDAVNamespace() const197a180b29cSHerbert Dürr WebDAVNamespace getWebDAVNamespace() const { return maWebDAVNamespace; } getWebDAVName() const198a180b29cSHerbert Dürr WebDAVName getWebDAVName() const { return maWebDAVName; } 1998590a0fdSAndre Fischer }; 2008590a0fdSAndre Fischer parseForNamespaceTokens(const uno::Reference<xml::sax::XAttributeList> & xAttribs)2018590a0fdSAndre Fischer void WebDAVContext::parseForNamespaceTokens(const uno::Reference< xml::sax::XAttributeList >& xAttribs) 2028590a0fdSAndre Fischer { 2038590a0fdSAndre Fischer const sal_Int16 nAttributes(xAttribs->getLength()); 2048590a0fdSAndre Fischer static ::rtl::OUString aStrXmlns(::rtl::OUString::createFromAscii("xmlns")); 2058590a0fdSAndre Fischer 2068590a0fdSAndre Fischer for(sal_Int16 a(0); a < nAttributes; a++) 2078590a0fdSAndre Fischer { 2088590a0fdSAndre Fischer const ::rtl::OUString aName(xAttribs->getNameByIndex(a)); 2098590a0fdSAndre Fischer const sal_Int32 nLen(aName.getLength()); 2108590a0fdSAndre Fischer 2118590a0fdSAndre Fischer if(nLen) 2128590a0fdSAndre Fischer { 2138590a0fdSAndre Fischer if(aName.match(aStrXmlns, 0)) 2148590a0fdSAndre Fischer { 2158590a0fdSAndre Fischer const sal_Int32 nIndex(aName.indexOf(sal_Unicode(':'), 0)); 2168590a0fdSAndre Fischer 2178590a0fdSAndre Fischer if(-1 != nIndex && nIndex + 1 < nLen) 2188590a0fdSAndre Fischer { 2198590a0fdSAndre Fischer const ::rtl::OUString aToken(aName.copy(nIndex + 1)); 2208590a0fdSAndre Fischer 2218590a0fdSAndre Fischer maNamespaceMap.insert(NamespaceValueType(aToken, xAttribs->getValueByIndex(a))); 2228590a0fdSAndre Fischer } 2238590a0fdSAndre Fischer } 2248590a0fdSAndre Fischer } 2258590a0fdSAndre Fischer } 2268590a0fdSAndre Fischer } 2278590a0fdSAndre Fischer mapNamespaceToken(const::rtl::OUString & rToken) const2288590a0fdSAndre Fischer ::rtl::OUString WebDAVContext::mapNamespaceToken(const ::rtl::OUString& rToken) const 2298590a0fdSAndre Fischer { 2308590a0fdSAndre Fischer NamespaceMap::const_iterator iter = maNamespaceMap.find(rToken); 2318590a0fdSAndre Fischer 2328590a0fdSAndre Fischer if(maNamespaceMap.end() == iter) 2338590a0fdSAndre Fischer { 2348590a0fdSAndre Fischer if(getParent()) 2358590a0fdSAndre Fischer { 2368590a0fdSAndre Fischer return getParent()->mapNamespaceToken(rToken); 2378590a0fdSAndre Fischer } 2388590a0fdSAndre Fischer else 2398590a0fdSAndre Fischer { 2408590a0fdSAndre Fischer return rToken; 2418590a0fdSAndre Fischer } 2428590a0fdSAndre Fischer } 2438590a0fdSAndre Fischer else 2448590a0fdSAndre Fischer { 2458590a0fdSAndre Fischer return (*iter).second; 2468590a0fdSAndre Fischer } 2478590a0fdSAndre Fischer } 2488590a0fdSAndre Fischer splitName(const::rtl::OUString & rSource)2498590a0fdSAndre Fischer void WebDAVContext::splitName(const ::rtl::OUString& rSource) 2508590a0fdSAndre Fischer { 2518590a0fdSAndre Fischer const sal_Int32 nLen(rSource.getLength()); 2528590a0fdSAndre Fischer maNamespace = ::rtl::OUString(); 2538590a0fdSAndre Fischer maName = rSource; 2548590a0fdSAndre Fischer 2558590a0fdSAndre Fischer if(nLen) 2568590a0fdSAndre Fischer { 2578590a0fdSAndre Fischer const sal_Int32 nIndex(rSource.indexOf(sal_Unicode(':'), 0)); 2588590a0fdSAndre Fischer 2598590a0fdSAndre Fischer if(-1 != nIndex && nIndex > 0 && nIndex + 1 < nLen) 2608590a0fdSAndre Fischer { 2618590a0fdSAndre Fischer maNamespace = mapNamespaceToken(rSource.copy(0, nIndex)); 2628590a0fdSAndre Fischer maName = rSource.copy(nIndex + 1); 2638590a0fdSAndre Fischer } 2648590a0fdSAndre Fischer } 2658590a0fdSAndre Fischer } 2668590a0fdSAndre Fischer WebDAVContext(WebDAVContext * pParent,const::rtl::OUString & aName,const uno::Reference<xml::sax::XAttributeList> & xAttribs)2678590a0fdSAndre Fischer WebDAVContext::WebDAVContext(WebDAVContext* pParent, const ::rtl::OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs) 2688590a0fdSAndre Fischer : mpParent(pParent), 2698590a0fdSAndre Fischer maNamespaceMap(), 2708590a0fdSAndre Fischer maWhiteSpace(), 2718590a0fdSAndre Fischer maNamespace(), 2728590a0fdSAndre Fischer maName(), 2738590a0fdSAndre Fischer maWebDAVNamespace(WebDAVNamespace_unknown), 2748590a0fdSAndre Fischer maWebDAVName(WebDAVName_unknown) 2758590a0fdSAndre Fischer { 2768590a0fdSAndre Fischer const sal_Int16 nAttributes(xAttribs->getLength()); 2778590a0fdSAndre Fischer 2788590a0fdSAndre Fischer if(nAttributes) 2798590a0fdSAndre Fischer { 2808590a0fdSAndre Fischer // parse evtl. namespace entries 2818590a0fdSAndre Fischer parseForNamespaceTokens(xAttribs); 2828590a0fdSAndre Fischer } 2838590a0fdSAndre Fischer 2848590a0fdSAndre Fischer // split name to namespace and name 2858590a0fdSAndre Fischer splitName(aName); 2868590a0fdSAndre Fischer 2878590a0fdSAndre Fischer // evaluate enums for namespace and name 2888590a0fdSAndre Fischer maWebDAVNamespace = StrToWebDAVNamespace(maNamespace); 2898590a0fdSAndre Fischer maWebDAVName = StrToWebDAVName(maName); 2908590a0fdSAndre Fischer } 2918590a0fdSAndre Fischer ~WebDAVContext()2928590a0fdSAndre Fischer WebDAVContext::~WebDAVContext() 2938590a0fdSAndre Fischer { 2948590a0fdSAndre Fischer } 2958590a0fdSAndre Fischer } // end of anonymous namespace 2968590a0fdSAndre Fischer 2978590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 2988590a0fdSAndre Fischer // the Xml parser itself 2998590a0fdSAndre Fischer 3008590a0fdSAndre Fischer namespace 3018590a0fdSAndre Fischer { 3028590a0fdSAndre Fischer enum WebDAVResponseParserMode 3038590a0fdSAndre Fischer { 3048590a0fdSAndre Fischer WebDAVResponseParserMode_PropFind = 0, 3059c0c1533SAndrea Pescetti WebDAVResponseParserMode_PropName, 3069c0c1533SAndrea Pescetti WebDAVResponseParserMode_LockResponse 3078590a0fdSAndre Fischer }; 3088590a0fdSAndre Fischer 3098590a0fdSAndre Fischer class WebDAVResponseParser : public cppu::WeakImplHelper1< com::sun::star::xml::sax::XDocumentHandler > 3108590a0fdSAndre Fischer { 3118590a0fdSAndre Fischer private: 3128590a0fdSAndre Fischer std::vector< http_dav_ucp::DAVResource > maResult_PropFind; 3138590a0fdSAndre Fischer std::vector< http_dav_ucp::DAVResourceInfo > maResult_PropName; 3149c0c1533SAndrea Pescetti http_dav_ucp::DAVPropertyValue maResult_Lock; 3158590a0fdSAndre Fischer 3168590a0fdSAndre Fischer WebDAVContext* mpContext; 3178590a0fdSAndre Fischer ::rtl::OUString maHref; 3189c0c1533SAndrea Pescetti ::rtl::OUString maHrefLocks; //this is used for locks, when lockdiscoveryactive 3199c0c1533SAndrea Pescetti 3208590a0fdSAndre Fischer ::rtl::OUString maStatus; 3218590a0fdSAndre Fischer std::vector< http_dav_ucp::DAVPropertyValue > maResponseProperties; 3228590a0fdSAndre Fischer std::vector< http_dav_ucp::DAVPropertyValue > maPropStatProperties; 3238590a0fdSAndre Fischer std::vector< ::rtl::OUString > maResponseNames; 3248590a0fdSAndre Fischer std::vector< ::rtl::OUString > maPropStatNames; 3259c0c1533SAndrea Pescetti uno::Sequence< ::rtl::OUString > maLockTokens; 3268590a0fdSAndre Fischer uno::Sequence< ucb::LockEntry > maLockEntries; 3279c0c1533SAndrea Pescetti uno::Sequence< ucb::Lock > maLocks; //the returned locks following a lockdiscovery request 3288590a0fdSAndre Fischer ucb::LockScope maLockScope; 3298590a0fdSAndre Fischer ucb::LockType maLockType; 3309c0c1533SAndrea Pescetti ucb::LockDepth maLockDepth; 3319c0c1533SAndrea Pescetti ::rtl::OUString maLockOwner; 3329c0c1533SAndrea Pescetti sal_Int64 maLockTimeout; 3339c0c1533SAndrea Pescetti ::rtl::OUString maLockToken; 3349c0c1533SAndrea Pescetti 3358590a0fdSAndre Fischer WebDAVResponseParserMode meWebDAVResponseParserMode; 3368590a0fdSAndre Fischer 3378590a0fdSAndre Fischer // bitfield 3388590a0fdSAndre Fischer bool mbResourceTypeCollection : 1; 3398590a0fdSAndre Fischer bool mbLockScopeSet : 1; 3408590a0fdSAndre Fischer bool mbLockTypeSet : 1; 3419c0c1533SAndrea Pescetti bool mbLockTokenSet : 1; 3429c0c1533SAndrea Pescetti //TODO: add other flag to manage reading od token, depth, timeout, owner 3439c0c1533SAndrea Pescetti bool mbLockDiscoveryActive : 1; 3448590a0fdSAndre Fischer 3458590a0fdSAndre Fischer // local helpers whitespaceIsAvailable() const3468590a0fdSAndre Fischer bool whitespaceIsAvailable() const 3478590a0fdSAndre Fischer { 3488590a0fdSAndre Fischer return mpContext && mpContext->getWhiteSpace().getLength(); 3498590a0fdSAndre Fischer } hasParent(WebDAVName aWebDAVName) const3508590a0fdSAndre Fischer bool hasParent(WebDAVName aWebDAVName) const 3518590a0fdSAndre Fischer { 3528590a0fdSAndre Fischer return mpContext && mpContext->getParent() && aWebDAVName == mpContext->getParent()->getWebDAVName(); 3538590a0fdSAndre Fischer } propertyIsReady() const3548590a0fdSAndre Fischer bool propertyIsReady() const 3558590a0fdSAndre Fischer { 3568590a0fdSAndre Fischer return hasParent(WebDAVName_prop) && whitespaceIsAvailable(); 3578590a0fdSAndre Fischer } isCollectingProperties() const3588590a0fdSAndre Fischer bool isCollectingProperties() const 3598590a0fdSAndre Fischer { 3608590a0fdSAndre Fischer return WebDAVResponseParserMode_PropFind == meWebDAVResponseParserMode; 3618590a0fdSAndre Fischer } isCollectingPropNames() const3628590a0fdSAndre Fischer bool isCollectingPropNames() const 3638590a0fdSAndre Fischer { 3648590a0fdSAndre Fischer return WebDAVResponseParserMode_PropName == meWebDAVResponseParserMode; 3658590a0fdSAndre Fischer } isWaitingLockResponse() const3669c0c1533SAndrea Pescetti bool isWaitingLockResponse() const 3679c0c1533SAndrea Pescetti { 3689c0c1533SAndrea Pescetti return WebDAVResponseParserMode_LockResponse == meWebDAVResponseParserMode; 3699c0c1533SAndrea Pescetti } collectThisPropertyAsName() const3708590a0fdSAndre Fischer bool collectThisPropertyAsName() const 3718590a0fdSAndre Fischer { 3728590a0fdSAndre Fischer return isCollectingPropNames() && hasParent(WebDAVName_prop); 3738590a0fdSAndre Fischer } pop_context()3748590a0fdSAndre Fischer void pop_context() 3758590a0fdSAndre Fischer { 3768590a0fdSAndre Fischer if(mpContext) 3778590a0fdSAndre Fischer { 3788590a0fdSAndre Fischer WebDAVContext* pTemp = mpContext; 3798590a0fdSAndre Fischer mpContext = mpContext->getParent(); 3808590a0fdSAndre Fischer delete pTemp; 3818590a0fdSAndre Fischer } 3828590a0fdSAndre Fischer else 3838590a0fdSAndre Fischer { 3848590a0fdSAndre Fischer OSL_ENSURE(false, "Parser context pop without context (!)"); 3858590a0fdSAndre Fischer } 3868590a0fdSAndre Fischer } 3878590a0fdSAndre Fischer 3888590a0fdSAndre Fischer public: 3898590a0fdSAndre Fischer WebDAVResponseParser(WebDAVResponseParserMode eWebDAVResponseParserMode); 3908590a0fdSAndre Fischer ~WebDAVResponseParser(); 3918590a0fdSAndre Fischer 3928590a0fdSAndre Fischer // Methods XDocumentHandler 3938590a0fdSAndre Fischer virtual void SAL_CALL startDocument( ) throw (xml::sax::SAXException, uno::RuntimeException); 3948590a0fdSAndre Fischer virtual void SAL_CALL endDocument( ) throw (xml::sax::SAXException, uno::RuntimeException); 3959c0c1533SAndrea Pescetti virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs ) 3969c0c1533SAndrea Pescetti throw (xml::sax::SAXException, uno::RuntimeException); 3978590a0fdSAndre Fischer virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw (xml::sax::SAXException, uno::RuntimeException); 3988590a0fdSAndre Fischer virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (xml::sax::SAXException, uno::RuntimeException); 3998590a0fdSAndre Fischer virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (xml::sax::SAXException, uno::RuntimeException); 4008590a0fdSAndre Fischer virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (xml::sax::SAXException, uno::RuntimeException); 4018590a0fdSAndre Fischer virtual void SAL_CALL setDocumentLocator( const uno::Reference< xml::sax::XLocator >& xLocator ) throw (xml::sax::SAXException, uno::RuntimeException); 4028590a0fdSAndre Fischer getResult_PropFind() const4038590a0fdSAndre Fischer const std::vector< http_dav_ucp::DAVResource >& getResult_PropFind() const { return maResult_PropFind; } getResult_PropName() const4048590a0fdSAndre Fischer const std::vector< http_dav_ucp::DAVResourceInfo >& getResult_PropName() const { return maResult_PropName; } getResult_Lock() const4059c0c1533SAndrea Pescetti const http_dav_ucp::DAVPropertyValue& getResult_Lock() const { return maResult_Lock; } 4068590a0fdSAndre Fischer }; 4078590a0fdSAndre Fischer WebDAVResponseParser(WebDAVResponseParserMode eWebDAVResponseParserMode)4088590a0fdSAndre Fischer WebDAVResponseParser::WebDAVResponseParser(WebDAVResponseParserMode eWebDAVResponseParserMode) 4098590a0fdSAndre Fischer : maResult_PropFind(), 4108590a0fdSAndre Fischer maResult_PropName(), 4119c0c1533SAndrea Pescetti maResult_Lock(), 4128590a0fdSAndre Fischer mpContext(0), 4138590a0fdSAndre Fischer maHref(), 4149c0c1533SAndrea Pescetti maHrefLocks(), 4158590a0fdSAndre Fischer maStatus(), 4168590a0fdSAndre Fischer maResponseProperties(), 4178590a0fdSAndre Fischer maPropStatProperties(), 4188590a0fdSAndre Fischer maResponseNames(), 4198590a0fdSAndre Fischer maPropStatNames(), 4209c0c1533SAndrea Pescetti maLockTokens(), 4218590a0fdSAndre Fischer maLockEntries(), 4229c0c1533SAndrea Pescetti maLocks(), 4238590a0fdSAndre Fischer maLockScope(ucb::LockScope_EXCLUSIVE), 4248590a0fdSAndre Fischer maLockType(ucb::LockType_WRITE), 4259c0c1533SAndrea Pescetti maLockDepth(ucb::LockDepth_ZERO), 4269c0c1533SAndrea Pescetti maLockOwner(), 4279c0c1533SAndrea Pescetti maLockTimeout(0), 4288590a0fdSAndre Fischer meWebDAVResponseParserMode(eWebDAVResponseParserMode), 4298590a0fdSAndre Fischer mbResourceTypeCollection(false), 4308590a0fdSAndre Fischer mbLockScopeSet(false), 4319c0c1533SAndrea Pescetti mbLockTypeSet(false), 4329c0c1533SAndrea Pescetti mbLockDiscoveryActive(false) 4338590a0fdSAndre Fischer { 4348590a0fdSAndre Fischer } 4358590a0fdSAndre Fischer ~WebDAVResponseParser()4368590a0fdSAndre Fischer WebDAVResponseParser::~WebDAVResponseParser() 4378590a0fdSAndre Fischer { 4388590a0fdSAndre Fischer OSL_ENSURE(!mpContext, "Parser destructed with existing content (!)"); 4398590a0fdSAndre Fischer while(mpContext) 4408590a0fdSAndre Fischer { 4418590a0fdSAndre Fischer pop_context(); 4428590a0fdSAndre Fischer } 4438590a0fdSAndre Fischer } 4448590a0fdSAndre Fischer startDocument()4458590a0fdSAndre Fischer void SAL_CALL WebDAVResponseParser::startDocument( ) throw (xml::sax::SAXException, uno::RuntimeException) 4468590a0fdSAndre Fischer { 4478590a0fdSAndre Fischer OSL_ENSURE(!mpContext, "Parser start with existing content (!)"); 4488590a0fdSAndre Fischer } 4498590a0fdSAndre Fischer endDocument()4508590a0fdSAndre Fischer void SAL_CALL WebDAVResponseParser::endDocument( ) throw (xml::sax::SAXException, uno::RuntimeException) 4518590a0fdSAndre Fischer { 4528590a0fdSAndre Fischer OSL_ENSURE(!mpContext, "Parser end with existing content (!)"); 4538590a0fdSAndre Fischer } 4548590a0fdSAndre Fischer startElement(const::rtl::OUString & aName,const uno::Reference<xml::sax::XAttributeList> & xAttribs)4559c0c1533SAndrea Pescetti void SAL_CALL WebDAVResponseParser::startElement( const ::rtl::OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs ) 4569c0c1533SAndrea Pescetti throw (xml::sax::SAXException, uno::RuntimeException) 4578590a0fdSAndre Fischer { 4588590a0fdSAndre Fischer const sal_Int32 nLen(aName.getLength()); 4598590a0fdSAndre Fischer 4608590a0fdSAndre Fischer if(nLen) 4618590a0fdSAndre Fischer { 4628590a0fdSAndre Fischer // create new context (push) 4638590a0fdSAndre Fischer mpContext = new WebDAVContext(mpContext, aName, xAttribs); 4648590a0fdSAndre Fischer 4658590a0fdSAndre Fischer if(collectThisPropertyAsName()) 4668590a0fdSAndre Fischer { 4678590a0fdSAndre Fischer // When collecting property names and parent is prop there is no need 4688590a0fdSAndre Fischer // to handle the content of this property deeper (evtl. preparations) 4698590a0fdSAndre Fischer } 4708590a0fdSAndre Fischer else 4718590a0fdSAndre Fischer { 4728590a0fdSAndre Fischer switch(mpContext->getWebDAVNamespace()) 4738590a0fdSAndre Fischer { 4748590a0fdSAndre Fischer default: // WebDAVNamespace_unknown, WebDAVNamespace_last or unhandled 4758590a0fdSAndre Fischer { 4768590a0fdSAndre Fischer break; 4778590a0fdSAndre Fischer } 4788590a0fdSAndre Fischer case WebDAVNamespace_DAV: 4798590a0fdSAndre Fischer { 4808590a0fdSAndre Fischer switch(mpContext->getWebDAVName()) 4818590a0fdSAndre Fischer { 4828590a0fdSAndre Fischer default: // WebDAVName_unknown, WebDAVName_last or unhandled 4838590a0fdSAndre Fischer { 4848590a0fdSAndre Fischer break; 4858590a0fdSAndre Fischer } 4868590a0fdSAndre Fischer case WebDAVName_propstat: 4878590a0fdSAndre Fischer { 4888590a0fdSAndre Fischer // propstat start 4898590a0fdSAndre Fischer if(isCollectingProperties()) 4908590a0fdSAndre Fischer { 4918590a0fdSAndre Fischer // reset maPropStatProperties 4928590a0fdSAndre Fischer maPropStatProperties.clear(); 4938590a0fdSAndre Fischer } 4948590a0fdSAndre Fischer else 4958590a0fdSAndre Fischer { 4968590a0fdSAndre Fischer // when collecting properties reset maPropStatNames 4978590a0fdSAndre Fischer maPropStatNames.clear(); 4988590a0fdSAndre Fischer } 4998590a0fdSAndre Fischer break; 5008590a0fdSAndre Fischer } 5018590a0fdSAndre Fischer case WebDAVName_response: 5028590a0fdSAndre Fischer { 5038590a0fdSAndre Fischer // response start, reset Href and status and maResponseProperties 5048590a0fdSAndre Fischer maHref = maStatus = ::rtl::OUString(); 5058590a0fdSAndre Fischer 5068590a0fdSAndre Fischer if(isCollectingProperties()) 5078590a0fdSAndre Fischer { 5088590a0fdSAndre Fischer // reset maResponseProperties 5098590a0fdSAndre Fischer maResponseProperties.clear(); 5108590a0fdSAndre Fischer } 5118590a0fdSAndre Fischer else 5128590a0fdSAndre Fischer { 5138590a0fdSAndre Fischer // reset maResponseNames when collecting properties 5148590a0fdSAndre Fischer maResponseNames.clear(); 5158590a0fdSAndre Fischer } 5168590a0fdSAndre Fischer break; 5178590a0fdSAndre Fischer } 5188590a0fdSAndre Fischer case WebDAVName_resourcetype: 5198590a0fdSAndre Fischer { 5208590a0fdSAndre Fischer // resourcetype start, reset collection 5218590a0fdSAndre Fischer mbResourceTypeCollection = false; 5228590a0fdSAndre Fischer break; 5238590a0fdSAndre Fischer } 5248590a0fdSAndre Fischer case WebDAVName_supportedlock: 5258590a0fdSAndre Fischer { 5268590a0fdSAndre Fischer // supportedlock start, reset maLockEntries 5278590a0fdSAndre Fischer maLockEntries.realloc(0); 5288590a0fdSAndre Fischer break; 5298590a0fdSAndre Fischer } 5308590a0fdSAndre Fischer case WebDAVName_lockentry: 5318590a0fdSAndre Fischer { 5328590a0fdSAndre Fischer // lockentry start, reset maLockEntries 5338590a0fdSAndre Fischer mbLockScopeSet = false; 5348590a0fdSAndre Fischer mbLockTypeSet = false; 5358590a0fdSAndre Fischer break; 5368590a0fdSAndre Fischer } 5379c0c1533SAndrea Pescetti case WebDAVName_lockdiscovery: 5389c0c1533SAndrea Pescetti { 5399c0c1533SAndrea Pescetti // lockentry start, reset maLocks 5409c0c1533SAndrea Pescetti maLocks.realloc(0); 5419c0c1533SAndrea Pescetti mbLockDiscoveryActive = true; 5429c0c1533SAndrea Pescetti break; 5439c0c1533SAndrea Pescetti } 5449c0c1533SAndrea Pescetti case WebDAVName_activelock: 5459c0c1533SAndrea Pescetti { 5469c0c1533SAndrea Pescetti // activelockstart, reset vars 5479c0c1533SAndrea Pescetti mbLockScopeSet = false; 5489c0c1533SAndrea Pescetti mbLockTypeSet = false; 5499c0c1533SAndrea Pescetti mbLockTokenSet = false; 5509c0c1533SAndrea Pescetti maLockTokens.realloc(0); 5519c0c1533SAndrea Pescetti maHrefLocks = ::rtl::OUString(); 5529c0c1533SAndrea Pescetti break; 5539c0c1533SAndrea Pescetti } 5549c0c1533SAndrea Pescetti case WebDAVName_locktoken: 5559c0c1533SAndrea Pescetti { 5569c0c1533SAndrea Pescetti mbLockTokenSet = true; 5579c0c1533SAndrea Pescetti break; 5589c0c1533SAndrea Pescetti } 5598590a0fdSAndre Fischer } 5608590a0fdSAndre Fischer break; 5618590a0fdSAndre Fischer } 5628590a0fdSAndre Fischer case WebDAVNamespace_ucb_openoffice_org_dav_props: 5638590a0fdSAndre Fischer { 5648590a0fdSAndre Fischer break; 5658590a0fdSAndre Fischer } 5668590a0fdSAndre Fischer } 5678590a0fdSAndre Fischer } 5688590a0fdSAndre Fischer } 5698590a0fdSAndre Fischer } 5708590a0fdSAndre Fischer endElement(const::rtl::OUString & aName)5718590a0fdSAndre Fischer void SAL_CALL WebDAVResponseParser::endElement( const ::rtl::OUString& aName ) throw (xml::sax::SAXException, uno::RuntimeException) 5728590a0fdSAndre Fischer { 5738590a0fdSAndre Fischer const sal_Int32 nLen(aName.getLength()); 5748590a0fdSAndre Fischer OSL_ENSURE(mpContext, "Parser EndElement without content (!)"); 5758590a0fdSAndre Fischer 5768590a0fdSAndre Fischer if(mpContext && nLen) 5778590a0fdSAndre Fischer { 5788590a0fdSAndre Fischer if(collectThisPropertyAsName()) 5798590a0fdSAndre Fischer { 5808590a0fdSAndre Fischer // When collecting property names and parent is prop, just append the prop name 5818590a0fdSAndre Fischer // to the collection, no need to parse deeper 5828590a0fdSAndre Fischer maPropStatNames.push_back(mpContext->getNamespace() + mpContext->getName()); 5838590a0fdSAndre Fischer } 5848590a0fdSAndre Fischer else 5858590a0fdSAndre Fischer { 5868590a0fdSAndre Fischer switch(mpContext->getWebDAVNamespace()) 5878590a0fdSAndre Fischer { 5888590a0fdSAndre Fischer default: // WebDAVNamespace_unknown, WebDAVNamespace_last or unhandled 5898590a0fdSAndre Fischer { 5908590a0fdSAndre Fischer break; 5918590a0fdSAndre Fischer } 5928590a0fdSAndre Fischer case WebDAVNamespace_DAV: 5938590a0fdSAndre Fischer { 5948590a0fdSAndre Fischer switch(mpContext->getWebDAVName()) 5958590a0fdSAndre Fischer { 5968590a0fdSAndre Fischer default: // WebDAVName_unknown, WebDAVName_last or unhandled 5978590a0fdSAndre Fischer { 5988590a0fdSAndre Fischer break; 5998590a0fdSAndre Fischer } 6008590a0fdSAndre Fischer case WebDAVName_href: 6018590a0fdSAndre Fischer { 6028590a0fdSAndre Fischer // href end, save it if we have whitespace 6038590a0fdSAndre Fischer if(whitespaceIsAvailable()) 6048590a0fdSAndre Fischer { 6059c0c1533SAndrea Pescetti if(mbLockDiscoveryActive) 6069c0c1533SAndrea Pescetti { 6079c0c1533SAndrea Pescetti maHrefLocks = mpContext->getWhiteSpace(); 6089c0c1533SAndrea Pescetti } 6099c0c1533SAndrea Pescetti else 6109c0c1533SAndrea Pescetti { 6118590a0fdSAndre Fischer maHref = mpContext->getWhiteSpace(); 6128590a0fdSAndre Fischer } 6139c0c1533SAndrea Pescetti } 6148590a0fdSAndre Fischer break; 6158590a0fdSAndre Fischer } 6168590a0fdSAndre Fischer case WebDAVName_status: 6178590a0fdSAndre Fischer { 6188590a0fdSAndre Fischer // status end, save it if we have whitespace 6198590a0fdSAndre Fischer if(whitespaceIsAvailable()) 6208590a0fdSAndre Fischer { 6218590a0fdSAndre Fischer maStatus = mpContext->getWhiteSpace(); 6228590a0fdSAndre Fischer } 6238590a0fdSAndre Fischer break; 6248590a0fdSAndre Fischer } 6258590a0fdSAndre Fischer case WebDAVName_getlastmodified: 6268590a0fdSAndre Fischer { 6278590a0fdSAndre Fischer // getlastmodified end, safe if content is correct 6288590a0fdSAndre Fischer if(propertyIsReady()) 6298590a0fdSAndre Fischer { 6308590a0fdSAndre Fischer static rtl::OUString aStr(rtl::OUString::createFromAscii("DAV:getlastmodified")); 6318590a0fdSAndre Fischer http_dav_ucp::DAVPropertyValue aDAVPropertyValue; 6328590a0fdSAndre Fischer 6338590a0fdSAndre Fischer aDAVPropertyValue.Name = aStr; 6348590a0fdSAndre Fischer aDAVPropertyValue.Value <<= mpContext->getWhiteSpace(); 6358590a0fdSAndre Fischer maPropStatProperties.push_back(aDAVPropertyValue); 6368590a0fdSAndre Fischer } 6378590a0fdSAndre Fischer break; 6388590a0fdSAndre Fischer } 6398590a0fdSAndre Fischer case WebDAVName_creationdate: 6408590a0fdSAndre Fischer { 6418590a0fdSAndre Fischer // creationdate end, safe if content is correct 6428590a0fdSAndre Fischer if(propertyIsReady()) 6438590a0fdSAndre Fischer { 6448590a0fdSAndre Fischer static rtl::OUString aStr(rtl::OUString::createFromAscii("DAV:creationdate")); 6458590a0fdSAndre Fischer http_dav_ucp::DAVPropertyValue aDAVPropertyValue; 6468590a0fdSAndre Fischer 6478590a0fdSAndre Fischer aDAVPropertyValue.Name = aStr; 6488590a0fdSAndre Fischer aDAVPropertyValue.Value <<= mpContext->getWhiteSpace(); 6498590a0fdSAndre Fischer maPropStatProperties.push_back(aDAVPropertyValue); 6508590a0fdSAndre Fischer } 6518590a0fdSAndre Fischer break; 6528590a0fdSAndre Fischer } 6538590a0fdSAndre Fischer case WebDAVName_collection: 6548590a0fdSAndre Fischer { 6558590a0fdSAndre Fischer // collection end, check and set 6568590a0fdSAndre Fischer if(hasParent(WebDAVName_resourcetype)) 6578590a0fdSAndre Fischer { 6588590a0fdSAndre Fischer mbResourceTypeCollection = true; 6598590a0fdSAndre Fischer } 6608590a0fdSAndre Fischer break; 6618590a0fdSAndre Fischer } 6628590a0fdSAndre Fischer case WebDAVName_resourcetype: 6638590a0fdSAndre Fischer { 6648590a0fdSAndre Fischer // resourcetype end, check for collection 6658590a0fdSAndre Fischer if(hasParent(WebDAVName_prop)) 6668590a0fdSAndre Fischer { 6678590a0fdSAndre Fischer static rtl::OUString aStrA(rtl::OUString::createFromAscii("DAV:resourcetype")); 6688590a0fdSAndre Fischer static rtl::OUString aStrB(rtl::OUString::createFromAscii("collection")); 6698590a0fdSAndre Fischer http_dav_ucp::DAVPropertyValue aDAVPropertyValue; 6708590a0fdSAndre Fischer 6718590a0fdSAndre Fischer aDAVPropertyValue.Name = aStrA; 6728590a0fdSAndre Fischer aDAVPropertyValue.Value <<= (mbResourceTypeCollection ? aStrB : rtl::OUString()); 6738590a0fdSAndre Fischer maPropStatProperties.push_back(aDAVPropertyValue); 6748590a0fdSAndre Fischer } 6758590a0fdSAndre Fischer break; 6768590a0fdSAndre Fischer } 6778590a0fdSAndre Fischer case WebDAVName_getcontentlength: 6788590a0fdSAndre Fischer { 6798590a0fdSAndre Fischer // getcontentlength end, safe if content is correct 6808590a0fdSAndre Fischer if(propertyIsReady()) 6818590a0fdSAndre Fischer { 6828590a0fdSAndre Fischer static rtl::OUString aStr(rtl::OUString::createFromAscii("DAV:getcontentlength")); 6838590a0fdSAndre Fischer http_dav_ucp::DAVPropertyValue aDAVPropertyValue; 6848590a0fdSAndre Fischer 6858590a0fdSAndre Fischer aDAVPropertyValue.Name = aStr; 6868590a0fdSAndre Fischer aDAVPropertyValue.Value <<= mpContext->getWhiteSpace(); 6878590a0fdSAndre Fischer maPropStatProperties.push_back(aDAVPropertyValue); 6888590a0fdSAndre Fischer } 6898590a0fdSAndre Fischer break; 6908590a0fdSAndre Fischer } 6918590a0fdSAndre Fischer case WebDAVName_getcontenttype: 6928590a0fdSAndre Fischer { 6938590a0fdSAndre Fischer // getcontenttype end, safe if content is correct 6948590a0fdSAndre Fischer if(propertyIsReady()) 6958590a0fdSAndre Fischer { 6968590a0fdSAndre Fischer static rtl::OUString aStr(rtl::OUString::createFromAscii("DAV:getcontenttype")); 6978590a0fdSAndre Fischer http_dav_ucp::DAVPropertyValue aDAVPropertyValue; 6988590a0fdSAndre Fischer 6998590a0fdSAndre Fischer aDAVPropertyValue.Name = aStr; 7008590a0fdSAndre Fischer aDAVPropertyValue.Value <<= mpContext->getWhiteSpace(); 7018590a0fdSAndre Fischer maPropStatProperties.push_back(aDAVPropertyValue); 7028590a0fdSAndre Fischer } 7038590a0fdSAndre Fischer break; 7048590a0fdSAndre Fischer } 7058590a0fdSAndre Fischer case WebDAVName_supportedlock: 7068590a0fdSAndre Fischer { 7078590a0fdSAndre Fischer // supportedlock end 7088590a0fdSAndre Fischer if(hasParent(WebDAVName_prop) && maLockEntries.hasElements()) 7098590a0fdSAndre Fischer { 7108590a0fdSAndre Fischer static rtl::OUString aStr(rtl::OUString::createFromAscii("DAV:supportedlock")); 7118590a0fdSAndre Fischer http_dav_ucp::DAVPropertyValue aDAVPropertyValue; 7128590a0fdSAndre Fischer 7138590a0fdSAndre Fischer aDAVPropertyValue.Name = aStr; 7148590a0fdSAndre Fischer aDAVPropertyValue.Value <<= maLockEntries; 7158590a0fdSAndre Fischer maPropStatProperties.push_back(aDAVPropertyValue); 7168590a0fdSAndre Fischer } 7178590a0fdSAndre Fischer break; 7188590a0fdSAndre Fischer } 7198590a0fdSAndre Fischer case WebDAVName_lockentry: 7208590a0fdSAndre Fischer { 7218590a0fdSAndre Fischer // lockentry end 7228590a0fdSAndre Fischer if(hasParent(WebDAVName_supportedlock) && (mbLockScopeSet && mbLockTypeSet)) 7238590a0fdSAndre Fischer { 7248590a0fdSAndre Fischer const sal_Int32 nLength(maLockEntries.getLength()); 7258590a0fdSAndre Fischer ucb::LockEntry aEntry; 7268590a0fdSAndre Fischer 7278590a0fdSAndre Fischer aEntry.Scope = maLockScope; 7288590a0fdSAndre Fischer aEntry.Type = maLockType; 7298590a0fdSAndre Fischer maLockEntries.realloc(nLength + 1); 7308590a0fdSAndre Fischer maLockEntries[nLength] = aEntry; 7318590a0fdSAndre Fischer } 7328590a0fdSAndre Fischer break; 7338590a0fdSAndre Fischer } 7348590a0fdSAndre Fischer case WebDAVName_exclusive: 7358590a0fdSAndre Fischer { 7368590a0fdSAndre Fischer // exclusive lockscope end 7379c0c1533SAndrea Pescetti if(hasParent(WebDAVName_lockscope) || hasParent(WebDAVName_activelock)) 7388590a0fdSAndre Fischer { 7398590a0fdSAndre Fischer maLockScope = ucb::LockScope_EXCLUSIVE; 7408590a0fdSAndre Fischer mbLockScopeSet = true; 7418590a0fdSAndre Fischer } 7428590a0fdSAndre Fischer break; 7438590a0fdSAndre Fischer } 7448590a0fdSAndre Fischer case WebDAVName_shared: 7458590a0fdSAndre Fischer { 7468590a0fdSAndre Fischer // shared lockscope end 7479c0c1533SAndrea Pescetti if(hasParent(WebDAVName_lockscope) || hasParent(WebDAVName_activelock)) 7488590a0fdSAndre Fischer { 7498590a0fdSAndre Fischer maLockScope = ucb::LockScope_SHARED; 7508590a0fdSAndre Fischer mbLockScopeSet = true; 7518590a0fdSAndre Fischer } 7528590a0fdSAndre Fischer break; 7538590a0fdSAndre Fischer } 7548590a0fdSAndre Fischer case WebDAVName_write: 7558590a0fdSAndre Fischer { 7568590a0fdSAndre Fischer // write locktype end 7579c0c1533SAndrea Pescetti if(hasParent(WebDAVName_locktype) || hasParent(WebDAVName_activelock)) 7588590a0fdSAndre Fischer { 7598590a0fdSAndre Fischer maLockType = ucb::LockType_WRITE; 7608590a0fdSAndre Fischer mbLockTypeSet = true; 7618590a0fdSAndre Fischer } 7628590a0fdSAndre Fischer break; 7638590a0fdSAndre Fischer } 7649c0c1533SAndrea Pescetti case WebDAVName_lockdiscovery: 7659c0c1533SAndrea Pescetti { 7669c0c1533SAndrea Pescetti // lockdiscovery end 7679c0c1533SAndrea Pescetti if(hasParent(WebDAVName_prop)) 7689c0c1533SAndrea Pescetti { 7699c0c1533SAndrea Pescetti static ::rtl::OUString aStr(rtl::OUString::createFromAscii("DAV:lockdiscovery")); 7709c0c1533SAndrea Pescetti if(isWaitingLockResponse()) 7719c0c1533SAndrea Pescetti { 7729c0c1533SAndrea Pescetti maResult_Lock.Name = aStr; 7739c0c1533SAndrea Pescetti maResult_Lock.Value <<= maLocks; 7749c0c1533SAndrea Pescetti } 7759c0c1533SAndrea Pescetti else 7769c0c1533SAndrea Pescetti { 7779c0c1533SAndrea Pescetti ::http_dav_ucp::DAVPropertyValue aDAVPropertyValue; 7789c0c1533SAndrea Pescetti 7799c0c1533SAndrea Pescetti aDAVPropertyValue.Name = aStr; 7809c0c1533SAndrea Pescetti aDAVPropertyValue.Value <<= maLocks; 7819c0c1533SAndrea Pescetti maPropStatProperties.push_back(aDAVPropertyValue); 7829c0c1533SAndrea Pescetti } 7839c0c1533SAndrea Pescetti } 7849c0c1533SAndrea Pescetti mbLockDiscoveryActive = false; 7859c0c1533SAndrea Pescetti break; 7869c0c1533SAndrea Pescetti } 7879c0c1533SAndrea Pescetti case WebDAVName_activelock: 7889c0c1533SAndrea Pescetti { 7899c0c1533SAndrea Pescetti if(hasParent(WebDAVName_lockdiscovery) && 7909c0c1533SAndrea Pescetti mbLockScopeSet && mbLockTypeSet && mbLockTokenSet) 7919c0c1533SAndrea Pescetti { 7929c0c1533SAndrea Pescetti const sal_Int32 nLength(maLocks.getLength()); 7939c0c1533SAndrea Pescetti ucb::Lock aLock; 7949c0c1533SAndrea Pescetti 7959c0c1533SAndrea Pescetti aLock.Scope = maLockScope; 7969c0c1533SAndrea Pescetti aLock.Type = maLockType; 7979c0c1533SAndrea Pescetti //add tokens, depth, timeout, owner 7989c0c1533SAndrea Pescetti aLock.LockTokens = maLockTokens; 7999c0c1533SAndrea Pescetti aLock.Depth = maLockDepth; 8009c0c1533SAndrea Pescetti aLock.Owner <<= maLockOwner; 8019c0c1533SAndrea Pescetti aLock.Timeout = maLockTimeout; 8029c0c1533SAndrea Pescetti maLocks.realloc(nLength + 1); 8039c0c1533SAndrea Pescetti maLocks[nLength] = aLock; 8049c0c1533SAndrea Pescetti } 8059c0c1533SAndrea Pescetti break; 8069c0c1533SAndrea Pescetti } 8079c0c1533SAndrea Pescetti case WebDAVName_locktoken: 8089c0c1533SAndrea Pescetti { 8099c0c1533SAndrea Pescetti if(hasParent(WebDAVName_activelock)) 8109c0c1533SAndrea Pescetti { 8119c0c1533SAndrea Pescetti //add a token to the list of tokens 8129c0c1533SAndrea Pescetti const sal_Int32 nLength(maLockTokens.getLength()); 8139c0c1533SAndrea Pescetti maLockTokens.realloc(nLength + 1); 8149c0c1533SAndrea Pescetti maLockTokens[nLength] = maHrefLocks; 8159c0c1533SAndrea Pescetti mbLockTokenSet = true; 8169c0c1533SAndrea Pescetti } 8179c0c1533SAndrea Pescetti break; 8189c0c1533SAndrea Pescetti } 8199c0c1533SAndrea Pescetti case WebDAVName_timeout: 8209c0c1533SAndrea Pescetti { 8219c0c1533SAndrea Pescetti if(hasParent(WebDAVName_activelock)) 8229c0c1533SAndrea Pescetti { 8239c0c1533SAndrea Pescetti ::rtl::OUString aStr( mpContext->getWhiteSpace().toAsciiLowerCase()); 8249c0c1533SAndrea Pescetti static ::rtl::OUString aInfinite( ::rtl::OUString::createFromAscii( "infinite" ) ); 8259c0c1533SAndrea Pescetti static ::rtl::OUString aSecond( ::rtl::OUString::createFromAscii( "second-" ) ); 8269c0c1533SAndrea Pescetti //look for infinity 8279c0c1533SAndrea Pescetti sal_Int32 secondIndex; 8289c0c1533SAndrea Pescetti if(aStr.indexOf(aInfinite) != -1) 8299c0c1533SAndrea Pescetti { 8309c0c1533SAndrea Pescetti maLockTimeout = -1; 8319c0c1533SAndrea Pescetti } 8329c0c1533SAndrea Pescetti else if((secondIndex = aStr.indexOf(aSecond)) != -1) 8339c0c1533SAndrea Pescetti { 8349c0c1533SAndrea Pescetti secondIndex += aSecond.getLength(); 8359c0c1533SAndrea Pescetti maLockTimeout = aStr.copy(secondIndex).toInt64(); 8369c0c1533SAndrea Pescetti } 8379c0c1533SAndrea Pescetti } 8389c0c1533SAndrea Pescetti break; 8399c0c1533SAndrea Pescetti } 8409c0c1533SAndrea Pescetti case WebDAVName_owner: 8419c0c1533SAndrea Pescetti { 8429c0c1533SAndrea Pescetti if(whitespaceIsAvailable()) 8439c0c1533SAndrea Pescetti { 8449c0c1533SAndrea Pescetti if(hasParent(WebDAVName_activelock)) 8459c0c1533SAndrea Pescetti { 8469c0c1533SAndrea Pescetti maLockOwner = mpContext->getWhiteSpace(); 8479c0c1533SAndrea Pescetti } 8489c0c1533SAndrea Pescetti } 8499c0c1533SAndrea Pescetti break; 8509c0c1533SAndrea Pescetti } 8519c0c1533SAndrea Pescetti case WebDAVName_depth: 8529c0c1533SAndrea Pescetti { 8539c0c1533SAndrea Pescetti if(hasParent(WebDAVName_activelock)) 8549c0c1533SAndrea Pescetti { 8559c0c1533SAndrea Pescetti //set depth, one of three values 8569c0c1533SAndrea Pescetti ::rtl::OUString aStr( mpContext->getWhiteSpace() ); 8579c0c1533SAndrea Pescetti //default to zero, if not found 8589c0c1533SAndrea Pescetti maLockDepth = ucb::LockDepth_ZERO; 8599c0c1533SAndrea Pescetti if(aStr.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("0"))) 8609c0c1533SAndrea Pescetti maLockDepth = ucb::LockDepth_ZERO; 8619c0c1533SAndrea Pescetti else if(aStr.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("1"))) 8629c0c1533SAndrea Pescetti maLockDepth = ucb::LockDepth_ONE; 8639c0c1533SAndrea Pescetti else if(aStr.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("infinity"))) 8649c0c1533SAndrea Pescetti maLockDepth = ucb::LockDepth_INFINITY; 8659c0c1533SAndrea Pescetti } 8669c0c1533SAndrea Pescetti break; 8679c0c1533SAndrea Pescetti } 8688590a0fdSAndre Fischer case WebDAVName_propstat: 8698590a0fdSAndre Fischer { 8708590a0fdSAndre Fischer // propstat end, check status 8718590a0fdSAndre Fischer if(maStatus.getLength()) 8728590a0fdSAndre Fischer { 8738590a0fdSAndre Fischer static ::rtl::OUString aStrStatusOkay(::rtl::OUString::createFromAscii("HTTP/1.1 200 OK")); 8748590a0fdSAndre Fischer 8758590a0fdSAndre Fischer if(maStatus.equals(aStrStatusOkay)) 8768590a0fdSAndre Fischer { 8778590a0fdSAndre Fischer if(isCollectingProperties()) 8788590a0fdSAndre Fischer { 8798590a0fdSAndre Fischer if(maPropStatProperties.size()) 8808590a0fdSAndre Fischer { 8818590a0fdSAndre Fischer // append to maResponseProperties if okay 8828590a0fdSAndre Fischer maResponseProperties.insert(maResponseProperties.end(), maPropStatProperties.begin(), maPropStatProperties.end()); 8838590a0fdSAndre Fischer } 8848590a0fdSAndre Fischer } 8858590a0fdSAndre Fischer else 8868590a0fdSAndre Fischer { 8878590a0fdSAndre Fischer if(maPropStatNames.size()) 8888590a0fdSAndre Fischer { 8898590a0fdSAndre Fischer // when collecting properties append to 8908590a0fdSAndre Fischer maResponseNames.insert(maResponseNames.end(), maPropStatNames.begin(), maPropStatNames.end()); 8918590a0fdSAndre Fischer } 8928590a0fdSAndre Fischer } 8938590a0fdSAndre Fischer } 8948590a0fdSAndre Fischer } 8958590a0fdSAndre Fischer break; 8968590a0fdSAndre Fischer } 8978590a0fdSAndre Fischer case WebDAVName_response: 8988590a0fdSAndre Fischer { 8999c0c1533SAndrea Pescetti // response end 9008590a0fdSAndre Fischer if(maHref.getLength()) 9018590a0fdSAndre Fischer { 9028590a0fdSAndre Fischer if(isCollectingProperties()) 9038590a0fdSAndre Fischer { 9048590a0fdSAndre Fischer // create DAVResource when we have content 9058590a0fdSAndre Fischer if(maResponseProperties.size()) 9068590a0fdSAndre Fischer { 9079c0c1533SAndrea Pescetti ::http_dav_ucp::DAVResource aDAVResource; 9088590a0fdSAndre Fischer 9098590a0fdSAndre Fischer aDAVResource.uri = maHref; 9108590a0fdSAndre Fischer aDAVResource.properties = maResponseProperties; 9118590a0fdSAndre Fischer maResult_PropFind.push_back(aDAVResource); 9128590a0fdSAndre Fischer } 9138590a0fdSAndre Fischer } 9148590a0fdSAndre Fischer else 9158590a0fdSAndre Fischer { 9168590a0fdSAndre Fischer // when collecting properties add them to result when there are some 9178590a0fdSAndre Fischer if(maResponseNames.size()) 9188590a0fdSAndre Fischer { 9198590a0fdSAndre Fischer http_dav_ucp::DAVResourceInfo aDAVResourceInfo(maHref); 9208590a0fdSAndre Fischer 9218590a0fdSAndre Fischer aDAVResourceInfo.properties = maResponseNames; 9228590a0fdSAndre Fischer maResult_PropName.push_back(aDAVResourceInfo); 9238590a0fdSAndre Fischer } 9248590a0fdSAndre Fischer } 9258590a0fdSAndre Fischer } 9268590a0fdSAndre Fischer break; 9278590a0fdSAndre Fischer } 9288590a0fdSAndre Fischer } 9298590a0fdSAndre Fischer break; 9308590a0fdSAndre Fischer } 9318590a0fdSAndre Fischer case WebDAVNamespace_ucb_openoffice_org_dav_props: 9328590a0fdSAndre Fischer { 9338590a0fdSAndre Fischer break; 9348590a0fdSAndre Fischer } 9358590a0fdSAndre Fischer } 9368590a0fdSAndre Fischer } 9378590a0fdSAndre Fischer 9388590a0fdSAndre Fischer // destroy last context (pop) 9398590a0fdSAndre Fischer pop_context(); 9408590a0fdSAndre Fischer } 9418590a0fdSAndre Fischer } 9428590a0fdSAndre Fischer characters(const::rtl::OUString & aChars)9438590a0fdSAndre Fischer void SAL_CALL WebDAVResponseParser::characters( const ::rtl::OUString& aChars ) throw (xml::sax::SAXException, uno::RuntimeException) 9448590a0fdSAndre Fischer { 9458590a0fdSAndre Fischer // collect whitespace over evtl. several calls in mpContext 9468590a0fdSAndre Fischer OSL_ENSURE(mpContext, "Parser characters without content (!)"); 9478590a0fdSAndre Fischer const sal_Int32 nLen(aChars.getLength()); 9488590a0fdSAndre Fischer 9498590a0fdSAndre Fischer if(mpContext && nLen) 9508590a0fdSAndre Fischer { 9518590a0fdSAndre Fischer // remove leading/trailing blanks and CRLF 9528590a0fdSAndre Fischer const ::rtl::OUString aTrimmedChars(aChars.trim()); 9538590a0fdSAndre Fischer 9548590a0fdSAndre Fischer if(aTrimmedChars.getLength()) 9558590a0fdSAndre Fischer { 9568590a0fdSAndre Fischer ::rtl::OUString aNew(mpContext->getWhiteSpace()); 9578590a0fdSAndre Fischer 9588590a0fdSAndre Fischer if(aNew.getLength()) 9598590a0fdSAndre Fischer { 9608590a0fdSAndre Fischer // add one char when appending (see html1.1 spec) 9618590a0fdSAndre Fischer aNew += ::rtl::OUString(sal_Unicode(' ')); 9628590a0fdSAndre Fischer } 9638590a0fdSAndre Fischer 9648590a0fdSAndre Fischer aNew += aTrimmedChars; 9658590a0fdSAndre Fischer mpContext->setWhiteSpace(aNew); 9668590a0fdSAndre Fischer } 9678590a0fdSAndre Fischer } 9688590a0fdSAndre Fischer } 9698590a0fdSAndre Fischer ignorableWhitespace(const::rtl::OUString &)9708590a0fdSAndre Fischer void SAL_CALL WebDAVResponseParser::ignorableWhitespace( const ::rtl::OUString& /*aWhitespaces*/ ) throw (xml::sax::SAXException, uno::RuntimeException) 9718590a0fdSAndre Fischer { 9728590a0fdSAndre Fischer } 9738590a0fdSAndre Fischer processingInstruction(const::rtl::OUString &,const::rtl::OUString &)9749c0c1533SAndrea Pescetti void SAL_CALL WebDAVResponseParser::processingInstruction( const ::rtl::OUString& /*aTarget*/, const ::rtl::OUString& /*aData*/ ) 9759c0c1533SAndrea Pescetti throw (xml::sax::SAXException, uno::RuntimeException) 9768590a0fdSAndre Fischer { 9778590a0fdSAndre Fischer } 9788590a0fdSAndre Fischer setDocumentLocator(const uno::Reference<xml::sax::XLocator> &)9798590a0fdSAndre Fischer void SAL_CALL WebDAVResponseParser::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& /*xLocator*/ ) throw (xml::sax::SAXException, uno::RuntimeException) 9808590a0fdSAndre Fischer { 9818590a0fdSAndre Fischer } 9828590a0fdSAndre Fischer } // end of anonymous namespace 9838590a0fdSAndre Fischer 9848590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 9858590a0fdSAndre Fischer // wrapper for various calls to the parser 9868590a0fdSAndre Fischer 9878590a0fdSAndre Fischer namespace 9888590a0fdSAndre Fischer { parseWebDAVPropNameResponse(const uno::Reference<io::XInputStream> & xInputStream,std::vector<http_dav_ucp::DAVResource> & rPropFind,std::vector<http_dav_ucp::DAVResourceInfo> & rPropName,http_dav_ucp::DAVPropertyValue & rPropValue,WebDAVResponseParserMode eWebDAVResponseParserMode)9898590a0fdSAndre Fischer void parseWebDAVPropNameResponse( 9908590a0fdSAndre Fischer const uno::Reference< io::XInputStream >& xInputStream, 9918590a0fdSAndre Fischer std::vector< http_dav_ucp::DAVResource >& rPropFind, 9928590a0fdSAndre Fischer std::vector< http_dav_ucp::DAVResourceInfo >& rPropName, 9939c0c1533SAndrea Pescetti http_dav_ucp::DAVPropertyValue& rPropValue, 9948590a0fdSAndre Fischer WebDAVResponseParserMode eWebDAVResponseParserMode) 9958590a0fdSAndre Fischer { 9968590a0fdSAndre Fischer if(xInputStream.is()) 9978590a0fdSAndre Fischer { 9988590a0fdSAndre Fischer try 9998590a0fdSAndre Fischer { 10008590a0fdSAndre Fischer // prepare ParserInputSrouce 10018590a0fdSAndre Fischer xml::sax::InputSource myInputSource; 10028590a0fdSAndre Fischer myInputSource.aInputStream = xInputStream; 10038590a0fdSAndre Fischer 10048590a0fdSAndre Fischer // get parser 10058590a0fdSAndre Fischer uno::Reference< xml::sax::XParser > xParser( 10068590a0fdSAndre Fischer comphelper::getProcessServiceFactory()->createInstance( 10078590a0fdSAndre Fischer rtl::OUString::createFromAscii("com.sun.star.xml.sax.Parser") ), 10088590a0fdSAndre Fischer uno::UNO_QUERY_THROW ); 10098590a0fdSAndre Fischer 10108590a0fdSAndre Fischer // create parser; connect parser and filter 10118590a0fdSAndre Fischer WebDAVResponseParser* pWebDAVResponseParser = new WebDAVResponseParser(eWebDAVResponseParserMode); 10128590a0fdSAndre Fischer uno::Reference< xml::sax::XDocumentHandler > xWebDAVHdl(pWebDAVResponseParser); 10138590a0fdSAndre Fischer xParser->setDocumentHandler(xWebDAVHdl); 10148590a0fdSAndre Fischer 10158590a0fdSAndre Fischer // finally, parse the stream 10168590a0fdSAndre Fischer xParser->parseStream(myInputSource); 10178590a0fdSAndre Fischer 10188590a0fdSAndre Fischer // get result 10198590a0fdSAndre Fischer switch(eWebDAVResponseParserMode) 10208590a0fdSAndre Fischer { 10218590a0fdSAndre Fischer case WebDAVResponseParserMode_PropFind: 10228590a0fdSAndre Fischer { 10238590a0fdSAndre Fischer rPropFind = pWebDAVResponseParser->getResult_PropFind(); 10248590a0fdSAndre Fischer break; 10258590a0fdSAndre Fischer } 10268590a0fdSAndre Fischer case WebDAVResponseParserMode_PropName: 10278590a0fdSAndre Fischer { 10288590a0fdSAndre Fischer rPropName = pWebDAVResponseParser->getResult_PropName(); 10298590a0fdSAndre Fischer break; 10308590a0fdSAndre Fischer } 10319c0c1533SAndrea Pescetti case WebDAVResponseParserMode_LockResponse: 10329c0c1533SAndrea Pescetti { 10339c0c1533SAndrea Pescetti rPropValue = pWebDAVResponseParser->getResult_Lock(); 10349c0c1533SAndrea Pescetti break; 10359c0c1533SAndrea Pescetti } 10368590a0fdSAndre Fischer } 10378590a0fdSAndre Fischer } 10388590a0fdSAndre Fischer catch(uno::Exception&) 10398590a0fdSAndre Fischer { 10408590a0fdSAndre Fischer OSL_ENSURE(false, "WebDAV Parse error (!)"); 10418590a0fdSAndre Fischer } 10428590a0fdSAndre Fischer } 10438590a0fdSAndre Fischer } 10448590a0fdSAndre Fischer } // end of anonymous namespace 10458590a0fdSAndre Fischer 10468590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 10478590a0fdSAndre Fischer // helper to parse a XML WebDAV response 10488590a0fdSAndre Fischer 10498590a0fdSAndre Fischer namespace http_dav_ucp 10508590a0fdSAndre Fischer { parseWebDAVPropFindResponse(const uno::Reference<io::XInputStream> & xInputStream)10518590a0fdSAndre Fischer std::vector< DAVResource > parseWebDAVPropFindResponse(const uno::Reference< io::XInputStream >& xInputStream) 10528590a0fdSAndre Fischer { 10538590a0fdSAndre Fischer std::vector< DAVResource > aRetval; 10548590a0fdSAndre Fischer std::vector< DAVResourceInfo > aFoo; 10559c0c1533SAndrea Pescetti DAVPropertyValue aFoo2; 10568590a0fdSAndre Fischer 10579c0c1533SAndrea Pescetti parseWebDAVPropNameResponse(xInputStream, aRetval, aFoo, aFoo2, WebDAVResponseParserMode_PropFind); 10588590a0fdSAndre Fischer return aRetval; 10598590a0fdSAndre Fischer } 10608590a0fdSAndre Fischer parseWebDAVPropNameResponse(const uno::Reference<io::XInputStream> & xInputStream)10618590a0fdSAndre Fischer std::vector< DAVResourceInfo > parseWebDAVPropNameResponse(const uno::Reference< io::XInputStream >& xInputStream) 10628590a0fdSAndre Fischer { 10638590a0fdSAndre Fischer std::vector< DAVResource > aFoo; 10648590a0fdSAndre Fischer std::vector< DAVResourceInfo > aRetval; 10659c0c1533SAndrea Pescetti DAVPropertyValue aFoo2; 10668590a0fdSAndre Fischer 10679c0c1533SAndrea Pescetti parseWebDAVPropNameResponse(xInputStream, aFoo, aRetval, aFoo2, WebDAVResponseParserMode_PropName); 10688590a0fdSAndre Fischer return aRetval; 10698590a0fdSAndre Fischer } 10709c0c1533SAndrea Pescetti parseWebDAVLockResponse(const uno::Reference<io::XInputStream> & xInputStream)10719c0c1533SAndrea Pescetti http_dav_ucp::DAVPropertyValue parseWebDAVLockResponse(const uno::Reference< io::XInputStream >& xInputStream) 10729c0c1533SAndrea Pescetti { 10739c0c1533SAndrea Pescetti std::vector< DAVResource > aFoo2; 10749c0c1533SAndrea Pescetti std::vector< DAVResourceInfo > aFoo; 10759c0c1533SAndrea Pescetti http_dav_ucp::DAVPropertyValue aRetval; 10769c0c1533SAndrea Pescetti 10779c0c1533SAndrea Pescetti 10789c0c1533SAndrea Pescetti parseWebDAVPropNameResponse(xInputStream, aFoo2, aFoo, aRetval, WebDAVResponseParserMode_LockResponse); 10799c0c1533SAndrea Pescetti return aRetval; 10809c0c1533SAndrea Pescetti } 10819c0c1533SAndrea Pescetti 10828590a0fdSAndre Fischer } // namespace http_dav_ucp 10838590a0fdSAndre Fischer 10848590a0fdSAndre Fischer ////////////////////////////////////////////////////////////////////////////// 10858590a0fdSAndre Fischer // eof 1086