/* * call-seq: * node.xlink_type -> num * * Obtain the type identifier for this xlink, if applicable. * If this is not an xlink node (see +xlink?+), will return * nil. */ static VALUE rxml_node_xlink_type(VALUE self) { xmlNodePtr xnode; xlinkType xlt; xnode = rxml_get_xnode(self); xlt = xlinkIsLink(xnode->doc, xnode); if (xlt == XLINK_TYPE_NONE) return (Qnil); else return (INT2NUM(xlt)); }
/* * call-seq: * node.xlink? -> (true|false) * * Determine whether this node is an xlink node. */ static VALUE rxml_node_xlink_q(VALUE self) { xmlNodePtr xnode; xlinkType xlt; xnode = rxml_get_xnode(self); xlt = xlinkIsLink(xnode->doc, xnode); if (xlt == XLINK_TYPE_NONE) return (Qfalse); else return (Qtrue); }
/* * call-seq: * node.xlink? -> (true|false) * * Determine whether this node is an xlink node. */ static VALUE rxml_node_xlink_q(VALUE self) { xmlNodePtr xnode; xlinkType xlt; Data_Get_Struct(self, xmlNode, xnode); xlt = xlinkIsLink(xnode->doc, xnode); if (xlt == XLINK_TYPE_NONE) return (Qfalse); else return (Qtrue); }
/* * call-seq: * node.xlink_type_name -> "string" * * Obtain the type name for this xlink, if applicable. * If this is not an xlink node (see +xlink?+), will return * nil. */ static VALUE rxml_node_xlink_type_name(VALUE self) { xmlNodePtr xnode; xlinkType xlt; xnode = rxml_get_xnode(self); xlt = xlinkIsLink(xnode->doc, xnode); switch (xlt) { case XLINK_TYPE_NONE: return (Qnil); case XLINK_TYPE_SIMPLE: return (rxml_new_cstr("simple", NULL)); case XLINK_TYPE_EXTENDED: return (rxml_new_cstr("extended", NULL)); case XLINK_TYPE_EXTENDED_SET: return (rxml_new_cstr("extended_set", NULL)); default: rb_fatal("Unknowng xlink type, %d", xlt); } }
/* * call-seq: * node.xlink_type_name -> "string" * * Obtain the type name for this xlink, if applicable. * If this is not an xlink node (see +xlink?+), will return * nil. */ static VALUE rxml_node_xlink_type_name(VALUE self) { xmlNodePtr xnode; xlinkType xlt; Data_Get_Struct(self, xmlNode, xnode); xlt = xlinkIsLink(xnode->doc, xnode); switch (xlt) { case XLINK_TYPE_NONE: return (Qnil); case XLINK_TYPE_SIMPLE: return (rxml_str_new2("simple", xnode->doc ? xnode->doc->encoding : NULL)); case XLINK_TYPE_EXTENDED: return (rxml_str_new2("extended", xnode->doc ? xnode->doc->encoding : NULL)); case XLINK_TYPE_EXTENDED_SET: return (rxml_str_new2("extended_set", xnode->doc ? xnode->doc->encoding : NULL)); default: rb_fatal("Unknowng xlink type, %d", xlt); } }