OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 17 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17 Rev 180
Line 45... Line 45...
45
     * @param qName a qualified name, eg "office:text".
45
     * @param qName a qualified name, eg "office:text".
46
     * @return the prefix or <code>null</code> if there's none, eg "office".
46
     * @return the prefix or <code>null</code> if there's none, eg "office".
47
     */
47
     */
48
    public final static String namespace(String qName) {
48
    public final static String namespace(String qName) {
49
        qName = basename(qName);
49
        qName = basename(qName);
50
        final int colonIndex = qName.lastIndexOf(':');
-
 
51
        if (colonIndex < 0)
-
 
52
            return null;
-
 
53
        else
-
 
54
            return qName.substring(0, colonIndex);
50
        return XMLUtils.splitQualifiedName(qName).get0();
55
    }
51
    }
56
 
52
 
57
    /**
53
    /**
58
     * Compute the local name of a qualified name. NOTE : this also works if qName is a path, eg
54
     * Compute the local name of a qualified name. NOTE : this also works if qName is a path, eg
59
     * "./office:body/office:text" or if there's no prefix, eg "./office:body/child".
55
     * "./office:body/office:text" or if there's no prefix, eg "./office:body/child".
Line 61... Line 57...
61
     * @param qName a qualified name, eg "office:text".
57
     * @param qName a qualified name, eg "office:text".
62
     * @return the local name, eg "text".
58
     * @return the local name, eg "text".
63
     */
59
     */
64
    public final static String localName(String qName) {
60
    public final static String localName(String qName) {
65
        qName = basename(qName);
61
        qName = basename(qName);
66
        return qName.substring(qName.lastIndexOf(':') + 1);
62
        return XMLUtils.splitQualifiedName(qName).get1();
67
    }
63
    }
68
 
64
 
69
    private XPathUtils() {
65
    private XPathUtils() {
70
        // static only
66
        // static only
71
    }
67
    }