*
kDerefError=
"dereferencing non initialised or out of range iterator";
67 const char*
kRefError=
"referencing non initialised or out of range iterator";
68 const char*
kAdvError=
"advancing non initialised or out of range iterator";
78from_find_(from_find) {
83from_find_(from_find) {
89from_find_(other.from_find_)
107 "produced by find(...) methods");
131pimpl_ =
new ait_impl(0,
static_cast<xmlAttrPtr
>(0),
false);
135 booldef_prop,
boolfrom_find) {
137pimpl_ =
new ait_impl(
static_cast<xmlNodePtr
>(
node),
140pimpl_ =
new ait_impl(
static_cast<xmlNodePtr
>(
node),
141 static_cast<xmlAttrPtr
>(prop), from_find);
199pimpl_ =
new ait_impl(0,
static_cast<xmlAttrPtr
>(0),
false);
206pimpl_ =
new ait_impl(
static_cast<xmlNodePtr
>(
node),
209pimpl_ =
new ait_impl(
static_cast<xmlNodePtr
>(
node),
210 static_cast<xmlAttrPtr
>(prop), from_find);
277xmlnode_(other.xmlnode_), prop_(other.prop_),
278phantom_prop_(other.phantom_prop_), value_(other.value_)
291value_.swap(other.
value_);
299phantom_prop_ = prop;
308 if(!xmlnode_)
return NULL;
309 if(prop_)
returnprop_;
312 if(
static_cast<phantom_attr*
>(phantom_prop_)->prop_)
313 return static_cast<phantom_attr*
>(phantom_prop_)->prop_;
324 boolxml::attributes::attr::operator==
326 returnnormalize() == other.normalize();
330 if(phantom_prop_ && (!
static_cast<phantom_attr*
>(phantom_prop_)->prop_))
337xmlAttributePtr dprop =
static_cast<phantom_attr*
>(phantom_prop_)->def_prop_;
340 return reinterpret_cast<const char*
>(dprop->name);
343 constxmlChar * name =
static_cast<xmlAttrPtr
>(prop_)->name;
344 return reinterpret_cast<const char*
>(name);
346 constxmlChar * name =
static_cast<phantom_attr*
>(phantom_prop_)->prop_->name;
347 return reinterpret_cast<const char*
>(name);
352xmlAttributePtr dprop =
static_cast<phantom_attr*
>(phantom_prop_)->def_prop_;
355 if(dprop->defaultValue)
356 return reinterpret_cast<const char*
>(dprop->defaultValue);
362tmpstr = xmlNodeListGetString(
reinterpret_cast<xmlNodePtr
>(xmlnode_)->doc,
363 reinterpret_cast<xmlAttrPtr
>(prop_)->children,
367tmpstr = xmlNodeListGetString(
reinterpret_cast<xmlNodePtr
>(xmlnode_)->doc,
368 reinterpret_cast<phantom_attr*
>(phantom_prop_)->prop_->children,
375value_.assign(
reinterpret_cast<const char*
>(tmpstr));
376 returnvalue_.c_str();
383definition =
static_cast<xmlNs*
>(resolve_default_attr_ns());
386xmlAttrPtr prop =
reinterpret_cast<xmlAttrPtr
>(prop_);
388prop =
reinterpret_cast<phantom_attr*
>(phantom_prop_)->prop_;
389definition = prop->ns;
394?
xml::ns(
reinterpret_cast<const char*
>(definition->prefix),
395 reinterpret_cast<const char*
>(definition->href))
408 "resolving non-default attribute namespace");
410xmlAttributePtr dprop =
static_cast<phantom_attr*
>(phantom_prop_)->def_prop_;
413xmlNs * definition(xmlSearchNs(
NULL,
reinterpret_cast<xmlNode*
>(xmlnode_),
417 throw xml::exception(
"cannot resolve default attribute namespace");
426xmlNs * definition =
static_cast<xmlNs*
>(resolve_default_attr_ns());
427xmlAttributePtr dprop =
static_cast<phantom_attr*
>(phantom_prop_)->def_prop_;
430xmlAttrPtr new_attr = xmlSetNsProp(
reinterpret_cast<xmlNode*
>(xmlnode_),
433dprop->defaultValue);
435 throw xml::exception(
"cannot convert default attribute into a regular one");
439 static_cast<phantom_attr*
>(phantom_prop_)->prop_ = new_attr;
445xmlAttrPtr prop =
reinterpret_cast<xmlAttrPtr
>(normalize());
446xmlSetNsProp(
reinterpret_cast<xmlNode*
>(xmlnode_),
449 reinterpret_cast<constxmlChar*
>(
value));
455xmlAttrPtr prop =
reinterpret_cast<xmlAttrPtr
>(normalize());
460 if(!prefix || prefix[0] ==
'\0') {
466xmlAttrPtr prop =
reinterpret_cast<xmlAttrPtr
>(normalize());
467xmlNs * definition(xmlSearchNs(
NULL,
reinterpret_cast<xmlNode*
>(xmlnode_),
468 reinterpret_cast<constxmlChar*
>(prefix)));
471prop->ns = definition;
482xmlAttrPtr prop =
reinterpret_cast<xmlAttrPtr
>(normalize());
488 const char* prefix(name_space.
get_prefix());
489 if(prefix[0] ==
'\0')
491xmlNs * definition(xmlSearchNs(
NULL,
reinterpret_cast<xmlNode*
>(xmlnode_),
492 reinterpret_cast<constxmlChar*
>(prefix)));
495 if(!xmlStrEqual(definition->href,
reinterpret_cast<constxmlChar*
>(name_space.
get_uri())))
496 throw xml::exception(
"Namespace definition URI differs to the given");
497prop->ns = definition;
513 const char*name,
const ns*nspace) {
517 if( (xmlnode ==
NULL) ||
518(xmlnode->type != XML_ELEMENT_NODE) ||
522 const ns* ns_to_match = nspace;
523 const char* name_to_match = name;
526 const char*
column= strchr(name,
':');
535 if(*(
column+ 1) ==
'\0')
539xmlNsPtr resolved_ns = xmlSearchNs(xmlnode->doc,
541 reinterpret_cast<constxmlChar*
>(prefix.c_str()));
545name_to_match =
column+ 1;
546ns_to_match =
new ns(
reinterpret_cast<const char*
>(resolved_ns->prefix),
547 reinterpret_cast<const char*
>(resolved_ns->href));
550xmlAttrPtr prop = xmlnode->properties;
551 for(; prop !=
NULL; prop = prop->next) {
552 if(xmlStrEqual(prop->name,
553 reinterpret_cast<constxmlChar*
>(name_to_match))) {
554 if(ns_util::attr_ns_match(prop, ns_to_match)) {
555 if(ns_to_match != nspace)
562 if(ns_to_match != nspace)
568 const char*name,
const ns*nspace) {
569 if(xmlnode->doc != 0) {
570xmlAttributePtr dtd_attr = 0;
571 constxmlChar* prefix = 0;
573 if(nspace && strlen(nspace->
get_prefix()) > 0)
574prefix =
reinterpret_cast<constxmlChar*
>(nspace->
get_prefix());
576 if(xmlnode->doc->intSubset != 0) {
578dtd_attr = xmlGetDtdQAttrDesc(xmlnode->doc->intSubset,
580 reinterpret_cast<constxmlChar*
>(name),
583dtd_attr = xmlGetDtdAttrDesc(xmlnode->doc->intSubset,
585 reinterpret_cast<constxmlChar*
>(name));
588 if(dtd_attr == 0 && xmlnode->doc->extSubset != 0) {
590dtd_attr = xmlGetDtdQAttrDesc(xmlnode->doc->extSubset,
592 reinterpret_cast<constxmlChar*
>(name),
595dtd_attr = xmlGetDtdAttrDesc(xmlnode->doc->extSubset,
597 reinterpret_cast<constxmlChar*
>(name));
600 if(dtd_attr != 0 && dtd_attr->defaultValue != 0) {
608 while(current !=
NULL) {
611current = current->
next;
620new_phantom->
next= current;
637 return!(lhs == rhs);
647 return!(lhs == rhs);
657 return!(lhs == rhs);
const char * kInvalidDefaultIterError
This file defines the xml::ait_impl class.
This file contains the definition of the xml::attributes class.
The xml::attributes::attr class is used to hold information about one attribute.
void erase_namespace(void)
Unset the attribute's namespace.
const char * get_value(void) const
Get the value of this attribute.
void * normalize(void) const
ns set_namespace(const char *prefix)
Set the attribute's namespace.
void * get_node(void) const
void set_data(void *node, void *prop, bool def_prop)
attr & operator=(const attr &other)
bool is_default(void) const
Test if the attribute is default.
void * resolve_default_attr_ns(void) const
ns get_namespace(ns::ns_safety_type type=ns::type_safe_ns) const
Get the attribute's namespace.
void set_value(const char *value)
Set the value of this attribute.
const char * get_name(void) const
Get the name of this attribute.
Const Iterator class for accessing attribute pairs.
const_iterator & operator=(const const_iterator &other)
pointer operator->(void) const
void swap(const_iterator &other)
reference operator*(void) const
const_iterator & operator++(void)
prefix increment
Iterator class for accessing attribute pairs.
pointer operator->(void) const
iterator & operator=(const iterator &other)
void swap(iterator &other)
reference operator*(void) const
iterator & operator++(void)
prefix increment
void swap(attributes &other)
Swap this xml::attributes object with another one.
static xml::ns createUnsafeNamespace(void *libxml2RawNamespace)
static void * getUnsafeNamespacePointer(const xml::ns &name_space)
This exception class is thrown by xmlwrapp for all runtime XML-related errors along with the xml::par...
the class that does all the work behind xml::attributes::iterator and xml::attributes::const_iterator...
ait_impl & operator=(const ait_impl &other)
ait_impl & operator++(void)
attributes::attr * get(void)
ait_impl(xmlNodePtr node, xmlAttrPtr prop, bool from_find)
The xml::node class is used to hold information about one XML node.
The xml::ns class is used to access and handle namespaces of nodes and attributes.
ns_safety_type
Namespace object "safety".
const char * get_prefix(void) const
Get the namespace prefix.
const char * get_uri(void) const
Get the namespace URI.
bool is_safe(void) const
Check if the object is safe i.e.
bool is_void(void) const
If a node or an attribute has no namespace, then a namespace with empty prefix and empty URI is retur...
This file contains declarations required for iterators dereferencing support.
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char * column
static TDSRET convert(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION direction, const char *from, size_t from_len, char *dest, size_t *dest_len)
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
This file contains the definition of the xml::exception class.
const GenericPointer< typename T::ValueType > T2 value
void * get_ptr_to_attr_instance(void *)
phantom_attr * find_default_prop(xmlNodePtr xmlnode, const char *name, const ns *nspace)
xmlAttrPtr find_prop(xmlNodePtr xmlnode, const char *name, const ns *nspace)
node_private_data * attach_node_private_data(void *)
bool operator==(const attributes::iterator &lhs, const attributes::iterator &rhs)
bool operator!=(const attributes::iterator &lhs, const attributes::iterator &rhs)
struct phantom_attr * phantom_attrs_
xmlAttributePtr def_prop_
struct phantom_attr * next
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4