Branch data Line data Source code
1 : : // file : xsd/cxx/xml/dom/elements.txx
2 : : // copyright : Copyright (c) 2005-2014 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 : 4 : name (const xercesc::DOMAttr& a)
18 : : {
19 : 4 : const XMLCh* n (a.getLocalName ());
20 : :
21 : : // If this DOM doesn't support namespaces then use getName.
22 : : //
23 [ + - ]: 4 : if (n != 0)
24 : : {
25 [ - + ]: 4 : if (const XMLCh* ns = a.getNamespaceURI ())
26 [ # # ][ # # ]: 0 : return qualified_name<C> (transcode<C> (n), transcode<C> (ns));
27 : : else
28 : 8 : return qualified_name<C> (transcode<C> (n));
29 : : }
30 : : else
31 : 4 : return qualified_name<C> (transcode<C> (a.getName ()));
32 : : }
33 : :
34 : :
35 : : template <typename C>
36 : : qualified_name<C>
37 : 6 : name (const xercesc::DOMElement& e)
38 : : {
39 : 6 : const XMLCh* n (e.getLocalName ());
40 : :
41 : : // If this DOM doesn't support namespaces then use getTagName.
42 : : //
43 [ + - ]: 6 : if (n != 0)
44 : : {
45 [ - + ]: 6 : if (const XMLCh* ns = e.getNamespaceURI ())
46 [ # # ][ # # ]: 0 : return qualified_name<C> (transcode<C> (n), transcode<C> (ns));
47 : : else
48 : 12 : return qualified_name<C> (transcode<C> (n));
49 : : }
50 : : else
51 : 6 : return qualified_name<C> (transcode<C> (e.getTagName ()));
52 : : }
53 : : }
54 : : }
55 : : }
56 : : }
|