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.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "../../include/fxcrt/fx_xml.h"
8 #include "xml_int.h"
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 {
11     if (bsFullName.IsEmpty()) {
12         return;
13     }
14     FX_INT32 iStart = 0;
15     for (; iStart < bsFullName.GetLength(); iStart ++) {
16         if (bsFullName.GetAt(iStart) == ':') {
17             break;
18         }
19     }
20     if (iStart >= bsFullName.GetLength()) {
21         bsName = bsFullName;
22     } else {
23         bsSpace = CFX_ByteStringC(bsFullName.GetCStr(), iStart);
24         iStart ++;
25         bsName = CFX_ByteStringC(bsFullName.GetCStr() + iStart, bsFullName.GetLength() - iStart);
26     }
27 }
SetTag(FX_BSTR qSpace,FX_BSTR tagname)28 void CXML_Element::SetTag(FX_BSTR qSpace, FX_BSTR tagname)
29 {
30     m_QSpaceName = qSpace;
31     m_TagName = tagname;
32 }
SetTag(FX_BSTR qTagName)33 void CXML_Element::SetTag(FX_BSTR qTagName)
34 {
35     ASSERT(!qTagName.IsEmpty());
36     CFX_ByteStringC bsSpace, bsName;
37     FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName);
38     m_QSpaceName = bsSpace;
39     m_TagName = bsName;
40 }
41