return xml_attrs_find(ctx->tab_attrs, node, name);
}
+char *
+xml_attr_value(struct xml_context *ctx, struct xml_node *node, char *name)
+{
+ struct xml_attr *attr = xml_attrs_find(ctx->tab_attrs, node, name);
+ if (attr)
+ return attr->val;
+ if (!node->dtd)
+ return NULL;
+ struct xml_dtd_attr *dtd = xml_dtd_find_attr(ctx, node->dtd, name);
+ return dtd ? dtd->default_value : NULL;
+}
+
void
xml_attrs_table_init(struct xml_context *ctx)
{
/* Finds a given attribute value in a XML_NODE_ELEM node */
struct xml_attr *xml_attr_find(struct xml_context *ctx, struct xml_node *node, char *name);
+/* Similar to xml_attr_find, but it deals also the default values */
+char *xml_attr_value(struct xml_context *ctx, struct xml_node *node, char *name);
+
/* The default value of h_find_entity(), knows <, >, &, ' and " */
struct xml_dtd_entity *xml_def_find_entity(struct xml_context *ctx, char *name);