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->GetElementType() == 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, |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 case FDE_XMLNODE_Element: { | 832 case FDE_XMLNODE_Element: { |
833 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); | 833 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild); |
834 CFX_WideString wsTagName; | 834 CFX_WideString wsTagName; |
835 pXMLElement->GetLocalTagName(wsTagName); | 835 pXMLElement->GetLocalTagName(wsTagName); |
836 const XFA_ELEMENTINFO* pElemInfo = | 836 const XFA_ELEMENTINFO* pElemInfo = |
837 XFA_GetElementByName(wsTagName.AsStringC()); | 837 XFA_GetElementByName(wsTagName.AsStringC()); |
838 if (!pElemInfo) { | 838 if (!pElemInfo) { |
839 continue; | 839 continue; |
840 } | 840 } |
841 const XFA_PROPERTY* pPropertyInfo = XFA_GetPropertyOfElement( | 841 const XFA_PROPERTY* pPropertyInfo = XFA_GetPropertyOfElement( |
842 pXFANode->GetClassID(), pElemInfo->eName, ePacketID); | 842 pXFANode->GetElementType(), pElemInfo->eName, ePacketID); |
843 if (pPropertyInfo && | 843 if (pPropertyInfo && |
844 ((pPropertyInfo->uFlags & | 844 ((pPropertyInfo->uFlags & |
845 (XFA_PROPERTYFLAG_OneOf | XFA_PROPERTYFLAG_DefaultOneOf)) != 0)) { | 845 (XFA_PROPERTYFLAG_OneOf | XFA_PROPERTYFLAG_DefaultOneOf)) != 0)) { |
846 if (bOneOfPropertyFound) { | 846 if (bOneOfPropertyFound) { |
847 break; | 847 break; |
848 } | 848 } |
849 bOneOfPropertyFound = TRUE; | 849 bOneOfPropertyFound = TRUE; |
850 } | 850 } |
851 CXFA_Node* pXFAChild = | 851 CXFA_Node* pXFAChild = |
852 m_pFactory->CreateNode(ePacketID, pElemInfo->eName); | 852 m_pFactory->CreateNode(ePacketID, pElemInfo->eName); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->GetElementType() == 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 |
(...skipping 604 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 |