1//
2// QName.cpp
3//
4// Library: XML
5// Package: XML
6// Module: QName
7//
8// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
9// and Contributors.
10//
11// Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/).
12// Copyright (c) 2009-2013 Code Synthesis Tools CC.
13//
14// SPDX-License-Identifier: BSL-1.0
15//
16
17
18#include "Poco/XML/QName.h"
19#include <ostream>
20
21
22namespace Poco {
23namespace XML {
24
25
26QName::QName()
27{
28}
29
30
31QName::QName(const std::string& name) :
32 _name(name)
33{
34}
35
36
37QName::QName(const std::string& ns, const std::string& name) :
38 _ns(ns),
39 _name(name)
40{
41}
42
43
44QName::QName(const std::string& ns, const std::string& name, const std::string& prefix) :
45 _ns(ns),
46 _name(name),
47 _prefix(prefix)
48{
49}
50
51
52std::string QName::toString() const
53{
54 std::string r;
55 if (!_ns.empty())
56 {
57 r += _ns;
58 r += '#';
59 }
60
61 r += _name;
62 return r;
63}
64
65
66std::ostream& operator << (std::ostream& os, const QName& qn)
67{
68 return os << qn.toString();
69}
70
71
72} } // namespace Poco::XML
73