public void namespace(int namespaceCode, int properties) throws XPathException {
        try {
            String nsprefix = namePool.getPrefixFromNamespaceCode(namespaceCode);
            String nsuri = namePool.getURIFromNamespaceCode(namespaceCode);

            int len = nsuri.length() + nsprefix.length() + 8;
            String sep = " ";
            if (indenting && (totalAttributeLength + len) > 80 && totalAttributeLength != 0) {
                sep = getAttributeIndentString();
            }
            totalAttributeLength += len;

            if (nsprefix.length() == 0) {
                writer.write(sep);
                writeAttribute(elementCode, "xmlns", nsuri, 0);
            } else if (nsprefix.equals("xml")) {
                //return;
            } else {
                int badchar = testCharacters(nsprefix);
                if (badchar!=0) {
                    XPathException err = new XPathException("Namespace prefix contains a character (decimal + " +
                            badchar + ") not available in the selected encoding");
                    err.setErrorCode("SERE0008");
                    throw err;
                }
                if (undeclareNamespaces || nsuri.length() != 0) {
                    writer.write(sep);
                    writeAttribute(elementCode, "xmlns:" + nsprefix, nsuri, 0);
                }
            }
        } catch (java.io.IOException err) {
            throw new XPathException(err);
        }
    }