OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/cxfa_simple_parser.h" | 7 #include "xfa/fxfa/parser/cxfa_simple_parser.h" |
8 | 8 |
9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 CXFA_SimpleParser::~CXFA_SimpleParser() {} | 274 CXFA_SimpleParser::~CXFA_SimpleParser() {} |
275 | 275 |
276 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { | 276 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { |
277 m_pFactory = pFactory; | 277 m_pFactory = pFactory; |
278 } | 278 } |
279 | 279 |
280 int32_t CXFA_SimpleParser::StartParse(IFX_SeekableReadStream* pStream, | 280 int32_t CXFA_SimpleParser::StartParse(IFX_SeekableReadStream* pStream, |
281 XFA_XDPPACKET ePacketID) { | 281 XFA_XDPPACKET ePacketID) { |
282 CloseParser(); | 282 CloseParser(); |
283 m_pFileRead = pStream; | 283 m_pFileRead = pStream; |
284 m_pStream.reset(IFX_Stream::CreateStream( | 284 m_pStream.reset(IFGAS_Stream::CreateStream( |
285 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text)); | 285 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text)); |
286 if (!m_pStream) | 286 if (!m_pStream) |
287 return XFA_PARSESTATUS_StreamErr; | 287 return XFA_PARSESTATUS_StreamErr; |
288 | 288 |
289 uint16_t wCodePage = m_pStream->GetCodePage(); | 289 uint16_t wCodePage = m_pStream->GetCodePage(); |
290 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && | 290 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && |
291 wCodePage != FX_CODEPAGE_UTF8) { | 291 wCodePage != FX_CODEPAGE_UTF8) { |
292 m_pStream->SetCodePage(FX_CODEPAGE_UTF8); | 292 m_pStream->SetCodePage(FX_CODEPAGE_UTF8); |
293 } | 293 } |
294 m_pXMLDoc.reset(new CFDE_XMLDoc); | 294 m_pXMLDoc.reset(new CFDE_XMLDoc); |
(...skipping 23 matching lines...) Expand all Loading... |
318 return XFA_PARSESTATUS_StatusErr; | 318 return XFA_PARSESTATUS_StatusErr; |
319 return XFA_PARSESTATUS_Done; | 319 return XFA_PARSESTATUS_Done; |
320 } | 320 } |
321 | 321 |
322 int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, | 322 int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, |
323 CFDE_XMLNode*& pXMLNode, | 323 CFDE_XMLNode*& pXMLNode, |
324 IFX_Pause* pPause) { | 324 IFX_Pause* pPause) { |
325 CloseParser(); | 325 CloseParser(); |
326 pXMLNode = nullptr; | 326 pXMLNode = nullptr; |
327 | 327 |
328 std::unique_ptr<IFX_Stream> pStream(new CXFA_WideTextRead(wsXML)); | 328 std::unique_ptr<IFGAS_Stream> pStream(new CXFA_WideTextRead(wsXML)); |
329 m_pXMLDoc.reset(new CFDE_XMLDoc); | 329 m_pXMLDoc.reset(new CFDE_XMLDoc); |
330 CXFA_XMLParser* pParser = | 330 CXFA_XMLParser* pParser = |
331 new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream.get()); | 331 new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream.get()); |
332 pParser->m_dwCheckStatus = 0x03; | 332 pParser->m_dwCheckStatus = 0x03; |
333 if (!m_pXMLDoc->LoadXML(pParser)) | 333 if (!m_pXMLDoc->LoadXML(pParser)) |
334 return XFA_PARSESTATUS_StatusErr; | 334 return XFA_PARSESTATUS_StatusErr; |
335 | 335 |
336 int32_t iRet = m_pXMLDoc->DoLoad(pPause); | 336 int32_t iRet = m_pXMLDoc->DoLoad(pPause); |
337 if (iRet < 0 || iRet >= 100) | 337 if (iRet < 0 || iRet >= 100) |
338 m_pXMLDoc->CloseXML(); | 338 m_pXMLDoc->CloseXML(); |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, true); | 1300 pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, true); |
1301 } | 1301 } |
1302 } | 1302 } |
1303 } | 1303 } |
1304 } | 1304 } |
1305 | 1305 |
1306 void CXFA_SimpleParser::CloseParser() { | 1306 void CXFA_SimpleParser::CloseParser() { |
1307 m_pXMLDoc.reset(); | 1307 m_pXMLDoc.reset(); |
1308 m_pStream.reset(); | 1308 m_pStream.reset(); |
1309 } | 1309 } |
OLD | NEW |