~ubuntu-branches/ubuntu/natty/libxml++2.6/natty

« back to all changes in this revision

Viewing changes to libxml++/nodes/element.cc

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-09-18 11:32:24 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20070918113224-7x031mzf1shoozxx
Tags: 2.20.0-0ubuntu1
* New upstream release:
  - Element: Added get_attribute_value(), to get a simple text value for an
    attribute.
  - Added an experimental --enable-api-exceptions configure option, to allow
    libxml++ to build without exceptions.
* debian/libxml++2.6-doc.docs: 2.18 -> 2.20.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    Glib::ustring ns_uri = get_namespace_uri_for_prefix(ns_prefix);  
53
53
    xmlAttr* attr = xmlHasNsProp(const_cast<xmlNode*>(cobj()), (const xmlChar*)name.c_str(),
54
54
                                 (const xmlChar*)ns_uri.c_str());
55
 
        if( attr )
56
 
        {
 
55
    if( attr )
 
56
    {
57
57
      return reinterpret_cast<Attribute*>(attr->_private);
58
 
        }
 
58
    }
59
59
  }
60
60
 
61
61
  return 0;
62
62
}
63
63
 
 
64
Glib::ustring Element::get_attribute_value(const Glib::ustring& name, const Glib::ustring& ns_prefix) const
 
65
{
 
66
  const Attribute* attr = get_attribute(name, ns_prefix);
 
67
  return attr ? attr->get_value() : Glib::ustring();
 
68
}
 
69
 
64
70
Attribute* Element::set_attribute(const Glib::ustring& name, const Glib::ustring& value,
65
71
                                  const Glib::ustring& ns_prefix)
66
72
{
82
88
    }
83
89
    else
84
90
    {
 
91
      #ifdef LIBXMLCPP_EXCEPTIONS_ENABLED
85
92
      throw exception("The namespace prefix (" + ns_prefix + ") has not been declared.");
 
93
      #endif //LIBXMLCPP_EXCEPTIONS_ENABLED
86
94
    }
87
95
  }
88
96