shlomif / perl-XML-LibXML

The XML-LibXML CPAN Distribution for Processing XML using the libxml2 library
https://metacpan.org/release/XML-LibXML
Other
17 stars 35 forks source link

Provide a public version of LibXML_test_node_name from LibXML.xs #42

Open vinc17fr opened 4 years ago

vinc17fr commented 4 years ago

In some cases, e.g. in some format conversions to XML, it is useful to know whether a string is a valid Name. LibXML.xs has a function to do such a check: LibXML_test_node_name. But this function is not available in the public API. I suppose that a current solution would be to use XML::LibXML::Attr->new and test whether the result is defined, but that's overkill and the behavior in case of invalid name is even undocumented. Thus a public version of LibXML_test_node_name would be useful.

shlomif commented 4 years ago

In some cases, e.g. in some format conversions to XML, it is useful to know whether a string is a valid Name. LibXML.xs has a function to do such a check: LibXML_test_node_name. But this function is not available in the public API. I suppose that a current solution would be to use XML::LibXML::Attr->new and test whether the result is defined, but that's overkill and the behavior in case of invalid name is even undocumented. Thus a public version of LibXML_test_node_name would be useful.

@vinc17fr : I agree. Would you like to prepare a pull-req for that (with tests - see https://github.com/shlomif/what-you-should-know-about-automated-testing )?