[jdom-interest] Attribute name verification special casing for xml:base

Elliotte Rusty Harold elharo at metalab.unc.edu
Sat Jun 15 19:35:44 PDT 2002


The checkAttributeName() method in Verifier currently allows xml:base
and xml:space as special cases:

    public static String checkAttributeName(String name) {
        // Check basic XML name rules first
        String reason;
        if ((reason = checkXMLName(name)) != null) {
            return reason;
        }

        // Allow xml:space, xml:lang, and xml:base as special cases
        if (name.equals("xml:space") ||
            name.equals("xml:lang")) {
            return null;
        }

At a minimum we need to add xml:base as another special case since it is
now officially endorsed by the W3C and has been for some time:


    public static String checkAttributeName(String name) {
        // Check basic XML name rules first
        String reason;
        if ((reason = checkXMLName(name)) != null) {
            return reason;
        }

        // Allow xml:space, xml:lang, and xml:base as special cases
        if (name.equals("xml:space") ||
            name.equals("xml:lang") || 
            name.equals("xml:base")) {
            return null;
        }

An alternative would be not to special case these at all, and just have
clients pass in the relevant namespaces and prefixes for xml: if they
want to use these attributes.

Thoughts?




More information about the jdom-interest mailing list