1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
7 #include "../../include/fxcrt/fx_xml.h"
9 void FX_XML_SplitQualifiedName(FX_BSTR bsFullName, CFX_ByteStringC &bsSpace, CFX_ByteStringC &bsName)
11 if (bsFullName.IsEmpty()) {
15 for (; iStart < bsFullName.GetLength(); iStart ++) {
16 if (bsFullName.GetAt(iStart) == ':') {
20 if (iStart >= bsFullName.GetLength()) {
23 bsSpace = CFX_ByteStringC(bsFullName.GetCStr(), iStart);
25 bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart, bsFullName.GetLength() - iStart);
28 void CXML_Element::SetTag(FX_BSTR qSpace, FX_BSTR tagname)
30 IFX_Allocator* pAllocator = m_Children.m_pAllocator;
31 m_QSpaceName.Set(qSpace, pAllocator);
32 m_TagName.Set(tagname, pAllocator);
34 void CXML_Element::SetTag(FX_BSTR qTagName)
36 ASSERT(!qTagName.IsEmpty());
37 IFX_Allocator* pAllocator = m_Children.m_pAllocator;
38 CFX_ByteStringC bsSpace, bsName;
39 FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName);
40 m_QSpaceName.Set(bsSpace, pAllocator);
41 m_TagName.Set(bsName, pAllocator);