Code example for DOMException

0
        if (prefixSeparator != -1) {
            String prefix = name.substring(0, prefixSeparator);
            String localName = name.substring(prefixSeparator + 1);
             
            if (!DocumentImpl.isXMLIdentifier(prefix) || !DocumentImpl.isXMLIdentifier(localName)) {
                throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
            } 
        } else { 
            if (!DocumentImpl.isXMLIdentifier(name)) {
                throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
            } 
        } 
         
        this.localName = name;
    } 
 
    @Override 
    public String getLocalName() {
        return namespaceAware ? localName : null;
    }