Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: xfa/fxfa/parser/cxfa_simple_parser.cpp

Issue 2131653002: Cleanup ownership of parser members (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@parser_split
Patch Set: Rebase to master Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_simple_parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "xfa/fgas/crt/fgas_codepage.h" 9 #include "xfa/fgas/crt/fgas_codepage.h"
10 #include "xfa/fxfa/include/fxfa.h" 10 #include "xfa/fxfa/include/fxfa.h"
11 #include "xfa/fxfa/include/xfa_checksum.h" 11 #include "xfa/fxfa/include/xfa_checksum.h"
12 #include "xfa/fxfa/parser/cxfa_xml_parser.h" 12 #include "xfa/fxfa/parser/cxfa_xml_parser.h"
13 #include "xfa/fxfa/parser/xfa_document.h" 13 #include "xfa/fxfa/parser/xfa_document.h"
14 14
15 CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, 15 CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory,
16 bool bDocumentParser) 16 bool bDocumentParser)
17 : m_pXMLParser(nullptr), 17 : m_pXMLParser(nullptr),
18 m_pXMLDoc(nullptr), 18 m_pXMLDoc(nullptr),
19 m_pStream(nullptr), 19 m_pStream(nullptr),
20 m_pFileRead(nullptr), 20 m_pFileRead(nullptr),
21 m_pFactory(pFactory), 21 m_pFactory(pFactory),
22 m_pRootNode(nullptr), 22 m_pRootNode(nullptr),
23 m_ePacketID(XFA_XDPPACKET_UNKNOWN), 23 m_ePacketID(XFA_XDPPACKET_UNKNOWN),
24 m_bDocumentParser(bDocumentParser) {} 24 m_bDocumentParser(bDocumentParser) {}
25 25
26 CXFA_SimpleParser::~CXFA_SimpleParser() { 26 CXFA_SimpleParser::~CXFA_SimpleParser() {
27 CloseParser();
28 } 27 }
29 28
30 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { 29 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) {
31 m_pFactory = pFactory; 30 m_pFactory = pFactory;
32 } 31 }
33 32
34 static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode( 33 static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode(
35 CFDE_XMLDoc* pXMLDoc, 34 CFDE_XMLDoc* pXMLDoc,
36 FX_BOOL bVerifyWellFormness = FALSE) { 35 FX_BOOL bVerifyWellFormness = FALSE) {
37 if (!pXMLDoc) { 36 if (!pXMLDoc) {
(...skipping 12 matching lines...) Expand all
50 if (pNextNode->GetType() == FDE_XMLNODE_Element) { 49 if (pNextNode->GetType() == FDE_XMLNODE_Element) {
51 return FALSE; 50 return FALSE;
52 } 51 }
53 } 52 }
54 } 53 }
55 return pXMLNode; 54 return pXMLNode;
56 } 55 }
57 } 56 }
58 return nullptr; 57 return nullptr;
59 } 58 }
59
60 int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, 60 int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream,
61 XFA_XDPPACKET ePacketID) { 61 XFA_XDPPACKET ePacketID) {
62 CloseParser(); 62 CloseParser();
63 m_pFileRead = pStream; 63 m_pFileRead = pStream;
64 m_pStream = IFX_Stream::CreateStream( 64 m_pStream.reset(IFX_Stream::CreateStream(
65 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text); 65 pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text));
66 if (!m_pStream) { 66 if (!m_pStream)
67 return XFA_PARSESTATUS_StreamErr; 67 return XFA_PARSESTATUS_StreamErr;
68 } 68
69 uint16_t wCodePage = m_pStream->GetCodePage(); 69 uint16_t wCodePage = m_pStream->GetCodePage();
70 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE && 70 if (wCodePage != FX_CODEPAGE_UTF16LE && wCodePage != FX_CODEPAGE_UTF16BE &&
71 wCodePage != FX_CODEPAGE_UTF8) { 71 wCodePage != FX_CODEPAGE_UTF8) {
72 m_pStream->SetCodePage(FX_CODEPAGE_UTF8); 72 m_pStream->SetCodePage(FX_CODEPAGE_UTF8);
73 } 73 }
74 m_pXMLDoc = new CFDE_XMLDoc; 74 m_pXMLDoc.reset(new CFDE_XMLDoc);
75 m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream); 75 m_pXMLParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream.get());
76 if (!m_pXMLDoc->LoadXML(m_pXMLParser)) { 76 if (!m_pXMLDoc->LoadXML(m_pXMLParser))
77 return XFA_PARSESTATUS_StatusErr; 77 return XFA_PARSESTATUS_StatusErr;
78 } 78
79 m_ePacketID = ePacketID; 79 m_ePacketID = ePacketID;
80 return XFA_PARSESTATUS_Ready; 80 return XFA_PARSESTATUS_Ready;
81 } 81 }
82
82 int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) { 83 int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) {
83 if (!m_pXMLDoc || m_ePacketID == XFA_XDPPACKET_UNKNOWN) { 84 if (!m_pXMLDoc || m_ePacketID == XFA_XDPPACKET_UNKNOWN)
84 return XFA_PARSESTATUS_StatusErr; 85 return XFA_PARSESTATUS_StatusErr;
85 } 86
86 int32_t iRet = m_pXMLDoc->DoLoad(pPause); 87 int32_t iRet = m_pXMLDoc->DoLoad(pPause);
87 if (iRet < 0) { 88 if (iRet < 0)
88 return XFA_PARSESTATUS_SyntaxErr; 89 return XFA_PARSESTATUS_SyntaxErr;
89 } 90 if (iRet < 100)
90 if (iRet < 100) {
91 return iRet / 2; 91 return iRet / 2;
92 } 92
93 m_pRootNode = ParseAsXDPPacket(XFA_FDEExtension_GetDocumentNode(m_pXMLDoc), 93 m_pRootNode = ParseAsXDPPacket(
94 m_ePacketID); 94 XFA_FDEExtension_GetDocumentNode(m_pXMLDoc.get()), m_ePacketID);
95 m_pXMLDoc->CloseXML(); 95 m_pXMLDoc->CloseXML();
96 if (m_pStream) { 96 m_pStream.reset();
97 m_pStream->Release(); 97
98 m_pStream = nullptr; 98 if (!m_pRootNode)
99 }
100 if (!m_pRootNode) {
101 return XFA_PARSESTATUS_StatusErr; 99 return XFA_PARSESTATUS_StatusErr;
102 }
103 return XFA_PARSESTATUS_Done; 100 return XFA_PARSESTATUS_Done;
104 } 101 }
102
105 int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML, 103 int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML,
106 CFDE_XMLNode*& pXMLNode, 104 CFDE_XMLNode*& pXMLNode,
107 IFX_Pause* pPause) { 105 IFX_Pause* pPause) {
108 CloseParser(); 106 CloseParser();
109 pXMLNode = nullptr; 107 pXMLNode = nullptr;
110 IFX_Stream* pStream = XFA_CreateWideTextRead(wsXML); 108
111 if (!pStream) { 109 std::unique_ptr<IFX_Stream> pStream(XFA_CreateWideTextRead(wsXML));
110 if (!pStream)
112 return XFA_PARSESTATUS_StreamErr; 111 return XFA_PARSESTATUS_StreamErr;
113 } 112
114 m_pStream = pStream; 113 m_pXMLDoc.reset(new CFDE_XMLDoc);
115 m_pXMLDoc = new CFDE_XMLDoc; 114 CXFA_XMLParser* pParser =
116 CXFA_XMLParser* pParser = new CXFA_XMLParser(m_pXMLDoc->GetRoot(), m_pStream); 115 new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream.get());
117 pParser->m_dwCheckStatus = 0x03; 116 pParser->m_dwCheckStatus = 0x03;
118 if (!m_pXMLDoc->LoadXML(pParser)) { 117 if (!m_pXMLDoc->LoadXML(pParser))
119 return XFA_PARSESTATUS_StatusErr; 118 return XFA_PARSESTATUS_StatusErr;
120 } 119
121 int32_t iRet = m_pXMLDoc->DoLoad(pPause); 120 int32_t iRet = m_pXMLDoc->DoLoad(pPause);
122 if (iRet < 0 || iRet >= 100) { 121 if (iRet < 0 || iRet >= 100)
123 m_pXMLDoc->CloseXML(); 122 m_pXMLDoc->CloseXML();
124 } 123 if (iRet < 0)
125 if (iRet < 0) {
126 return XFA_PARSESTATUS_SyntaxErr; 124 return XFA_PARSESTATUS_SyntaxErr;
127 } 125 if (iRet < 100)
128 if (iRet < 100) {
129 return iRet / 2; 126 return iRet / 2;
130 } 127
131 if (m_pStream) { 128 pXMLNode = XFA_FDEExtension_GetDocumentNode(m_pXMLDoc.get());
132 m_pStream->Release();
133 m_pStream = nullptr;
134 }
135 pXMLNode = XFA_FDEExtension_GetDocumentNode(m_pXMLDoc);
136 return XFA_PARSESTATUS_Done; 129 return XFA_PARSESTATUS_Done;
137 } 130 }
138 131
139 void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, 132 void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode,
140 CFDE_XMLNode* pXMLNode) { 133 CFDE_XMLNode* pXMLNode) {
141 XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID(); 134 XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID();
142 if (ePacketID == XFA_XDPPACKET_Datasets) { 135 if (ePacketID == XFA_XDPPACKET_Datasets) {
143 if (pXFANode->GetElementType() == XFA_Element::DataValue) { 136 if (pXFANode->GetElementType() == XFA_Element::DataValue) {
144 for (CFDE_XMLNode* pXMLChild = 137 for (CFDE_XMLNode* pXMLChild =
145 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); 138 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } else { 173 } else {
181 m_pRootNode = NormalLoader(pXFANode, pXMLNode, ePacketID); 174 m_pRootNode = NormalLoader(pXFANode, pXMLNode, ePacketID);
182 } 175 }
183 } 176 }
184 177
185 CXFA_Node* CXFA_SimpleParser::GetRootNode() const { 178 CXFA_Node* CXFA_SimpleParser::GetRootNode() const {
186 return m_pRootNode; 179 return m_pRootNode;
187 } 180 }
188 181
189 CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { 182 CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const {
190 return m_pXMLDoc; 183 return m_pXMLDoc.get();
191 } 184 }
192 185
193 FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( 186 FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier(
194 CFDE_XMLElement* pNode, 187 CFDE_XMLElement* pNode,
195 const CFX_WideStringC& wsQualifier, 188 const CFX_WideStringC& wsQualifier,
196 CFX_WideString& wsNamespaceURI) { 189 CFX_WideString& wsNamespaceURI) {
197 if (!pNode) { 190 if (!pNode) {
198 return FALSE; 191 return FALSE;
199 } 192 }
200 CFDE_XMLNode* pFakeRoot = pNode->GetNodeItem(CFDE_XMLNode::Root); 193 CFDE_XMLNode* pFakeRoot = pNode->GetNodeItem(CFDE_XMLNode::Root);
(...skipping 11 matching lines...) Expand all
212 continue; 205 continue;
213 } 206 }
214 if (pNode->HasAttribute(wsNSAttribute.c_str())) { 207 if (pNode->HasAttribute(wsNSAttribute.c_str())) {
215 pNode->GetString(wsNSAttribute.c_str(), wsNamespaceURI); 208 pNode->GetString(wsNSAttribute.c_str(), wsNamespaceURI);
216 return TRUE; 209 return TRUE;
217 } 210 }
218 } 211 }
219 wsNamespaceURI.clear(); 212 wsNamespaceURI.clear();
220 return bRet; 213 return bRet;
221 } 214 }
215
222 static inline void XFA_FDEExtension_GetElementTagNamespaceURI( 216 static inline void XFA_FDEExtension_GetElementTagNamespaceURI(
223 CFDE_XMLElement* pElement, 217 CFDE_XMLElement* pElement,
224 CFX_WideString& wsNamespaceURI) { 218 CFX_WideString& wsNamespaceURI) {
225 CFX_WideString wsNodeStr; 219 CFX_WideString wsNodeStr;
226 pElement->GetNamespacePrefix(wsNodeStr); 220 pElement->GetNamespacePrefix(wsNodeStr);
227 if (!XFA_FDEExtension_ResolveNamespaceQualifier( 221 if (!XFA_FDEExtension_ResolveNamespaceQualifier(
228 pElement, wsNodeStr.AsStringC(), wsNamespaceURI)) { 222 pElement, wsNodeStr.AsStringC(), wsNamespaceURI)) {
229 wsNamespaceURI.clear(); 223 wsNamespaceURI.clear();
230 } 224 }
231 } 225 }
226
232 static FX_BOOL XFA_FDEExtension_MatchNodeName( 227 static FX_BOOL XFA_FDEExtension_MatchNodeName(
233 CFDE_XMLNode* pNode, 228 CFDE_XMLNode* pNode,
234 const CFX_WideStringC& wsLocalTagName, 229 const CFX_WideStringC& wsLocalTagName,
235 const CFX_WideStringC& wsNamespaceURIPrefix, 230 const CFX_WideStringC& wsNamespaceURIPrefix,
236 uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) { 231 uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) {
237 if (!pNode || pNode->GetType() != FDE_XMLNODE_Element) { 232 if (!pNode || pNode->GetType() != FDE_XMLNODE_Element) {
238 return FALSE; 233 return FALSE;
239 } 234 }
240 CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pNode); 235 CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pNode);
241 CFX_WideString wsNodeStr; 236 CFX_WideString wsNodeStr;
242 pElement->GetLocalTagName(wsNodeStr); 237 pElement->GetLocalTagName(wsNodeStr);
243 if (wsNodeStr != wsLocalTagName) { 238 if (wsNodeStr != wsLocalTagName) {
244 return FALSE; 239 return FALSE;
245 } 240 }
246 XFA_FDEExtension_GetElementTagNamespaceURI(pElement, wsNodeStr); 241 XFA_FDEExtension_GetElementTagNamespaceURI(pElement, wsNodeStr);
247 if (eMatchFlags & XFA_XDPPACKET_FLAGS_NOMATCH) { 242 if (eMatchFlags & XFA_XDPPACKET_FLAGS_NOMATCH) {
248 return TRUE; 243 return TRUE;
249 } 244 }
250 if (eMatchFlags & XFA_XDPPACKET_FLAGS_PREFIXMATCH) { 245 if (eMatchFlags & XFA_XDPPACKET_FLAGS_PREFIXMATCH) {
251 return wsNodeStr.Left(wsNamespaceURIPrefix.GetLength()) == 246 return wsNodeStr.Left(wsNamespaceURIPrefix.GetLength()) ==
252 wsNamespaceURIPrefix; 247 wsNamespaceURIPrefix;
253 } 248 }
254 return wsNodeStr == wsNamespaceURIPrefix; 249 return wsNodeStr == wsNamespaceURIPrefix;
255 } 250 }
251
256 static FX_BOOL XFA_FDEExtension_GetAttributeLocalName( 252 static FX_BOOL XFA_FDEExtension_GetAttributeLocalName(
257 const CFX_WideStringC& wsAttributeName, 253 const CFX_WideStringC& wsAttributeName,
258 CFX_WideString& wsLocalAttrName) { 254 CFX_WideString& wsLocalAttrName) {
259 CFX_WideString wsAttrName(wsAttributeName); 255 CFX_WideString wsAttrName(wsAttributeName);
260 FX_STRSIZE iFind = wsAttrName.Find(L':', 0); 256 FX_STRSIZE iFind = wsAttrName.Find(L':', 0);
261 if (iFind < 0) { 257 if (iFind < 0) {
262 wsLocalAttrName = wsAttrName; 258 wsLocalAttrName = wsAttrName;
263 return FALSE; 259 return FALSE;
264 } else { 260 } else {
265 wsLocalAttrName = wsAttrName.Right(wsAttrName.GetLength() - iFind - 1); 261 wsLocalAttrName = wsAttrName.Right(wsAttrName.GetLength() - iFind - 1);
266 return TRUE; 262 return TRUE;
267 } 263 }
268 } 264 }
265
269 static FX_BOOL XFA_FDEExtension_ResolveAttribute( 266 static FX_BOOL XFA_FDEExtension_ResolveAttribute(
270 CFDE_XMLElement* pElement, 267 CFDE_XMLElement* pElement,
271 const CFX_WideStringC& wsAttributeName, 268 const CFX_WideStringC& wsAttributeName,
272 CFX_WideString& wsLocalAttrName, 269 CFX_WideString& wsLocalAttrName,
273 CFX_WideString& wsNamespaceURI) { 270 CFX_WideString& wsNamespaceURI) {
274 CFX_WideString wsAttrName(wsAttributeName); 271 CFX_WideString wsAttrName(wsAttributeName);
275 CFX_WideString wsNSPrefix; 272 CFX_WideString wsNSPrefix;
276 if (XFA_FDEExtension_GetAttributeLocalName(wsAttributeName, 273 if (XFA_FDEExtension_GetAttributeLocalName(wsAttributeName,
277 wsLocalAttrName)) { 274 wsLocalAttrName)) {
278 wsNSPrefix = wsAttrName.Left(wsAttributeName.GetLength() - 275 wsNSPrefix = wsAttrName.Left(wsAttributeName.GetLength() -
279 wsLocalAttrName.GetLength() - 1); 276 wsLocalAttrName.GetLength() - 1);
280 } 277 }
281 if (wsLocalAttrName == FX_WSTRC(L"xmlns") || 278 if (wsLocalAttrName == FX_WSTRC(L"xmlns") ||
282 wsNSPrefix == FX_WSTRC(L"xmlns") || wsNSPrefix == FX_WSTRC(L"xml")) { 279 wsNSPrefix == FX_WSTRC(L"xmlns") || wsNSPrefix == FX_WSTRC(L"xml")) {
283 return FALSE; 280 return FALSE;
284 } 281 }
285 if (!XFA_FDEExtension_ResolveNamespaceQualifier( 282 if (!XFA_FDEExtension_ResolveNamespaceQualifier(
286 pElement, wsNSPrefix.AsStringC(), wsNamespaceURI)) { 283 pElement, wsNSPrefix.AsStringC(), wsNamespaceURI)) {
287 wsNamespaceURI.clear(); 284 wsNamespaceURI.clear();
288 return FALSE; 285 return FALSE;
289 } 286 }
290 return TRUE; 287 return TRUE;
291 } 288 }
289
292 static FX_BOOL XFA_FDEExtension_FindAttributeWithNS( 290 static FX_BOOL XFA_FDEExtension_FindAttributeWithNS(
293 CFDE_XMLElement* pElement, 291 CFDE_XMLElement* pElement,
294 const CFX_WideStringC& wsLocalAttributeName, 292 const CFX_WideStringC& wsLocalAttributeName,
295 const CFX_WideStringC& wsNamespaceURIPrefix, 293 const CFX_WideStringC& wsNamespaceURIPrefix,
296 CFX_WideString& wsValue, 294 CFX_WideString& wsValue,
297 FX_BOOL bMatchNSAsPrefix = FALSE) { 295 FX_BOOL bMatchNSAsPrefix = FALSE) {
298 if (!pElement) { 296 if (!pElement) {
299 return FALSE; 297 return FALSE;
300 } 298 }
301 CFX_WideString wsAttrName; 299 CFX_WideString wsAttrName;
(...skipping 27 matching lines...) Expand all
329 } else { 327 } else {
330 if (wsAttrNS != wsNamespaceURIPrefix) { 328 if (wsAttrNS != wsNamespaceURIPrefix) {
331 continue; 329 continue;
332 } 330 }
333 } 331 }
334 wsValue = wsAttrValue; 332 wsValue = wsAttrValue;
335 return TRUE; 333 return TRUE;
336 } 334 }
337 return FALSE; 335 return FALSE;
338 } 336 }
337
339 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, 338 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode,
340 XFA_XDPPACKET ePacketID) { 339 XFA_XDPPACKET ePacketID) {
341 switch (ePacketID) { 340 switch (ePacketID) {
342 case XFA_XDPPACKET_UNKNOWN: 341 case XFA_XDPPACKET_UNKNOWN:
343 return nullptr; 342 return nullptr;
344 case XFA_XDPPACKET_XDP: 343 case XFA_XDPPACKET_XDP:
345 return ParseAsXDPPacket_XDP(pXMLDocumentNode, ePacketID); 344 return ParseAsXDPPacket_XDP(pXMLDocumentNode, ePacketID);
346 case XFA_XDPPACKET_Config: 345 case XFA_XDPPACKET_Config:
347 return ParseAsXDPPacket_Config(pXMLDocumentNode, ePacketID); 346 return ParseAsXDPPacket_Config(pXMLDocumentNode, ePacketID);
348 case XFA_XDPPACKET_Template: 347 case XFA_XDPPACKET_Template:
349 case XFA_XDPPACKET_Form: 348 case XFA_XDPPACKET_Form:
350 return ParseAsXDPPacket_TemplateForm(pXMLDocumentNode, ePacketID); 349 return ParseAsXDPPacket_TemplateForm(pXMLDocumentNode, ePacketID);
351 case XFA_XDPPACKET_Datasets: 350 case XFA_XDPPACKET_Datasets:
352 return ParseAsXDPPacket_Data(pXMLDocumentNode, ePacketID); 351 return ParseAsXDPPacket_Data(pXMLDocumentNode, ePacketID);
353 case XFA_XDPPACKET_Xdc: 352 case XFA_XDPPACKET_Xdc:
354 return ParseAsXDPPacket_Xdc(pXMLDocumentNode, ePacketID); 353 return ParseAsXDPPacket_Xdc(pXMLDocumentNode, ePacketID);
355 case XFA_XDPPACKET_LocaleSet: 354 case XFA_XDPPACKET_LocaleSet:
356 case XFA_XDPPACKET_ConnectionSet: 355 case XFA_XDPPACKET_ConnectionSet:
357 case XFA_XDPPACKET_SourceSet: 356 case XFA_XDPPACKET_SourceSet:
358 return ParseAsXDPPacket_LocaleConnectionSourceSet(pXMLDocumentNode, 357 return ParseAsXDPPacket_LocaleConnectionSourceSet(pXMLDocumentNode,
359 ePacketID); 358 ePacketID);
360 default: 359 default:
361 return ParseAsXDPPacket_User(pXMLDocumentNode, ePacketID); 360 return ParseAsXDPPacket_User(pXMLDocumentNode, ePacketID);
362 } 361 }
363 } 362 }
363
364 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( 364 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
365 CFDE_XMLNode* pXMLDocumentNode, 365 CFDE_XMLNode* pXMLDocumentNode,
366 XFA_XDPPACKET ePacketID) { 366 XFA_XDPPACKET ePacketID) {
367 if (!XFA_FDEExtension_MatchNodeName( 367 if (!XFA_FDEExtension_MatchNodeName(
368 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName, 368 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName,
369 XFA_GetPacketByIndex(XFA_PACKET_XDP)->pURI, 369 XFA_GetPacketByIndex(XFA_PACKET_XDP)->pURI,
370 XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) { 370 XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) {
371 return nullptr; 371 return nullptr;
372 } 372 }
373 CXFA_Node* pXFARootNode = 373 CXFA_Node* pXFARootNode =
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 if (pXMLFormDOMRoot) { 492 if (pXMLFormDOMRoot) {
493 CXFA_Node* pPacketNode = 493 CXFA_Node* pPacketNode =
494 ParseAsXDPPacket(pXMLFormDOMRoot, XFA_XDPPACKET_Form); 494 ParseAsXDPPacket(pXMLFormDOMRoot, XFA_XDPPACKET_Form);
495 if (pPacketNode) { 495 if (pPacketNode) {
496 pXFARootNode->InsertChild(pPacketNode); 496 pXFARootNode->InsertChild(pPacketNode);
497 } 497 }
498 } 498 }
499 pXFARootNode->SetXMLMappingNode(pXMLDocumentNode); 499 pXFARootNode->SetXMLMappingNode(pXMLDocumentNode);
500 return pXFARootNode; 500 return pXFARootNode;
501 } 501 }
502
502 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( 503 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config(
503 CFDE_XMLNode* pXMLDocumentNode, 504 CFDE_XMLNode* pXMLDocumentNode,
504 XFA_XDPPACKET ePacketID) { 505 XFA_XDPPACKET ePacketID) {
505 if (!XFA_FDEExtension_MatchNodeName( 506 if (!XFA_FDEExtension_MatchNodeName(
506 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName, 507 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Config)->pName,
507 XFA_GetPacketByIndex(XFA_PACKET_Config)->pURI, 508 XFA_GetPacketByIndex(XFA_PACKET_Config)->pURI,
508 XFA_GetPacketByIndex(XFA_PACKET_Config)->eFlags)) { 509 XFA_GetPacketByIndex(XFA_PACKET_Config)->eFlags)) {
509 return nullptr; 510 return nullptr;
510 } 511 }
511 CXFA_Node* pNode = 512 CXFA_Node* pNode =
512 m_pFactory->CreateNode(XFA_XDPPACKET_Config, XFA_Element::Config); 513 m_pFactory->CreateNode(XFA_XDPPACKET_Config, XFA_Element::Config);
513 if (!pNode) { 514 if (!pNode) {
514 return nullptr; 515 return nullptr;
515 } 516 }
516 pNode->SetCData(XFA_ATTRIBUTE_Name, 517 pNode->SetCData(XFA_ATTRIBUTE_Name,
517 XFA_GetPacketByIndex(XFA_PACKET_Config)->pName); 518 XFA_GetPacketByIndex(XFA_PACKET_Config)->pName);
518 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { 519 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) {
519 return nullptr; 520 return nullptr;
520 } 521 }
521 pNode->SetXMLMappingNode(pXMLDocumentNode); 522 pNode->SetXMLMappingNode(pXMLDocumentNode);
522 return pNode; 523 return pNode;
523 } 524 }
525
524 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( 526 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
525 CFDE_XMLNode* pXMLDocumentNode, 527 CFDE_XMLNode* pXMLDocumentNode,
526 XFA_XDPPACKET ePacketID) { 528 XFA_XDPPACKET ePacketID) {
527 CXFA_Node* pNode = nullptr; 529 CXFA_Node* pNode = nullptr;
528 if (ePacketID == XFA_XDPPACKET_Template) { 530 if (ePacketID == XFA_XDPPACKET_Template) {
529 if (XFA_FDEExtension_MatchNodeName( 531 if (XFA_FDEExtension_MatchNodeName(
530 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Template)->pName, 532 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Template)->pName,
531 XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI, 533 XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI,
532 XFA_GetPacketByIndex(XFA_PACKET_Template)->eFlags)) { 534 XFA_GetPacketByIndex(XFA_PACKET_Template)->eFlags)) {
533 pNode = 535 pNode =
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, bUseAttribute)) { 599 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID, bUseAttribute)) {
598 return nullptr; 600 return nullptr;
599 } 601 }
600 } 602 }
601 } 603 }
602 if (pNode) { 604 if (pNode) {
603 pNode->SetXMLMappingNode(pXMLDocumentNode); 605 pNode->SetXMLMappingNode(pXMLDocumentNode);
604 } 606 }
605 return pNode; 607 return pNode;
606 } 608 }
609
607 static CFDE_XMLNode* XFA_GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) { 610 static CFDE_XMLNode* XFA_GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) {
608 if (XFA_FDEExtension_MatchNodeName( 611 if (XFA_FDEExtension_MatchNodeName(
609 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName, 612 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName,
610 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, 613 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI,
611 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->eFlags)) { 614 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->eFlags)) {
612 return pXMLDocumentNode; 615 return pXMLDocumentNode;
613 } 616 }
614 if (!XFA_FDEExtension_MatchNodeName( 617 if (!XFA_FDEExtension_MatchNodeName(
615 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName, 618 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName,
616 XFA_GetPacketByIndex(XFA_PACKET_XDP)->pURI, 619 XFA_GetPacketByIndex(XFA_PACKET_XDP)->pURI,
617 XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) { 620 XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) {
618 return nullptr; 621 return nullptr;
619 } 622 }
620 for (CFDE_XMLNode* pDatasetsNode = 623 for (CFDE_XMLNode* pDatasetsNode =
621 pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild); 624 pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
622 pDatasetsNode; 625 pDatasetsNode;
623 pDatasetsNode = pDatasetsNode->GetNodeItem(CFDE_XMLNode::NextSibling)) { 626 pDatasetsNode = pDatasetsNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
624 if (!XFA_FDEExtension_MatchNodeName( 627 if (!XFA_FDEExtension_MatchNodeName(
625 pDatasetsNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName, 628 pDatasetsNode, XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName,
626 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI, 629 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI,
627 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->eFlags)) { 630 XFA_GetPacketByIndex(XFA_PACKET_Datasets)->eFlags)) {
628 continue; 631 continue;
629 } 632 }
630 return pDatasetsNode; 633 return pDatasetsNode;
631 } 634 }
632 return nullptr; 635 return nullptr;
633 } 636 }
637
634 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( 638 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
635 CFDE_XMLNode* pXMLDocumentNode, 639 CFDE_XMLNode* pXMLDocumentNode,
636 XFA_XDPPACKET ePacketID) { 640 XFA_XDPPACKET ePacketID) {
637 CFDE_XMLNode* pDatasetsXMLNode = XFA_GetDataSetsFromXDP(pXMLDocumentNode); 641 CFDE_XMLNode* pDatasetsXMLNode = XFA_GetDataSetsFromXDP(pXMLDocumentNode);
638 if (pDatasetsXMLNode) { 642 if (pDatasetsXMLNode) {
639 CXFA_Node* pNode = 643 CXFA_Node* pNode =
640 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel); 644 m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel);
641 if (!pNode) { 645 if (!pNode) {
642 return nullptr; 646 return nullptr;
643 } 647 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 return nullptr; 692 return nullptr;
689 } 693 }
690 pNode->SetXMLMappingNode(pDataXMLNode); 694 pNode->SetXMLMappingNode(pDataXMLNode);
691 if (pDataXMLNode != pXMLDocumentNode) { 695 if (pDataXMLNode != pXMLDocumentNode) {
692 pNode->SetFlag(XFA_NodeFlag_OwnXMLNode, false); 696 pNode->SetFlag(XFA_NodeFlag_OwnXMLNode, false);
693 } 697 }
694 return pNode; 698 return pNode;
695 } 699 }
696 return nullptr; 700 return nullptr;
697 } 701 }
702
698 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( 703 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet(
699 CFDE_XMLNode* pXMLDocumentNode, 704 CFDE_XMLNode* pXMLDocumentNode,
700 XFA_XDPPACKET ePacketID) { 705 XFA_XDPPACKET ePacketID) {
701 CXFA_Node* pNode = nullptr; 706 CXFA_Node* pNode = nullptr;
702 if (ePacketID == XFA_XDPPACKET_LocaleSet) { 707 if (ePacketID == XFA_XDPPACKET_LocaleSet) {
703 if (XFA_FDEExtension_MatchNodeName( 708 if (XFA_FDEExtension_MatchNodeName(
704 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName, 709 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pName,
705 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pURI, 710 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->pURI,
706 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->eFlags)) { 711 XFA_GetPacketByIndex(XFA_PACKET_LocaleSet)->eFlags)) {
707 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_LocaleSet, 712 pNode = m_pFactory->CreateNode(XFA_XDPPACKET_LocaleSet,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) { 752 if (!NormalLoader(pNode, pXMLDocumentNode, ePacketID)) {
748 return nullptr; 753 return nullptr;
749 } 754 }
750 } 755 }
751 } 756 }
752 if (pNode) { 757 if (pNode) {
753 pNode->SetXMLMappingNode(pXMLDocumentNode); 758 pNode->SetXMLMappingNode(pXMLDocumentNode);
754 } 759 }
755 return pNode; 760 return pNode;
756 } 761 }
762
757 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( 763 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc(
758 CFDE_XMLNode* pXMLDocumentNode, 764 CFDE_XMLNode* pXMLDocumentNode,
759 XFA_XDPPACKET ePacketID) { 765 XFA_XDPPACKET ePacketID) {
760 if (XFA_FDEExtension_MatchNodeName( 766 if (XFA_FDEExtension_MatchNodeName(
761 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName, 767 pXMLDocumentNode, XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName,
762 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pURI, 768 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pURI,
763 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->eFlags)) { 769 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->eFlags)) {
764 CXFA_Node* pNode = 770 CXFA_Node* pNode =
765 m_pFactory->CreateNode(XFA_XDPPACKET_Xdc, XFA_Element::Xdc); 771 m_pFactory->CreateNode(XFA_XDPPACKET_Xdc, XFA_Element::Xdc);
766 if (!pNode) { 772 if (!pNode) {
767 return nullptr; 773 return nullptr;
768 } 774 }
769 pNode->SetCData(XFA_ATTRIBUTE_Name, 775 pNode->SetCData(XFA_ATTRIBUTE_Name,
770 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName); 776 XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName);
771 pNode->SetXMLMappingNode(pXMLDocumentNode); 777 pNode->SetXMLMappingNode(pXMLDocumentNode);
772 return pNode; 778 return pNode;
773 } 779 }
774 return nullptr; 780 return nullptr;
775 } 781 }
782
776 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( 783 CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User(
777 CFDE_XMLNode* pXMLDocumentNode, 784 CFDE_XMLNode* pXMLDocumentNode,
778 XFA_XDPPACKET ePacketID) { 785 XFA_XDPPACKET ePacketID) {
779 CXFA_Node* pNode = 786 CXFA_Node* pNode =
780 m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Packet); 787 m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Packet);
781 if (!pNode) { 788 if (!pNode) {
782 return nullptr; 789 return nullptr;
783 } 790 }
784 CFX_WideString wsName; 791 CFX_WideString wsName;
785 static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(wsName); 792 static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(wsName);
786 pNode->SetCData(XFA_ATTRIBUTE_Name, wsName); 793 pNode->SetCData(XFA_ATTRIBUTE_Name, wsName);
787 if (!UserPacketLoader(pNode, pXMLDocumentNode)) { 794 if (!UserPacketLoader(pNode, pXMLDocumentNode)) {
788 return nullptr; 795 return nullptr;
789 } 796 }
790 pNode->SetXMLMappingNode(pXMLDocumentNode); 797 pNode->SetXMLMappingNode(pXMLDocumentNode);
791 return pNode; 798 return pNode;
792 } 799 }
800
793 CXFA_Node* CXFA_SimpleParser::UserPacketLoader(CXFA_Node* pXFANode, 801 CXFA_Node* CXFA_SimpleParser::UserPacketLoader(CXFA_Node* pXFANode,
794 CFDE_XMLNode* pXMLDoc) { 802 CFDE_XMLNode* pXMLDoc) {
795 return pXFANode; 803 return pXFANode;
796 } 804 }
805
797 static FX_BOOL XFA_FDEExtension_IsStringAllWhitespace(CFX_WideString wsText) { 806 static FX_BOOL XFA_FDEExtension_IsStringAllWhitespace(CFX_WideString wsText) {
798 wsText.TrimRight(L"\x20\x9\xD\xA"); 807 wsText.TrimRight(L"\x20\x9\xD\xA");
799 return wsText.IsEmpty(); 808 return wsText.IsEmpty();
800 } 809 }
810
801 CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode, 811 CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode,
802 CFDE_XMLNode* pXMLDoc, 812 CFDE_XMLNode* pXMLDoc,
803 FX_BOOL bDoTransform) { 813 FX_BOOL bDoTransform) {
804 ParseDataGroup(pXFANode, pXMLDoc, XFA_XDPPACKET_Datasets); 814 ParseDataGroup(pXFANode, pXMLDoc, XFA_XDPPACKET_Datasets);
805 return pXFANode; 815 return pXFANode;
806 } 816 }
817
807 CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, 818 CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
808 CFDE_XMLNode* pXMLDoc, 819 CFDE_XMLNode* pXMLDoc,
809 XFA_XDPPACKET ePacketID, 820 XFA_XDPPACKET ePacketID,
810 FX_BOOL bUseAttribute) { 821 FX_BOOL bUseAttribute) {
811 FX_BOOL bOneOfPropertyFound = FALSE; 822 FX_BOOL bOneOfPropertyFound = FALSE;
812 for (CFDE_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFDE_XMLNode::FirstChild); 823 for (CFDE_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFDE_XMLNode::FirstChild);
813 pXMLChild; 824 pXMLChild;
814 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) { 825 pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
815 switch (pXMLChild->GetType()) { 826 switch (pXMLChild->GetType()) {
816 case FDE_XMLNODE_Element: { 827 case FDE_XMLNODE_Element: {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 case FDE_XMLNODE_Instruction: 898 case FDE_XMLNODE_Instruction:
888 ParseInstruction(pXFANode, static_cast<CFDE_XMLInstruction*>(pXMLChild), 899 ParseInstruction(pXFANode, static_cast<CFDE_XMLInstruction*>(pXMLChild),
889 ePacketID); 900 ePacketID);
890 break; 901 break;
891 default: 902 default:
892 break; 903 break;
893 } 904 }
894 } 905 }
895 return pXFANode; 906 return pXFANode;
896 } 907 }
908
897 FX_BOOL XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) { 909 FX_BOOL XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) {
898 if (pRichTextXMLNode) { 910 if (pRichTextXMLNode) {
899 CFX_WideString wsNamespaceURI; 911 CFX_WideString wsNamespaceURI;
900 XFA_FDEExtension_GetElementTagNamespaceURI(pRichTextXMLNode, 912 XFA_FDEExtension_GetElementTagNamespaceURI(pRichTextXMLNode,
901 wsNamespaceURI); 913 wsNamespaceURI);
902 if (wsNamespaceURI == FX_WSTRC(L"http://www.w3.org/1999/xhtml")) { 914 if (wsNamespaceURI == FX_WSTRC(L"http://www.w3.org/1999/xhtml")) {
903 return TRUE; 915 return TRUE;
904 } 916 }
905 } 917 }
906 return FALSE; 918 return FALSE;
907 } 919 }
920
908 class RichTextNodeVisitor { 921 class RichTextNodeVisitor {
909 public: 922 public:
910 static inline CFDE_XMLNode* GetFirstChild(CFDE_XMLNode* pNode) { 923 static inline CFDE_XMLNode* GetFirstChild(CFDE_XMLNode* pNode) {
911 return pNode->GetNodeItem(CFDE_XMLNode::FirstChild); 924 return pNode->GetNodeItem(CFDE_XMLNode::FirstChild);
912 } 925 }
913 static inline CFDE_XMLNode* GetNextSibling(CFDE_XMLNode* pNode) { 926 static inline CFDE_XMLNode* GetNextSibling(CFDE_XMLNode* pNode) {
914 return pNode->GetNodeItem(CFDE_XMLNode::NextSibling); 927 return pNode->GetNodeItem(CFDE_XMLNode::NextSibling);
915 } 928 }
916 static inline CFDE_XMLNode* GetParent(CFDE_XMLNode* pNode) { 929 static inline CFDE_XMLNode* GetParent(CFDE_XMLNode* pNode) {
917 return pNode->GetNodeItem(CFDE_XMLNode::Parent); 930 return pNode->GetNodeItem(CFDE_XMLNode::Parent);
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 CFX_WideString wsData; 1312 CFX_WideString wsData;
1300 if (pXMLInstruction->GetData(0, wsData) && 1313 if (pXMLInstruction->GetData(0, wsData) &&
1301 wsData == FX_WSTRC(L"JavaScript")) { 1314 wsData == FX_WSTRC(L"JavaScript")) {
1302 if (pXMLInstruction->GetData(1, wsData) && 1315 if (pXMLInstruction->GetData(1, wsData) &&
1303 wsData == FX_WSTRC(L"strictScoping")) { 1316 wsData == FX_WSTRC(L"strictScoping")) {
1304 pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, TRUE); 1317 pXFANode->GetDocument()->SetFlag(XFA_DOCFLAG_StrictScoping, TRUE);
1305 } 1318 }
1306 } 1319 }
1307 } 1320 }
1308 } 1321 }
1322
1309 void CXFA_SimpleParser::CloseParser() { 1323 void CXFA_SimpleParser::CloseParser() {
1310 if (m_pXMLDoc) { 1324 m_pXMLDoc.reset();
1311 m_pXMLDoc->Release(); 1325 m_pStream.reset();
1312 m_pXMLDoc = nullptr;
1313 }
1314 if (m_pStream) {
1315 m_pStream->Release();
1316 m_pStream = nullptr;
1317 }
1318 } 1326 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_simple_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698