Line data Source code
1 : // file : xsd/cxx/xml/dom/elements.txx
2 : // copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
3 : // license : GNU GPL v2 + exceptions; see accompanying LICENSE file
4 :
5 : #include <xsd/cxx/xml/string.hxx>
6 :
7 : namespace xsd
8 : {
9 : namespace cxx
10 : {
11 : namespace xml
12 : {
13 : namespace dom
14 : {
15 : template <typename C>
16 : qualified_name<C>
17 0 : name (const xercesc::DOMAttr& a)
18 : {
19 0 : const XMLCh* n (a.getLocalName ());
20 :
21 : // If this DOM doesn't support namespaces then use getName.
22 : //
23 0 : if (n != 0)
24 : {
25 0 : if (const XMLCh* ns = a.getNamespaceURI ())
26 0 : return qualified_name<C> (transcode<C> (n), transcode<C> (ns));
27 : else
28 0 : return qualified_name<C> (transcode<C> (n));
29 : }
30 : else
31 0 : return qualified_name<C> (transcode<C> (a.getName ()));
32 : }
33 :
34 :
35 : template <typename C>
36 : qualified_name<C>
37 0 : name (const xercesc::DOMElement& e)
38 : {
39 0 : const XMLCh* n (e.getLocalName ());
40 :
41 : // If this DOM doesn't support namespaces then use getTagName.
42 : //
43 0 : if (n != 0)
44 : {
45 0 : if (const XMLCh* ns = e.getNamespaceURI ())
46 0 : return qualified_name<C> (transcode<C> (n), transcode<C> (ns));
47 : else
48 0 : return qualified_name<C> (transcode<C> (n));
49 : }
50 : else
51 0 : return qualified_name<C> (transcode<C> (e.getTagName ()));
52 : }
53 : }
54 : }
55 : }
56 : }
|