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> name(const xercesc::DOMAttr & a)17 name (const xercesc::DOMAttr& a) 18 { 19 const XMLCh* n (a.getLocalName ()); 20 21 // If this DOM doesn't support namespaces then use getName. 22 // 23 if (n != 0) 24 { 25 if (const XMLCh* ns = a.getNamespaceURI ()) 26 return qualified_name<C> (transcode<C> (n), transcode<C> (ns)); 27 else 28 return qualified_name<C> (transcode<C> (n)); 29 } 30 else 31 return qualified_name<C> (transcode<C> (a.getName ())); 32 } 33 34 35 template <typename C> 36 qualified_name<C> name(const xercesc::DOMElement & e)37 name (const xercesc::DOMElement& e) 38 { 39 const XMLCh* n (e.getLocalName ()); 40 41 // If this DOM doesn't support namespaces then use getTagName. 42 // 43 if (n != 0) 44 { 45 if (const XMLCh* ns = e.getNamespaceURI ()) 46 return qualified_name<C> (transcode<C> (n), transcode<C> (ns)); 47 else 48 return qualified_name<C> (transcode<C> (n)); 49 } 50 else 51 return qualified_name<C> (transcode<C> (e.getTagName ())); 52 } 53 } 54 } 55 } 56 } 57