| 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/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 m_pRootNode = pXFANode; | 382 m_pRootNode = pXFANode; |
| 383 } else { | 383 } else { |
| 384 m_pRootNode = DataLoader(pXFANode, pXMLNode, TRUE); | 384 m_pRootNode = DataLoader(pXFANode, pXMLNode, TRUE); |
| 385 } | 385 } |
| 386 } else if (pXFANode->IsContentNode()) { | 386 } else if (pXFANode->IsContentNode()) { |
| 387 ParseContentNode(pXFANode, pXMLNode, ePacketID); | 387 ParseContentNode(pXFANode, pXMLNode, ePacketID); |
| 388 m_pRootNode = pXFANode; | 388 m_pRootNode = pXFANode; |
| 389 } else { | 389 } else { |
| 390 m_pRootNode = NormalLoader(pXFANode, pXMLNode, ePacketID); | 390 m_pRootNode = NormalLoader(pXFANode, pXMLNode, ePacketID, TRUE); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 | 393 |
| 394 CXFA_Node* CXFA_SimpleParser::GetRootNode() const { | 394 CXFA_Node* CXFA_SimpleParser::GetRootNode() const { |
| 395 return m_pRootNode; | 395 return m_pRootNode; |
| 396 } | 396 } |
| 397 | 397 |
| 398 CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { | 398 CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { |
| 399 return m_pXMLDoc.get(); | 399 return m_pXMLDoc.get(); |
| 400 } | 400 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 XFA_GetPacketByIndex(XFA_PACKET_Config)->eFlags)) { | 599 XFA_GetPacketByIndex(XFA_PACKET_Config)->eFlags)) { |
| 600 return nullptr; | 600 return nullptr; |
| 601 } | 601 } |
| 602 CXFA_Node* pNode = | 602 CXFA_Node* pNode = |
| 603 m_pFactory->CreateNode(XFA_XDPPACKET_Config, XFA_Element::Config); | 603 m_pFactory->CreateNode(XFA_XDPPACKET_Config, XFA_Element::Config); |
| 604 if (!pNode) | 604 if (!pNode) |
| 605 return nullptr; | 605 return nullptr; |
| 606 | 606 |
| 607 pNode->SetCData(XFA_ATTRIBUTE_Name, | 607 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 608 XFA_GetPacketByIndex(XFA_PACKET_Config)->pName); | 608 XFA_GetPacketByIndex(XFA_PACKET_Config)->pName); |
| 609 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) | 609 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) |
| 610 return nullptr; | 610 return nullptr; |
| 611 | 611 |
| 612 pNode->SetXMLMappingNode(pXMLDocumentNode); | 612 pNode->SetXMLMappingNode(pXMLDocumentNode); |
| 613 return pNode; | 613 return pNode; |
| 614 } | 614 } |
| 615 | 615 |
| 616 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( | 616 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( |
| 617 CFDE_XMLNode* pXMLDocumentNode, | 617 CFDE_XMLNode* pXMLDocumentNode, |
| 618 XFA_XDPPACKET ePacketID) { | 618 XFA_XDPPACKET ePacketID) { |
| 619 CXFA_Node* pNode = nullptr; | 619 CXFA_Node* pNode = nullptr; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 632 if (m_bDocumentParser) { | 632 if (m_bDocumentParser) { |
| 633 CFX_WideString wsNamespaceURI; | 633 CFX_WideString wsNamespaceURI; |
| 634 CFDE_XMLElement* pXMLDocumentElement = | 634 CFDE_XMLElement* pXMLDocumentElement = |
| 635 static_cast<CFDE_XMLElement*>(pXMLDocumentNode); | 635 static_cast<CFDE_XMLElement*>(pXMLDocumentNode); |
| 636 pXMLDocumentElement->GetNamespaceURI(wsNamespaceURI); | 636 pXMLDocumentElement->GetNamespaceURI(wsNamespaceURI); |
| 637 if (wsNamespaceURI.IsEmpty()) | 637 if (wsNamespaceURI.IsEmpty()) |
| 638 pXMLDocumentElement->GetString(L"xmlns:xfa", wsNamespaceURI); | 638 pXMLDocumentElement->GetString(L"xmlns:xfa", wsNamespaceURI); |
| 639 | 639 |
| 640 pNode->GetDocument()->RecognizeXFAVersionNumber(wsNamespaceURI); | 640 pNode->GetDocument()->RecognizeXFAVersionNumber(wsNamespaceURI); |
| 641 } | 641 } |
| 642 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) | 642 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) |
| 643 return nullptr; | 643 return nullptr; |
| 644 } | 644 } |
| 645 } else if (ePacketID == XFA_XDPPACKET_Form) { | 645 } else if (ePacketID == XFA_XDPPACKET_Form) { |
| 646 if (MatchNodeName(pXMLDocumentNode, | 646 if (MatchNodeName(pXMLDocumentNode, |
| 647 XFA_GetPacketByIndex(XFA_PACKET_Form)->pName, | 647 XFA_GetPacketByIndex(XFA_PACKET_Form)->pName, |
| 648 XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI, | 648 XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI, |
| 649 XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) { | 649 XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) { |
| 650 CFDE_XMLElement* pXMLDocumentElement = | 650 CFDE_XMLElement* pXMLDocumentElement = |
| 651 static_cast<CFDE_XMLElement*>(pXMLDocumentNode); | 651 static_cast<CFDE_XMLElement*>(pXMLDocumentNode); |
| 652 CFX_WideString wsChecksum; | 652 CFX_WideString wsChecksum; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName, | 768 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName, |
| 769 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pURI, | 769 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pURI, |
| 770 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->eFlags)) { | 770 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->eFlags)) { |
| 771 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_LocaleSet, | 771 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_LocaleSet, |
| 772 XFA_Element::LocaleSet); | 772 XFA_Element::LocaleSet); |
| 773 if (!pNode) | 773 if (!pNode) |
| 774 return nullptr; | 774 return nullptr; |
| 775 | 775 |
| 776 pNode->SetCData(XFA_ATTRIBUTE_Name, | 776 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 777 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName); | 777 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName); |
| 778 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) | 778 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) |
| 779 return nullptr; | 779 return nullptr; |
| 780 } | 780 } |
| 781 } else if (ePacketID == XFA_XDPPACKET_ConnectionSet) { | 781 } else if (ePacketID == XFA_XDPPACKET_ConnectionSet) { |
| 782 if (MatchNodeName(pXMLDocumentNode, | 782 if (MatchNodeName(pXMLDocumentNode, |
| 783 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName, | 783 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName, |
| 784 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pURI, | 784 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pURI, |
| 785 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->eFlags)) { | 785 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->eFlags)) { |
| 786 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_ConnectionSet, | 786 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_ConnectionSet, |
| 787 XFA_Element::ConnectionSet); | 787 XFA_Element::ConnectionSet); |
| 788 if (!pNode) | 788 if (!pNode) |
| 789 return nullptr; | 789 return nullptr; |
| 790 | 790 |
| 791 pNode->SetCData(XFA_ATTRIBUTE_Name, | 791 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 792 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName); | 792 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName); |
| 793 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) | 793 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) |
| 794 return nullptr; | 794 return nullptr; |
| 795 } | 795 } |
| 796 } else if (ePacketID == XFA_XDPPACKET_SourceSet) { | 796 } else if (ePacketID == XFA_XDPPACKET_SourceSet) { |
| 797 if (MatchNodeName(pXMLDocumentNode, | 797 if (MatchNodeName(pXMLDocumentNode, |
| 798 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName, | 798 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName, |
| 799 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pURI, | 799 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pURI, |
| 800 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->eFlags)) { | 800 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->eFlags)) { |
| 801 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_SourceSet, | 801 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_SourceSet, |
| 802 XFA_Element::SourceSet); | 802 XFA_Element::SourceSet); |
| 803 if (!pNode) | 803 if (!pNode) |
| 804 return nullptr; | 804 return nullptr; |
| 805 | 805 |
| 806 pNode->SetCData(XFA_ATTRIBUTE_Name, | 806 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 807 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName); | 807 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName); |
| 808 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) | 808 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, TRUE)) |
| 809 return nullptr; | 809 return nullptr; |
| 810 } | 810 } |
| 811 } | 811 } |
| 812 if (pNode) | 812 if (pNode) |
| 813 pNode->SetXMLMappingNode(pXMLDocumentNode); | 813 pNode->SetXMLMappingNode(pXMLDocumentNode); |
| 814 return pNode; | 814 return pNode; |
| 815 } | 815 } |
| 816 | 816 |
| 817 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( | 817 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( |
| 818 CFDE_XMLNode* pXMLDocumentNode, | 818 CFDE_XMLNode* pXMLDocumentNode, |
| (...skipping 481 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 |