There are actually 3 ways of dealing with namespaces, 2 of which are supported by XML::Twig:
- proper support, your second example, which is correct, but verbose as you have to associated namespace URIs to prefixes; I also suspect that it is not as robust as one would expect, I don't quite trust those URIs to not change sneakily, especially for the default namespace,
- ignore namespace declarations is XML::Twig's default mode, there foo:ele is the element by that name, and ele is just ele, whether it is assigned a default namespace or not, you think of this as inconsistent,
- drop all namespaces, which is your first example, there foo:ele is seen as ele; I had never thought of that option, I could add it, but I strongly suspect that it would be one favored only by users who care about namespaces, and already use map_xmlns (or XML::LibXML!),
For XML::Twig, consistency is not as important as convenience, and I the current behaviour seems to be convenient for most users. I'll look into adding an option to just drop namespaces, it should not be too difficult, but I am not sure how useful it would be.