Class Nokogiri::XML::DTD inherits from Nokogiri::XML::Node
Public Instance Methods
- attributes() Show Source
Get a hash of the attributes for this DTD.
-
static VALUE attributes(VALUE self) { xmlDtdPtr dtd; VALUE hash; Data_Get_Struct(self, xmlDtd, dtd); if(!dtd->attributes) return Qnil; hash = rb_hash_new(); xmlHashScan((xmlHashTablePtr)dtd->attributes, element_copier, (void *)hash); return hash; }
- elements() Show Source
Get a hash of the elements for this DTD.
-
static VALUE elements(VALUE self) { xmlDtdPtr dtd; VALUE hash; Data_Get_Struct(self, xmlDtd, dtd); if(!dtd->elements) return Qnil; hash = rb_hash_new(); xmlHashScan((xmlHashTablePtr)dtd->elements, element_copier, (void *)hash); return hash; }
- entities() Show Source
Get a hash of the elements for this DTD.
-
static VALUE entities(VALUE self) { xmlDtdPtr dtd; VALUE hash; Data_Get_Struct(self, xmlDtd, dtd); if(!dtd->entities) return Qnil; hash = rb_hash_new(); xmlHashScan((xmlHashTablePtr)dtd->entities, element_copier, (void *)hash); return hash; }
- external_id() Show Source
Get the External ID for this DTD
-
static VALUE external_id(VALUE self) { xmlDtdPtr dtd; Data_Get_Struct(self, xmlDtd, dtd); if(!dtd->ExternalID) return Qnil; return NOKOGIRI_STR_NEW2(dtd->ExternalID); }
- notations() Show Source
Get a hash of the notations for this DTD.
-
static VALUE notations(VALUE self) { xmlDtdPtr dtd; VALUE hash; Data_Get_Struct(self, xmlDtd, dtd); if(!dtd->notations) return Qnil; hash = rb_hash_new(); xmlHashScan((xmlHashTablePtr)dtd->notations, notation_copier, (void *)hash); return hash; }
- system_id() Show Source
Get the System ID for this DTD
-
static VALUE system_id(VALUE self) { xmlDtdPtr dtd; Data_Get_Struct(self, xmlDtd, dtd); if(!dtd->SystemID) return Qnil; return NOKOGIRI_STR_NEW2(dtd->SystemID); }
- validate(p1) Show Source
Validate document returning a list of errors
-
static VALUE validate(VALUE self, VALUE document) { xmlDocPtr doc; xmlDtdPtr dtd; xmlValidCtxtPtr ctxt; VALUE error_list; Data_Get_Struct(self, xmlDtd, dtd); Data_Get_Struct(document, xmlDoc, doc); error_list = rb_ary_new(); ctxt = xmlNewValidCtxt(); xmlSetStructuredErrorFunc((void *)error_list, Nokogiri_error_array_pusher); xmlValidateDtd(ctxt, doc, dtd); xmlSetStructuredErrorFunc(NULL, NULL); xmlFreeValidCtxt(ctxt); return error_list; }