| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/xfa_parser_imp.h" | 7 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 m_pStream = NULL; | 145 m_pStream = NULL; |
| 146 } | 146 } |
| 147 pXMLNode = XFA_FDEExtension_GetDocumentNode(m_pXMLDoc); | 147 pXMLNode = XFA_FDEExtension_GetDocumentNode(m_pXMLDoc); |
| 148 return XFA_PARSESTATUS_Done; | 148 return XFA_PARSESTATUS_Done; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, | 151 void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, |
| 152 CFDE_XMLNode* pXMLNode) { | 152 CFDE_XMLNode* pXMLNode) { |
| 153 XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID(); | 153 XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID(); |
| 154 if (ePacketID == XFA_XDPPACKET_Datasets) { | 154 if (ePacketID == XFA_XDPPACKET_Datasets) { |
| 155 if (pXFANode->GetClassID() == XFA_ELEMENT_DataValue) { | 155 if (pXFANode->GetClassID() == XFA_Element::DataValue) { |
| 156 for (CFDE_XMLNode* pXMLChild = | 156 for (CFDE_XMLNode* pXMLChild = |
| 157 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); | 157 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); |
| 158 pXMLChild; | 158 pXMLChild; |
| 159 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 159 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
| 160 FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); | 160 FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); |
| 161 if (eNodeType == FDE_XMLNODE_Instruction) | 161 if (eNodeType == FDE_XMLNODE_Instruction) |
| 162 continue; | 162 continue; |
| 163 | 163 |
| 164 if (eNodeType == FDE_XMLNODE_Element) { | 164 if (eNodeType == FDE_XMLNODE_Element) { |
| 165 CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, | 165 CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, |
| 166 XFA_ELEMENT_DataValue); | 166 XFA_Element::DataValue); |
| 167 if (!pXFAChild) | 167 if (!pXFAChild) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 CFX_WideString wsNodeStr; | 170 CFX_WideString wsNodeStr; |
| 171 CFDE_XMLElement* child = static_cast<CFDE_XMLElement*>(pXMLChild); | 171 CFDE_XMLElement* child = static_cast<CFDE_XMLElement*>(pXMLChild); |
| 172 child->GetLocalTagName(wsNodeStr); | 172 child->GetLocalTagName(wsNodeStr); |
| 173 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); | 173 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); |
| 174 CFX_WideString wsChildValue; | 174 CFX_WideString wsChildValue; |
| 175 XFA_GetPlainTextFromRichText(child, wsChildValue); | 175 XFA_GetPlainTextFromRichText(child, wsChildValue); |
| 176 if (!wsChildValue.IsEmpty()) | 176 if (!wsChildValue.IsEmpty()) |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( | 380 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( |
| 381 CFDE_XMLNode* pXMLDocumentNode, | 381 CFDE_XMLNode* pXMLDocumentNode, |
| 382 XFA_XDPPACKET ePacketID) { | 382 XFA_XDPPACKET ePacketID) { |
| 383 if (!XFA_FDEExtension_MatchNodeName( | 383 if (!XFA_FDEExtension_MatchNodeName( |
| 384 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName, | 384 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName, |
| 385 XFA_GetPacketByIndex(XFA_PACKET_XDP)->pURI, | 385 XFA_GetPacketByIndex(XFA_PACKET_XDP)->pURI, |
| 386 XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) { | 386 XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) { |
| 387 return nullptr; | 387 return nullptr; |
| 388 } | 388 } |
| 389 CXFA_Node* pXFARootNode = | 389 CXFA_Node* pXFARootNode = |
| 390 m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_ELEMENT_Xfa); | 390 m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Xfa); |
| 391 if (!pXFARootNode) { | 391 if (!pXFARootNode) { |
| 392 return nullptr; | 392 return nullptr; |
| 393 } | 393 } |
| 394 m_pRootNode = pXFARootNode; | 394 m_pRootNode = pXFARootNode; |
| 395 pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, L"xfa"); | 395 pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, L"xfa"); |
| 396 { | 396 { |
| 397 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLDocumentNode); | 397 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLDocumentNode); |
| 398 int32_t iAttributeCount = pElement->CountAttributes(); | 398 int32_t iAttributeCount = pElement->CountAttributes(); |
| 399 for (int32_t i = 0; i < iAttributeCount; i++) { | 399 for (int32_t i = 0; i < iAttributeCount; i++) { |
| 400 CFX_WideString wsAttriName, wsAttriValue; | 400 CFX_WideString wsAttriName, wsAttriValue; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( | 518 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( |
| 519 CFDE_XMLNode* pXMLDocumentNode, | 519 CFDE_XMLNode* pXMLDocumentNode, |
| 520 XFA_XDPPACKET ePacketID) { | 520 XFA_XDPPACKET ePacketID) { |
| 521 if (!XFA_FDEExtension_MatchNodeName( | 521 if (!XFA_FDEExtension_MatchNodeName( |
| 522 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName, | 522 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName, |
| 523 XFA_GetPacketByIndex(XFA_PACKET_Config)->pURI, | 523 XFA_GetPacketByIndex(XFA_PACKET_Config)->pURI, |
| 524 XFA_GetPacketByIndex(XFA_PACKET_Config)->eFlags)) { | 524 XFA_GetPacketByIndex(XFA_PACKET_Config)->eFlags)) { |
| 525 return NULL; | 525 return NULL; |
| 526 } | 526 } |
| 527 CXFA_Node* pNode = | 527 CXFA_Node* pNode = |
| 528 m_pFactory->CreateNode(XFA_XDPPACKET_Config, XFA_ELEMENT_Config); | 528 m_pFactory->CreateNode(XFA_XDPPACKET_Config, XFA_Element::Config); |
| 529 if (!pNode) { | 529 if (!pNode) { |
| 530 return NULL; | 530 return NULL; |
| 531 } | 531 } |
| 532 pNode->SetCData(XFA_ATTRIBUTE_Name, | 532 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 533 XFA_GetPacketByIndex(XFA_PACKET_Config)->pName); | 533 XFA_GetPacketByIndex(XFA_PACKET_Config)->pName); |
| 534 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { | 534 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { |
| 535 return NULL; | 535 return NULL; |
| 536 } | 536 } |
| 537 pNode->SetXMLMappingNode(pXMLDocumentNode); | 537 pNode->SetXMLMappingNode(pXMLDocumentNode); |
| 538 return pNode; | 538 return pNode; |
| 539 } | 539 } |
| 540 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( | 540 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( |
| 541 CFDE_XMLNode* pXMLDocumentNode, | 541 CFDE_XMLNode* pXMLDocumentNode, |
| 542 XFA_XDPPACKET ePacketID) { | 542 XFA_XDPPACKET ePacketID) { |
| 543 CXFA_Node* pNode = NULL; | 543 CXFA_Node* pNode = NULL; |
| 544 if (ePacketID == XFA_XDPPACKET_Template) { | 544 if (ePacketID == XFA_XDPPACKET_Template) { |
| 545 if (XFA_FDEExtension_MatchNodeName( | 545 if (XFA_FDEExtension_MatchNodeName( |
| 546 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Template)->pName, | 546 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Template)->pName, |
| 547 XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI, | 547 XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI, |
| 548 XFA_GetPacketByIndex(XFA_PACKET_Template)->eFlags)) { | 548 XFA_GetPacketByIndex(XFA_PACKET_Template)->eFlags)) { |
| 549 pNode = | 549 pNode = |
| 550 m_pFactory->CreateNode(XFA_XDPPACKET_Template, XFA_ELEMENT_Template); | 550 m_pFactory->CreateNode(XFA_XDPPACKET_Template, XFA_Element::Template); |
| 551 if (!pNode) { | 551 if (!pNode) { |
| 552 return NULL; | 552 return NULL; |
| 553 } | 553 } |
| 554 pNode->SetCData(XFA_ATTRIBUTE_Name, | 554 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 555 XFA_GetPacketByIndex(XFA_PACKET_Template)->pName); | 555 XFA_GetPacketByIndex(XFA_PACKET_Template)->pName); |
| 556 if (m_bDocumentParser) { | 556 if (m_bDocumentParser) { |
| 557 CFX_WideString wsNamespaceURI; | 557 CFX_WideString wsNamespaceURI; |
| 558 CFDE_XMLElement* pXMLDocumentElement = | 558 CFDE_XMLElement* pXMLDocumentElement = |
| 559 static_cast<CFDE_XMLElement*>(pXMLDocumentNode); | 559 static_cast<CFDE_XMLElement*>(pXMLDocumentNode); |
| 560 pXMLDocumentElement->GetNamespaceURI(wsNamespaceURI); | 560 pXMLDocumentElement->GetNamespaceURI(wsNamespaceURI); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 584 pChecksum->StartChecksum(); | 584 pChecksum->StartChecksum(); |
| 585 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0], | 585 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[0], |
| 586 m_pXMLParser->m_nSize[0]); | 586 m_pXMLParser->m_nSize[0]); |
| 587 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[1], | 587 pChecksum->UpdateChecksum(m_pFileRead, m_pXMLParser->m_nStart[1], |
| 588 m_pXMLParser->m_nSize[1]); | 588 m_pXMLParser->m_nSize[1]); |
| 589 pChecksum->FinishChecksum(); | 589 pChecksum->FinishChecksum(); |
| 590 CFX_ByteString bsCheck = pChecksum->GetChecksum(); | 590 CFX_ByteString bsCheck = pChecksum->GetChecksum(); |
| 591 if (bsCheck != wsChecksum.UTF8Encode()) | 591 if (bsCheck != wsChecksum.UTF8Encode()) |
| 592 return nullptr; | 592 return nullptr; |
| 593 | 593 |
| 594 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Form, XFA_ELEMENT_Form); | 594 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_Form, XFA_Element::Form); |
| 595 if (!pNode) | 595 if (!pNode) |
| 596 return nullptr; | 596 return nullptr; |
| 597 | 597 |
| 598 pNode->SetCData(XFA_ATTRIBUTE_Name, | 598 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 599 XFA_GetPacketByIndex(XFA_PACKET_Form)->pName); | 599 XFA_GetPacketByIndex(XFA_PACKET_Form)->pName); |
| 600 pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsStringC()); | 600 pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsStringC()); |
| 601 CXFA_Node* pTemplateRoot = | 601 CXFA_Node* pTemplateRoot = |
| 602 m_pRootNode->GetFirstChildByClass(XFA_ELEMENT_Template); | 602 m_pRootNode->GetFirstChildByClass(XFA_Element::Template); |
| 603 CXFA_Node* pTemplateChosen = | 603 CXFA_Node* pTemplateChosen = |
| 604 pTemplateRoot | 604 pTemplateRoot |
| 605 ? pTemplateRoot->GetFirstChildByClass(XFA_ELEMENT_Subform) | 605 ? pTemplateRoot->GetFirstChildByClass(XFA_Element::Subform) |
| 606 : NULL; | 606 : NULL; |
| 607 FX_BOOL bUseAttribute = TRUE; | 607 FX_BOOL bUseAttribute = TRUE; |
| 608 if (pTemplateChosen && | 608 if (pTemplateChosen && |
| 609 pTemplateChosen->GetEnum(XFA_ATTRIBUTE_RestoreState) != | 609 pTemplateChosen->GetEnum(XFA_ATTRIBUTE_RestoreState) != |
| 610 XFA_ATTRIBUTEENUM_Auto) { | 610 XFA_ATTRIBUTEENUM_Auto) { |
| 611 bUseAttribute = FALSE; | 611 bUseAttribute = FALSE; |
| 612 } | 612 } |
| 613 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, bUseAttribute)) { | 613 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, bUseAttribute)) { |
| 614 return NULL; | 614 return NULL; |
| 615 } | 615 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 646 return pDatasetsNode; | 646 return pDatasetsNode; |
| 647 } | 647 } |
| 648 return NULL; | 648 return NULL; |
| 649 } | 649 } |
| 650 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( | 650 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( |
| 651 CFDE_XMLNode* pXMLDocumentNode, | 651 CFDE_XMLNode* pXMLDocumentNode, |
| 652 XFA_XDPPACKET ePacketID) { | 652 XFA_XDPPACKET ePacketID) { |
| 653 CFDE_XMLNode* pDatasetsXMLNode = XFA_GetDataSetsFromXDP(pXMLDocumentNode); | 653 CFDE_XMLNode* pDatasetsXMLNode = XFA_GetDataSetsFromXDP(pXMLDocumentNode); |
| 654 if (pDatasetsXMLNode) { | 654 if (pDatasetsXMLNode) { |
| 655 CXFA_Node* pNode = | 655 CXFA_Node* pNode = |
| 656 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataModel); | 656 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel); |
| 657 if (!pNode) { | 657 if (!pNode) { |
| 658 return NULL; | 658 return NULL; |
| 659 } | 659 } |
| 660 pNode->SetCData(XFA_ATTRIBUTE_Name, | 660 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 661 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName); | 661 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName); |
| 662 if (!DataLoader(pNode, pDatasetsXMLNode, FALSE)) { | 662 if (!DataLoader(pNode, pDatasetsXMLNode, FALSE)) { |
| 663 return NULL; | 663 return NULL; |
| 664 } | 664 } |
| 665 pNode->SetXMLMappingNode(pDatasetsXMLNode); | 665 pNode->SetXMLMappingNode(pDatasetsXMLNode); |
| 666 return pNode; | 666 return pNode; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 683 ASSERT(pXMLDocumentNode->GetType() == FDE_XMLNODE_Element); | 683 ASSERT(pXMLDocumentNode->GetType() == FDE_XMLNODE_Element); |
| 684 if (pXMLDocumentNode->GetType() == FDE_XMLNODE_Element) { | 684 if (pXMLDocumentNode->GetType() == FDE_XMLNODE_Element) { |
| 685 static_cast<CFDE_XMLElement*>(pXMLDocumentNode) | 685 static_cast<CFDE_XMLElement*>(pXMLDocumentNode) |
| 686 ->RemoveAttribute(L"xmlns:xfa"); | 686 ->RemoveAttribute(L"xmlns:xfa"); |
| 687 } | 687 } |
| 688 pDataElement->InsertChildNode(pXMLDocumentNode); | 688 pDataElement->InsertChildNode(pXMLDocumentNode); |
| 689 pDataXMLNode = pDataElement; | 689 pDataXMLNode = pDataElement; |
| 690 } | 690 } |
| 691 if (pDataXMLNode) { | 691 if (pDataXMLNode) { |
| 692 CXFA_Node* pNode = | 692 CXFA_Node* pNode = |
| 693 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataGroup); | 693 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataGroup); |
| 694 if (!pNode) { | 694 if (!pNode) { |
| 695 if (pDataXMLNode != pXMLDocumentNode) { | 695 if (pDataXMLNode != pXMLDocumentNode) { |
| 696 pDataXMLNode->Release(); | 696 pDataXMLNode->Release(); |
| 697 } | 697 } |
| 698 return NULL; | 698 return NULL; |
| 699 } | 699 } |
| 700 CFX_WideString wsLocalName; | 700 CFX_WideString wsLocalName; |
| 701 static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName(wsLocalName); | 701 static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName(wsLocalName); |
| 702 pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); | 702 pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName); |
| 703 if (!DataLoader(pNode, pDataXMLNode, TRUE)) { | 703 if (!DataLoader(pNode, pDataXMLNode, TRUE)) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 714 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( | 714 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( |
| 715 CFDE_XMLNode* pXMLDocumentNode, | 715 CFDE_XMLNode* pXMLDocumentNode, |
| 716 XFA_XDPPACKET ePacketID) { | 716 XFA_XDPPACKET ePacketID) { |
| 717 CXFA_Node* pNode = NULL; | 717 CXFA_Node* pNode = NULL; |
| 718 if (ePacketID == XFA_XDPPACKET_LocaleSet) { | 718 if (ePacketID == XFA_XDPPACKET_LocaleSet) { |
| 719 if (XFA_FDEExtension_MatchNodeName( | 719 if (XFA_FDEExtension_MatchNodeName( |
| 720 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName, | 720 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName, |
| 721 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pURI, | 721 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pURI, |
| 722 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->eFlags)) { | 722 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->eFlags)) { |
| 723 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_LocaleSet, | 723 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_LocaleSet, |
| 724 XFA_ELEMENT_LocaleSet); | 724 XFA_Element::LocaleSet); |
| 725 if (!pNode) { | 725 if (!pNode) { |
| 726 return NULL; | 726 return NULL; |
| 727 } | 727 } |
| 728 pNode->SetCData(XFA_ATTRIBUTE_Name, | 728 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 729 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName); | 729 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName); |
| 730 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { | 730 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { |
| 731 return NULL; | 731 return NULL; |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 } else if (ePacketID == XFA_XDPPACKET_ConnectionSet) { | 734 } else if (ePacketID == XFA_XDPPACKET_ConnectionSet) { |
| 735 if (XFA_FDEExtension_MatchNodeName( | 735 if (XFA_FDEExtension_MatchNodeName( |
| 736 pXMLDocumentNode, | 736 pXMLDocumentNode, |
| 737 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName, | 737 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName, |
| 738 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pURI, | 738 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pURI, |
| 739 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->eFlags)) { | 739 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->eFlags)) { |
| 740 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_ConnectionSet, | 740 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_ConnectionSet, |
| 741 XFA_ELEMENT_ConnectionSet); | 741 XFA_Element::ConnectionSet); |
| 742 if (!pNode) { | 742 if (!pNode) { |
| 743 return NULL; | 743 return NULL; |
| 744 } | 744 } |
| 745 pNode->SetCData(XFA_ATTRIBUTE_Name, | 745 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 746 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName); | 746 XFA_GetPacketByIndex(XFA_PACKET_ConnectionSet)->pName); |
| 747 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { | 747 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { |
| 748 return NULL; | 748 return NULL; |
| 749 } | 749 } |
| 750 } | 750 } |
| 751 } else if (ePacketID == XFA_XDPPACKET_SourceSet) { | 751 } else if (ePacketID == XFA_XDPPACKET_SourceSet) { |
| 752 if (XFA_FDEExtension_MatchNodeName( | 752 if (XFA_FDEExtension_MatchNodeName( |
| 753 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName, | 753 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName, |
| 754 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pURI, | 754 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pURI, |
| 755 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->eFlags)) { | 755 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->eFlags)) { |
| 756 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_SourceSet, | 756 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_SourceSet, |
| 757 XFA_ELEMENT_SourceSet); | 757 XFA_Element::SourceSet); |
| 758 if (!pNode) { | 758 if (!pNode) { |
| 759 return NULL; | 759 return NULL; |
| 760 } | 760 } |
| 761 pNode->SetCData(XFA_ATTRIBUTE_Name, | 761 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 762 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName); | 762 XFA_GetPacketByIndex(XFA_PACKET_SourceSet)->pName); |
| 763 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { | 763 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { |
| 764 return NULL; | 764 return NULL; |
| 765 } | 765 } |
| 766 } | 766 } |
| 767 } | 767 } |
| 768 if (pNode) { | 768 if (pNode) { |
| 769 pNode->SetXMLMappingNode(pXMLDocumentNode); | 769 pNode->SetXMLMappingNode(pXMLDocumentNode); |
| 770 } | 770 } |
| 771 return pNode; | 771 return pNode; |
| 772 } | 772 } |
| 773 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( | 773 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( |
| 774 CFDE_XMLNode* pXMLDocumentNode, | 774 CFDE_XMLNode* pXMLDocumentNode, |
| 775 XFA_XDPPACKET ePacketID) { | 775 XFA_XDPPACKET ePacketID) { |
| 776 if (XFA_FDEExtension_MatchNodeName( | 776 if (XFA_FDEExtension_MatchNodeName( |
| 777 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName, | 777 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName, |
| 778 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pURI, | 778 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pURI, |
| 779 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->eFlags)) { | 779 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->eFlags)) { |
| 780 CXFA_Node* pNode = | 780 CXFA_Node* pNode = |
| 781 m_pFactory->CreateNode(XFA_XDPPACKET_Xdc, XFA_ELEMENT_Xdc); | 781 m_pFactory->CreateNode(XFA_XDPPACKET_Xdc, XFA_Element::Xdc); |
| 782 if (!pNode) { | 782 if (!pNode) { |
| 783 return NULL; | 783 return NULL; |
| 784 } | 784 } |
| 785 pNode->SetCData(XFA_ATTRIBUTE_Name, | 785 pNode->SetCData(XFA_ATTRIBUTE_Name, |
| 786 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName); | 786 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName); |
| 787 pNode->SetXMLMappingNode(pXMLDocumentNode); | 787 pNode->SetXMLMappingNode(pXMLDocumentNode); |
| 788 return pNode; | 788 return pNode; |
| 789 } | 789 } |
| 790 return NULL; | 790 return NULL; |
| 791 } | 791 } |
| 792 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( | 792 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( |
| 793 CFDE_XMLNode* pXMLDocumentNode, | 793 CFDE_XMLNode* pXMLDocumentNode, |
| 794 XFA_XDPPACKET ePacketID) { | 794 XFA_XDPPACKET ePacketID) { |
| 795 CXFA_Node* pNode = | 795 CXFA_Node* pNode = |
| 796 m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_ELEMENT_Packet); | 796 m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Packet); |
| 797 if (!pNode) { | 797 if (!pNode) { |
| 798 return NULL; | 798 return NULL; |
| 799 } | 799 } |
| 800 CFX_WideString wsName; | 800 CFX_WideString wsName; |
| 801 static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(wsName); | 801 static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(wsName); |
| 802 pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); | 802 pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); |
| 803 if (!UserPacketLoader(pNode, pXMLDocumentNode)) { | 803 if (!UserPacketLoader(pNode, pXMLDocumentNode)) { |
| 804 return NULL; | 804 return NULL; |
| 805 } | 805 } |
| 806 pNode->SetXMLMappingNode(pXMLDocumentNode); | 806 pNode->SetXMLMappingNode(pXMLDocumentNode); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 if (!lpAttrInfo) { | 874 if (!lpAttrInfo) { |
| 875 continue; | 875 continue; |
| 876 } | 876 } |
| 877 if (!bUseAttribute && lpAttrInfo->eName != XFA_ATTRIBUTE_Name && | 877 if (!bUseAttribute && lpAttrInfo->eName != XFA_ATTRIBUTE_Name && |
| 878 lpAttrInfo->eName != XFA_ATTRIBUTE_Save) { | 878 lpAttrInfo->eName != XFA_ATTRIBUTE_Save) { |
| 879 continue; | 879 continue; |
| 880 } | 880 } |
| 881 pXFAChild->SetAttribute(lpAttrInfo->eName, wsAttrValue.AsStringC()); | 881 pXFAChild->SetAttribute(lpAttrInfo->eName, wsAttrValue.AsStringC()); |
| 882 } | 882 } |
| 883 pXFANode->InsertChild(pXFAChild); | 883 pXFANode->InsertChild(pXFAChild); |
| 884 if (pElemInfo->eName == XFA_ELEMENT_Validate || | 884 if (pElemInfo->eName == XFA_Element::Validate || |
| 885 pElemInfo->eName == XFA_ELEMENT_Locale) { | 885 pElemInfo->eName == XFA_Element::Locale) { |
| 886 if (ePacketID == XFA_XDPPACKET_Config) { | 886 if (ePacketID == XFA_XDPPACKET_Config) { |
| 887 ParseContentNode(pXFAChild, pXMLElement, ePacketID); | 887 ParseContentNode(pXFAChild, pXMLElement, ePacketID); |
| 888 } else { | 888 } else { |
| 889 NormalLoader(pXFAChild, pXMLElement, ePacketID, bUseAttribute); | 889 NormalLoader(pXFAChild, pXMLElement, ePacketID, bUseAttribute); |
| 890 } | 890 } |
| 891 break; | 891 break; |
| 892 } | 892 } |
| 893 switch (pXFAChild->GetObjectType()) { | 893 switch (pXFAChild->GetObjectType()) { |
| 894 case XFA_ObjectType::ContentNode: | 894 case XFA_ObjectType::ContentNode: |
| 895 case XFA_ObjectType::TextNode: | 895 case XFA_ObjectType::TextNode: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 default: | 972 default: |
| 973 ASSERT(FALSE); | 973 ASSERT(FALSE); |
| 974 break; | 974 break; |
| 975 } | 975 } |
| 976 } | 976 } |
| 977 } | 977 } |
| 978 | 978 |
| 979 void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, | 979 void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, |
| 980 CFDE_XMLNode* pXMLNode, | 980 CFDE_XMLNode* pXMLNode, |
| 981 XFA_XDPPACKET ePacketID) { | 981 XFA_XDPPACKET ePacketID) { |
| 982 XFA_ELEMENT element = XFA_ELEMENT_Sharptext; | 982 XFA_Element element = XFA_Element::Sharptext; |
| 983 if (pXFANode->GetClassID() == XFA_ELEMENT_ExData) { | 983 if (pXFANode->GetClassID() == XFA_Element::ExData) { |
| 984 CFX_WideStringC wsContentType = | 984 CFX_WideStringC wsContentType = |
| 985 pXFANode->GetCData(XFA_ATTRIBUTE_ContentType); | 985 pXFANode->GetCData(XFA_ATTRIBUTE_ContentType); |
| 986 if (wsContentType == FX_WSTRC(L"text/html")) | 986 if (wsContentType == FX_WSTRC(L"text/html")) |
| 987 element = XFA_ELEMENT_SharpxHTML; | 987 element = XFA_Element::SharpxHTML; |
| 988 else if (wsContentType == FX_WSTRC(L"text/xml")) | 988 else if (wsContentType == FX_WSTRC(L"text/xml")) |
| 989 element = XFA_ELEMENT_Sharpxml; | 989 element = XFA_Element::Sharpxml; |
| 990 } | 990 } |
| 991 if (element == XFA_ELEMENT_SharpxHTML) | 991 if (element == XFA_Element::SharpxHTML) |
| 992 pXFANode->SetXMLMappingNode(pXMLNode); | 992 pXFANode->SetXMLMappingNode(pXMLNode); |
| 993 | 993 |
| 994 CFX_WideString wsValue; | 994 CFX_WideString wsValue; |
| 995 for (CFDE_XMLNode* pXMLChild = | 995 for (CFDE_XMLNode* pXMLChild = |
| 996 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); | 996 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); |
| 997 pXMLChild; | 997 pXMLChild; |
| 998 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 998 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
| 999 FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); | 999 FDE_XMLNODETYPE eNodeType = pXMLChild->GetType(); |
| 1000 if (eNodeType == FDE_XMLNODE_Instruction) | 1000 if (eNodeType == FDE_XMLNODE_Instruction) |
| 1001 continue; | 1001 continue; |
| 1002 | 1002 |
| 1003 if (element == XFA_ELEMENT_SharpxHTML) { | 1003 if (element == XFA_Element::SharpxHTML) { |
| 1004 if (eNodeType != FDE_XMLNODE_Element) | 1004 if (eNodeType != FDE_XMLNODE_Element) |
| 1005 break; | 1005 break; |
| 1006 | 1006 |
| 1007 if (XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLChild))) | 1007 if (XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLChild))) |
| 1008 XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild), | 1008 XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild), |
| 1009 wsValue); | 1009 wsValue); |
| 1010 } else if (element == XFA_ELEMENT_Sharpxml) { | 1010 } else if (element == XFA_Element::Sharpxml) { |
| 1011 if (eNodeType != FDE_XMLNODE_Element) | 1011 if (eNodeType != FDE_XMLNODE_Element) |
| 1012 break; | 1012 break; |
| 1013 XFA_ConvertXMLToPlainText(static_cast<CFDE_XMLElement*>(pXMLChild), | 1013 XFA_ConvertXMLToPlainText(static_cast<CFDE_XMLElement*>(pXMLChild), |
| 1014 wsValue); | 1014 wsValue); |
| 1015 } else { | 1015 } else { |
| 1016 if (eNodeType == FDE_XMLNODE_Element) | 1016 if (eNodeType == FDE_XMLNODE_Element) |
| 1017 break; | 1017 break; |
| 1018 if (eNodeType == FDE_XMLNODE_Text) | 1018 if (eNodeType == FDE_XMLNODE_Text) |
| 1019 static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsValue); | 1019 static_cast<CFDE_XMLText*>(pXMLChild)->GetText(wsValue); |
| 1020 else if (eNodeType == FDE_XMLNODE_CharData) | 1020 else if (eNodeType == FDE_XMLNODE_CharData) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 wsNamespaceURI == | 1054 wsNamespaceURI == |
| 1055 FX_WSTRC(L"http://www.xfa.org/schema/xfa-package/") || | 1055 FX_WSTRC(L"http://www.xfa.org/schema/xfa-package/") || |
| 1056 wsNamespaceURI == | 1056 wsNamespaceURI == |
| 1057 FX_WSTRC(L"http://www.w3.org/2001/XMLSchema-instance")) { | 1057 FX_WSTRC(L"http://www.w3.org/2001/XMLSchema-instance")) { |
| 1058 continue; | 1058 continue; |
| 1059 } | 1059 } |
| 1060 if (0) { | 1060 if (0) { |
| 1061 continue; | 1061 continue; |
| 1062 } | 1062 } |
| 1063 } | 1063 } |
| 1064 XFA_ELEMENT eNodeType = XFA_ELEMENT_DataModel; | 1064 XFA_Element eNodeType = XFA_Element::DataModel; |
| 1065 if (eNodeType == XFA_ELEMENT_DataModel) { | 1065 if (eNodeType == XFA_Element::DataModel) { |
| 1066 CFX_WideString wsDataNodeAttr; | 1066 CFX_WideString wsDataNodeAttr; |
| 1067 if (XFA_FDEExtension_FindAttributeWithNS( | 1067 if (XFA_FDEExtension_FindAttributeWithNS( |
| 1068 pXMLElement, FX_WSTRC(L"dataNode"), | 1068 pXMLElement, FX_WSTRC(L"dataNode"), |
| 1069 FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/"), | 1069 FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/"), |
| 1070 wsDataNodeAttr)) { | 1070 wsDataNodeAttr)) { |
| 1071 if (wsDataNodeAttr == FX_WSTRC(L"dataGroup")) { | 1071 if (wsDataNodeAttr == FX_WSTRC(L"dataGroup")) { |
| 1072 eNodeType = XFA_ELEMENT_DataGroup; | 1072 eNodeType = XFA_Element::DataGroup; |
| 1073 } else if (wsDataNodeAttr == FX_WSTRC(L"dataValue")) { | 1073 } else if (wsDataNodeAttr == FX_WSTRC(L"dataValue")) { |
| 1074 eNodeType = XFA_ELEMENT_DataValue; | 1074 eNodeType = XFA_Element::DataValue; |
| 1075 } | 1075 } |
| 1076 } | 1076 } |
| 1077 } | 1077 } |
| 1078 CFX_WideString wsContentType; | 1078 CFX_WideString wsContentType; |
| 1079 if (eNodeType == XFA_ELEMENT_DataModel) { | 1079 if (eNodeType == XFA_Element::DataModel) { |
| 1080 if (XFA_FDEExtension_FindAttributeWithNS( | 1080 if (XFA_FDEExtension_FindAttributeWithNS( |
| 1081 pXMLElement, FX_WSTRC(L"contentType"), | 1081 pXMLElement, FX_WSTRC(L"contentType"), |
| 1082 FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/"), | 1082 FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/"), |
| 1083 wsContentType)) { | 1083 wsContentType)) { |
| 1084 if (!wsContentType.IsEmpty()) { | 1084 if (!wsContentType.IsEmpty()) { |
| 1085 eNodeType = XFA_ELEMENT_DataValue; | 1085 eNodeType = XFA_Element::DataValue; |
| 1086 } | 1086 } |
| 1087 } | 1087 } |
| 1088 } | 1088 } |
| 1089 if (eNodeType == XFA_ELEMENT_DataModel) { | 1089 if (eNodeType == XFA_Element::DataModel) { |
| 1090 for (CFDE_XMLNode* pXMLDataChild = | 1090 for (CFDE_XMLNode* pXMLDataChild = |
| 1091 pXMLElement->GetNodeItem(CFDE_XMLNode::FirstChild); | 1091 pXMLElement->GetNodeItem(CFDE_XMLNode::FirstChild); |
| 1092 pXMLDataChild; pXMLDataChild = pXMLDataChild->GetNodeItem( | 1092 pXMLDataChild; pXMLDataChild = pXMLDataChild->GetNodeItem( |
| 1093 CFDE_XMLNode::NextSibling)) { | 1093 CFDE_XMLNode::NextSibling)) { |
| 1094 if (pXMLDataChild->GetType() == FDE_XMLNODE_Element) { | 1094 if (pXMLDataChild->GetType() == FDE_XMLNODE_Element) { |
| 1095 if (!XFA_RecognizeRichText( | 1095 if (!XFA_RecognizeRichText( |
| 1096 static_cast<CFDE_XMLElement*>(pXMLDataChild))) { | 1096 static_cast<CFDE_XMLElement*>(pXMLDataChild))) { |
| 1097 eNodeType = XFA_ELEMENT_DataGroup; | 1097 eNodeType = XFA_Element::DataGroup; |
| 1098 break; | 1098 break; |
| 1099 } | 1099 } |
| 1100 } | 1100 } |
| 1101 } | 1101 } |
| 1102 } | 1102 } |
| 1103 if (eNodeType == XFA_ELEMENT_DataModel) { | 1103 if (eNodeType == XFA_Element::DataModel) { |
| 1104 eNodeType = XFA_ELEMENT_DataValue; | 1104 eNodeType = XFA_Element::DataValue; |
| 1105 } | 1105 } |
| 1106 CXFA_Node* pXFAChild = | 1106 CXFA_Node* pXFAChild = |
| 1107 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, eNodeType); | 1107 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, eNodeType); |
| 1108 if (pXFAChild == NULL) { | 1108 if (pXFAChild == NULL) { |
| 1109 return; | 1109 return; |
| 1110 } | 1110 } |
| 1111 CFX_WideString wsNodeName; | 1111 CFX_WideString wsNodeName; |
| 1112 pXMLElement->GetLocalTagName(wsNodeName); | 1112 pXMLElement->GetLocalTagName(wsNodeName); |
| 1113 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeName); | 1113 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeName); |
| 1114 FX_BOOL bNeedValue = TRUE; | 1114 FX_BOOL bNeedValue = TRUE; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1137 wsAttrNamespaceURI == | 1137 wsAttrNamespaceURI == |
| 1138 FX_WSTRC(L"http://www.w3.org/2001/XMLSchema-instance") || | 1138 FX_WSTRC(L"http://www.w3.org/2001/XMLSchema-instance") || |
| 1139 wsAttrNamespaceURI == | 1139 wsAttrNamespaceURI == |
| 1140 FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/")) { | 1140 FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/")) { |
| 1141 continue; | 1141 continue; |
| 1142 } | 1142 } |
| 1143 if (0) { | 1143 if (0) { |
| 1144 continue; | 1144 continue; |
| 1145 } | 1145 } |
| 1146 CXFA_Node* pXFAMetaData = m_pFactory->CreateNode( | 1146 CXFA_Node* pXFAMetaData = m_pFactory->CreateNode( |
| 1147 XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataValue); | 1147 XFA_XDPPACKET_Datasets, XFA_Element::DataValue); |
| 1148 if (pXFAMetaData == NULL) { | 1148 if (pXFAMetaData == NULL) { |
| 1149 return; | 1149 return; |
| 1150 } | 1150 } |
| 1151 pXFAMetaData->SetCData(XFA_ATTRIBUTE_Name, wsAttrName); | 1151 pXFAMetaData->SetCData(XFA_ATTRIBUTE_Name, wsAttrName); |
| 1152 pXFAMetaData->SetCData(XFA_ATTRIBUTE_QualifiedName, | 1152 pXFAMetaData->SetCData(XFA_ATTRIBUTE_QualifiedName, |
| 1153 wsAttrQualifiedName); | 1153 wsAttrQualifiedName); |
| 1154 pXFAMetaData->SetCData(XFA_ATTRIBUTE_Value, wsAttrValue); | 1154 pXFAMetaData->SetCData(XFA_ATTRIBUTE_Value, wsAttrValue); |
| 1155 pXFAMetaData->SetEnum(XFA_ATTRIBUTE_Contains, | 1155 pXFAMetaData->SetEnum(XFA_ATTRIBUTE_Contains, |
| 1156 XFA_ATTRIBUTEENUM_MetaData); | 1156 XFA_ATTRIBUTEENUM_MetaData); |
| 1157 pXFAChild->InsertChild(pXFAMetaData); | 1157 pXFAChild->InsertChild(pXFAMetaData); |
| 1158 pXFAMetaData->SetXMLMappingNode(pXMLElement); | 1158 pXFAMetaData->SetXMLMappingNode(pXMLElement); |
| 1159 pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized, false); | 1159 pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized, false); |
| 1160 } | 1160 } |
| 1161 if (!bNeedValue) { | 1161 if (!bNeedValue) { |
| 1162 CFX_WideString wsNilName(L"xsi:nil"); | 1162 CFX_WideString wsNilName(L"xsi:nil"); |
| 1163 pXMLElement->RemoveAttribute(wsNilName.c_str()); | 1163 pXMLElement->RemoveAttribute(wsNilName.c_str()); |
| 1164 } | 1164 } |
| 1165 } | 1165 } |
| 1166 pXFANode->InsertChild(pXFAChild); | 1166 pXFANode->InsertChild(pXFAChild); |
| 1167 if (eNodeType == XFA_ELEMENT_DataGroup) { | 1167 if (eNodeType == XFA_Element::DataGroup) { |
| 1168 ParseDataGroup(pXFAChild, pXMLElement, ePacketID); | 1168 ParseDataGroup(pXFAChild, pXMLElement, ePacketID); |
| 1169 } else { | 1169 } else { |
| 1170 if (bNeedValue) { | 1170 if (bNeedValue) { |
| 1171 ParseDataValue(pXFAChild, pXMLChild, XFA_XDPPACKET_Datasets); | 1171 ParseDataValue(pXFAChild, pXMLChild, XFA_XDPPACKET_Datasets); |
| 1172 } | 1172 } |
| 1173 } | 1173 } |
| 1174 pXFAChild->SetXMLMappingNode(pXMLElement); | 1174 pXFAChild->SetXMLMappingNode(pXMLElement); |
| 1175 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); | 1175 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); |
| 1176 } | 1176 } |
| 1177 continue; | 1177 continue; |
| 1178 case FDE_XMLNODE_CharData: { | 1178 case FDE_XMLNODE_CharData: { |
| 1179 CFDE_XMLCharData* pXMLCharData = | 1179 CFDE_XMLCharData* pXMLCharData = |
| 1180 static_cast<CFDE_XMLCharData*>(pXMLChild); | 1180 static_cast<CFDE_XMLCharData*>(pXMLChild); |
| 1181 CFX_WideString wsCharData; | 1181 CFX_WideString wsCharData; |
| 1182 pXMLCharData->GetCharData(wsCharData); | 1182 pXMLCharData->GetCharData(wsCharData); |
| 1183 if (XFA_FDEExtension_IsStringAllWhitespace(wsCharData)) { | 1183 if (XFA_FDEExtension_IsStringAllWhitespace(wsCharData)) { |
| 1184 continue; | 1184 continue; |
| 1185 } | 1185 } |
| 1186 CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, | 1186 CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, |
| 1187 XFA_ELEMENT_DataValue); | 1187 XFA_Element::DataValue); |
| 1188 if (pXFAChild == NULL) { | 1188 if (pXFAChild == NULL) { |
| 1189 return; | 1189 return; |
| 1190 } | 1190 } |
| 1191 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCharData); | 1191 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCharData); |
| 1192 pXFANode->InsertChild(pXFAChild); | 1192 pXFANode->InsertChild(pXFAChild); |
| 1193 pXFAChild->SetXMLMappingNode(pXMLCharData); | 1193 pXFAChild->SetXMLMappingNode(pXMLCharData); |
| 1194 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); | 1194 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); |
| 1195 } | 1195 } |
| 1196 continue; | 1196 continue; |
| 1197 case FDE_XMLNODE_Text: { | 1197 case FDE_XMLNODE_Text: { |
| 1198 CFDE_XMLText* pXMLText = static_cast<CFDE_XMLText*>(pXMLChild); | 1198 CFDE_XMLText* pXMLText = static_cast<CFDE_XMLText*>(pXMLChild); |
| 1199 CFX_WideString wsText; | 1199 CFX_WideString wsText; |
| 1200 pXMLText->GetText(wsText); | 1200 pXMLText->GetText(wsText); |
| 1201 if (XFA_FDEExtension_IsStringAllWhitespace(wsText)) { | 1201 if (XFA_FDEExtension_IsStringAllWhitespace(wsText)) { |
| 1202 continue; | 1202 continue; |
| 1203 } | 1203 } |
| 1204 CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, | 1204 CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, |
| 1205 XFA_ELEMENT_DataValue); | 1205 XFA_Element::DataValue); |
| 1206 if (pXFAChild == NULL) { | 1206 if (pXFAChild == NULL) { |
| 1207 return; | 1207 return; |
| 1208 } | 1208 } |
| 1209 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsText); | 1209 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsText); |
| 1210 pXFANode->InsertChild(pXFAChild); | 1210 pXFANode->InsertChild(pXFAChild); |
| 1211 pXFAChild->SetXMLMappingNode(pXMLText); | 1211 pXFAChild->SetXMLMappingNode(pXMLText); |
| 1212 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); | 1212 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); |
| 1213 } | 1213 } |
| 1214 continue; | 1214 continue; |
| 1215 case FDE_XMLNODE_Instruction: | 1215 case FDE_XMLNODE_Instruction: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 if (!pXMLCurValueNode) | 1255 if (!pXMLCurValueNode) |
| 1256 pXMLCurValueNode = pXMLChild; | 1256 pXMLCurValueNode = pXMLChild; |
| 1257 | 1257 |
| 1258 wsCurValueTextBuf << wsText; | 1258 wsCurValueTextBuf << wsText; |
| 1259 } else { | 1259 } else { |
| 1260 bMarkAsCompound = TRUE; | 1260 bMarkAsCompound = TRUE; |
| 1261 if (pXMLCurValueNode) { | 1261 if (pXMLCurValueNode) { |
| 1262 CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); | 1262 CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); |
| 1263 if (!wsCurValue.IsEmpty()) { | 1263 if (!wsCurValue.IsEmpty()) { |
| 1264 CXFA_Node* pXFAChild = | 1264 CXFA_Node* pXFAChild = |
| 1265 m_pFactory->CreateNode(ePacketID, XFA_ELEMENT_DataValue); | 1265 m_pFactory->CreateNode(ePacketID, XFA_Element::DataValue); |
| 1266 if (!pXFAChild) | 1266 if (!pXFAChild) |
| 1267 return; | 1267 return; |
| 1268 | 1268 |
| 1269 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, L""); | 1269 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, L""); |
| 1270 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue); | 1270 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue); |
| 1271 pXFANode->InsertChild(pXFAChild); | 1271 pXFANode->InsertChild(pXFAChild); |
| 1272 pXFAChild->SetXMLMappingNode(pXMLCurValueNode); | 1272 pXFAChild->SetXMLMappingNode(pXMLCurValueNode); |
| 1273 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); | 1273 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); |
| 1274 wsValueTextBuf << wsCurValue; | 1274 wsValueTextBuf << wsCurValue; |
| 1275 wsCurValueTextBuf.Clear(); | 1275 wsCurValueTextBuf.Clear(); |
| 1276 } | 1276 } |
| 1277 pXMLCurValueNode = nullptr; | 1277 pXMLCurValueNode = nullptr; |
| 1278 } | 1278 } |
| 1279 CXFA_Node* pXFAChild = | 1279 CXFA_Node* pXFAChild = |
| 1280 m_pFactory->CreateNode(ePacketID, XFA_ELEMENT_DataValue); | 1280 m_pFactory->CreateNode(ePacketID, XFA_Element::DataValue); |
| 1281 if (!pXFAChild) | 1281 if (!pXFAChild) |
| 1282 return; | 1282 return; |
| 1283 | 1283 |
| 1284 CFX_WideString wsNodeStr; | 1284 CFX_WideString wsNodeStr; |
| 1285 static_cast<CFDE_XMLElement*>(pXMLChild)->GetLocalTagName(wsNodeStr); | 1285 static_cast<CFDE_XMLElement*>(pXMLChild)->GetLocalTagName(wsNodeStr); |
| 1286 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); | 1286 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr); |
| 1287 ParseDataValue(pXFAChild, pXMLChild, ePacketID); | 1287 ParseDataValue(pXFAChild, pXMLChild, ePacketID); |
| 1288 pXFANode->InsertChild(pXFAChild); | 1288 pXFANode->InsertChild(pXFAChild); |
| 1289 pXFAChild->SetXMLMappingNode(pXMLChild); | 1289 pXFAChild->SetXMLMappingNode(pXMLChild); |
| 1290 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); | 1290 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); |
| 1291 CFX_WideStringC wsCurValue = pXFAChild->GetCData(XFA_ATTRIBUTE_Value); | 1291 CFX_WideStringC wsCurValue = pXFAChild->GetCData(XFA_ATTRIBUTE_Value); |
| 1292 wsValueTextBuf << wsCurValue; | 1292 wsValueTextBuf << wsCurValue; |
| 1293 } | 1293 } |
| 1294 } | 1294 } |
| 1295 if (pXMLCurValueNode) { | 1295 if (pXMLCurValueNode) { |
| 1296 CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); | 1296 CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); |
| 1297 if (!wsCurValue.IsEmpty()) { | 1297 if (!wsCurValue.IsEmpty()) { |
| 1298 if (bMarkAsCompound) { | 1298 if (bMarkAsCompound) { |
| 1299 CXFA_Node* pXFAChild = | 1299 CXFA_Node* pXFAChild = |
| 1300 m_pFactory->CreateNode(ePacketID, XFA_ELEMENT_DataValue); | 1300 m_pFactory->CreateNode(ePacketID, XFA_Element::DataValue); |
| 1301 if (!pXFAChild) | 1301 if (!pXFAChild) |
| 1302 return; | 1302 return; |
| 1303 | 1303 |
| 1304 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, L""); | 1304 pXFAChild->SetCData(XFA_ATTRIBUTE_Name, L""); |
| 1305 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue); | 1305 pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue); |
| 1306 pXFANode->InsertChild(pXFAChild); | 1306 pXFANode->InsertChild(pXFAChild); |
| 1307 pXFAChild->SetXMLMappingNode(pXMLCurValueNode); | 1307 pXFAChild->SetXMLMappingNode(pXMLCurValueNode); |
| 1308 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); | 1308 pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); |
| 1309 } | 1309 } |
| 1310 wsValueTextBuf << wsCurValue; | 1310 wsValueTextBuf << wsCurValue; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 } | 1598 } |
| 1599 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { | 1599 if (pPause && iCount > 500 && pPause->NeedToPauseNow()) { |
| 1600 break; | 1600 break; |
| 1601 } | 1601 } |
| 1602 } | 1602 } |
| 1603 return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error || | 1603 return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error || |
| 1604 m_NodeStack.GetSize() != 1) | 1604 m_NodeStack.GetSize() != 1) |
| 1605 ? -1 | 1605 ? -1 |
| 1606 : m_pParser->GetStatus(); | 1606 : m_pParser->GetStatus(); |
| 1607 } | 1607 } |
| OLD | NEW |