1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET 4 * 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises 6 * 7 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * This file was originally licensed under the terms of the CeCILL v2.1, 10 * and continues to be available under such terms. 11 * For more information, see the COPYING file which you should have received 12 * along with this program. 13 * 14 */ 15 16 #ifndef __XMLNS_HXX__ 17 #define __XMLNS_HXX__ 18 19 #include <string> 20 21 #include "xml.h" 22 23 #include "dynlib_xml_scilab.h" 24 25 namespace org_modules_xml 26 { 27 28 class XMLElement; 29 class XMLObject; 30 31 /** 32 * @file 33 * @author Calixte DENIZET <calixte.denizet@scilab.org> 34 * 35 * Class to wrap a namespace xmlNs. 36 * @see http://xmlsoft.org/html/libxml-tree.html#xmlNs 37 */ 38 class XML_SCILAB_IMPEXP XMLNs: public XMLObject 39 { 40 const XMLObject & parent; 41 xmlNs *ns; 42 43 public: 44 45 /** 46 * @param parent the parent XML object 47 * @param ns the xml namespace 48 */ 49 XMLNs(const XMLObject & parent, xmlNs * ns); 50 51 /** 52 * @param elem the parent XMLElement 53 * @param prefix the namespace prefix 54 * @param href the namespace href 55 */ 56 XMLNs(const XMLElement & elem, char *prefix, char *href); 57 58 ~XMLNs(); 59 60 void *getRealXMLPointer() const; 61 62 /** 63 * @return the namespace href 64 */ getHref() const65 const char *getHref() const 66 { 67 return ns == 0 ? "" : (const char *)ns->href; 68 } 69 70 /** 71 * @return the namespace prefix 72 */ getPrefix() const73 const char *getPrefix() const 74 { 75 return ns == 0 ? "" : (const char *)ns->prefix; 76 } 77 78 /** 79 * @return the xmlNs behind this object 80 */ getRealNs() const81 xmlNs *getRealNs() const 82 { 83 return ns; 84 } 85 86 const XMLObject *getXMLObjectParent() const; 87 const std::string toString() const; 88 }; 89 } 90 91 #endif 92