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 "../../include/fxcrt/fx_xml.h" | 7 #include "../../include/fxcrt/fx_xml.h" |
8 #include "xml_int.h" | 8 #include "xml_int.h" |
9 CXML_Parser::~CXML_Parser() | 9 CXML_Parser::~CXML_Parser() |
10 { | 10 { |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } else if (ch == '/') { | 465 } else if (ch == '/') { |
466 CFX_ByteString space, name; | 466 CFX_ByteString space, name; |
467 GetName(space, name); | 467 GetName(space, name); |
468 SkipWhiteSpaces(); | 468 SkipWhiteSpaces(); |
469 m_dwIndex ++; | 469 m_dwIndex ++; |
470 iState = 10; | 470 iState = 10; |
471 } else { | 471 } else { |
472 content << decoder.GetResult(); | 472 content << decoder.GetResult(); |
473 CFX_WideString dataStr = content.GetWideString(); | 473 CFX_WideString dataStr = content.GetWideString(); |
474 if (!bCDATA && !m_bSaveSpaceChars) { | 474 if (!bCDATA && !m_bSaveSpaceChars) { |
475 dataStr.TrimRight((FX_LPCWSTR)L" \t\r\n"); | 475 dataStr.TrimRight(L" \t\r\n"); |
476 } | 476 } |
477 InsertContentSegment(bCDATA, dataStr, pElement); | 477 InsertContentSegment(bCDATA, dataStr, pElement); |
478 content.Clear(); | 478 content.Clear(); |
479 decoder.Clear(); | 479 decoder.Clear(); |
480 bCDATA = FALSE; | 480 bCDATA = FALSE; |
481 iState = 0; | 481 iState = 0; |
482 m_dwIndex --; | 482 m_dwIndex --; |
483 CXML_Element* pSubElement = ParseElement(pElement, TRUE)
; | 483 CXML_Element* pSubElement = ParseElement(pElement, TRUE)
; |
484 if (pSubElement == NULL) { | 484 if (pSubElement == NULL) { |
485 break; | 485 break; |
(...skipping 23 matching lines...) Expand all Loading... |
509 } | 509 } |
510 } | 510 } |
511 m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; | 511 m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; |
512 if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) { | 512 if (iState == 10 || m_dwIndex < m_dwBufferSize || IsEOF()) { |
513 break; | 513 break; |
514 } | 514 } |
515 } while (ReadNextBlock()); | 515 } while (ReadNextBlock()); |
516 content << decoder.GetResult(); | 516 content << decoder.GetResult(); |
517 CFX_WideString dataStr = content.GetWideString(); | 517 CFX_WideString dataStr = content.GetWideString(); |
518 if (!m_bSaveSpaceChars) { | 518 if (!m_bSaveSpaceChars) { |
519 dataStr.TrimRight((FX_LPCWSTR)L" \t\r\n"); | 519 dataStr.TrimRight(L" \t\r\n"); |
520 } | 520 } |
521 InsertContentSegment(bCDATA, dataStr, pElement); | 521 InsertContentSegment(bCDATA, dataStr, pElement); |
522 content.Clear(); | 522 content.Clear(); |
523 decoder.Clear(); | 523 decoder.Clear(); |
524 bCDATA = FALSE; | 524 bCDATA = FALSE; |
525 return pElement; | 525 return pElement; |
526 } | 526 } |
527 void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, FX_WSTR content, CXML_Ele
ment* pElement) | 527 void CXML_Parser::InsertContentSegment(FX_BOOL bCDATA, FX_WSTR content, CXML_Ele
ment* pElement) |
528 { | 528 { |
529 if (content.IsEmpty()) { | 529 if (content.IsEmpty()) { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } | 860 } |
861 void CXML_AttrMap::RemoveAll() | 861 void CXML_AttrMap::RemoveAll() |
862 { | 862 { |
863 if (!m_pMap) { | 863 if (!m_pMap) { |
864 return; | 864 return; |
865 } | 865 } |
866 m_pMap->RemoveAll(); | 866 m_pMap->RemoveAll(); |
867 delete m_pMap; | 867 delete m_pMap; |
868 m_pMap = NULL; | 868 m_pMap = NULL; |
869 } | 869 } |
OLD | NEW |