@@ -132,8 +132,8 @@ static VALUE rxml_dtd_type(VALUE self)
132132 *
133133 * * The first usage creates a DTD from a string and requires 1 parameter.
134134 * * The second usage loads and parses an external DTD and requires 2 parameters.
135- * * The third usage creates a new internal or external DTD and requires 3 parameters and 2 optional parameters.
136- * It then attaches the DTD to the specified document if it is not nil
135+ * * The third usage creates a new internal or external DTD and requires 2 parameters and 3 optional parameters.
136+ * The DTD is then attached to the specified document if it is not nil.
137137 *
138138 * Parameters:
139139 *
@@ -160,16 +160,19 @@ static VALUE rxml_dtd_initialize(int argc, VALUE *argv, VALUE self)
160160 xmlDocPtr xdoc = NULL ;
161161
162162 VALUE name , doc , internal ;
163- rb_scan_args (argc , argv , "32 " , & external , & system , & name , & doc , & internal );
163+ rb_scan_args (argc , argv , "23 " , & external , & system , & name , & doc , & internal );
164164
165165 Check_Type (external , T_STRING );
166166 xpublic = (const xmlChar * ) StringValuePtr (external );
167167
168168 Check_Type (system , T_STRING );
169169 xsystem = (const xmlChar * ) StringValuePtr (system );
170170
171- Check_Type (name , T_STRING );
172- xname = (const xmlChar * ) StringValuePtr (name );
171+ if (name != Qnil )
172+ {
173+ Check_Type (name , T_STRING );
174+ xname = (const xmlChar * )StringValuePtr (name );
175+ }
173176
174177 if (doc != Qnil )
175178 {
0 commit comments