| 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 void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX
_ByteStringC &bsName) | 9 void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX
_ByteStringC &bsName) |
| 10 { | 10 { |
| 11 if (bsFullName.IsEmpty()) { | 11 if (bsFullName.IsEmpty()) { |
| 12 return; | 12 return; |
| 13 } | 13 } |
| 14 FX_INT32 iStart = 0; | 14 FX_INT32 iStart = 0; |
| 15 for (; iStart < bsFullName.GetLength(); iStart ++) { | 15 for (; iStart < bsFullName.GetLength(); iStart ++) { |
| 16 if (bsFullName.GetAt(iStart) == ':') { | 16 if (bsFullName.GetAt(iStart) == ':') { |
| 17 break; | 17 break; |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 if (iStart >= bsFullName.GetLength()) { | 20 if (iStart >= bsFullName.GetLength()) { |
| 21 bsName = bsFullName; | 21 bsName = bsFullName; |
| 22 } else { | 22 } else { |
| 23 bsSpace = CFX_ByteStringC(bsFullName.GetCStr(), iStart); | 23 bsSpace = CFX_ByteStringC(bsFullName.GetCStr(), iStart); |
| 24 iStart ++; | 24 iStart ++; |
| 25 bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart, bsFullName.GetLe
ngth() - iStart); | 25 bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart, bsFullName.GetLe
ngth() - iStart); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 void CXML_Element::SetTag(FX_BSTR qSpace, FX_BSTR tagname) | 28 void CXML_Element::SetTag(FX_BSTR qSpace, FX_BSTR tagname) |
| 29 { | 29 { |
| 30 IFX_Allocator* pAllocator = m_Children.m_pAllocator; | 30 m_QSpaceName = qSpace; |
| 31 m_QSpaceName.Set(qSpace, pAllocator); | 31 m_TagName = tagname; |
| 32 m_TagName.Set(tagname, pAllocator); | |
| 33 } | 32 } |
| 34 void CXML_Element::SetTag(FX_BSTR qTagName) | 33 void CXML_Element::SetTag(FX_BSTR qTagName) |
| 35 { | 34 { |
| 36 ASSERT(!qTagName.IsEmpty()); | 35 ASSERT(!qTagName.IsEmpty()); |
| 37 IFX_Allocator* pAllocator = m_Children.m_pAllocator; | |
| 38 CFX_ByteStringC bsSpace, bsName; | 36 CFX_ByteStringC bsSpace, bsName; |
| 39 FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName); | 37 FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName); |
| 40 m_QSpaceName.Set(bsSpace, pAllocator); | 38 m_QSpaceName = bsSpace; |
| 41 m_TagName.Set(bsName, pAllocator); | 39 m_TagName = bsName; |
| 42 } | 40 } |
| OLD | NEW |