try {  namespace = dom.lookupNamespace(node, prefix); } catch(RuntimeException e) { handler.flushPending(); NamespaceMappings nm = handler.getNamespaceMappings(); namespace = nm.lookupNamespace(prefix); if (namespace == null) { runTimeError(NAMESPACE_PREFIX_ERR,prefix); } }
runTimeError(NAMESPACE_PREFIX_ERR,prefix);
    public static String startXslElement(String qname, String namespace,	SerializationHandler handler, DOM dom, int node)    {        try {            // Get prefix from qname            String prefix;            final int index = qname.indexOf(':');                        if (index > 0) {                prefix = qname.substring(0, index);                                // Handle case when prefix is not known at compile time                if (namespace == null || namespace.length() == 0) {                    try {                        // not sure if this line of code ever works                        namespace = dom.lookupNamespace(node, prefix);                    }                    catch(RuntimeException e) {                        handler.flushPending();  // need to flush or else can't get namespacemappings                        NamespaceMappings nm = handler.getNamespaceMappings();                        namespace = nm.lookupNamespace(prefix);                        if (namespace == null) {                            runTimeError(NAMESPACE_PREFIX_ERR,prefix);                        }                    }                }                                handler.startElement(namespace, qname.substring(index+1),                                         qname);                handler.namespaceAfterStartElement(prefix, namespace);             }            else {                                      // Need to generate a prefix?                if (namespace != null && namespace.length() > 0) {                    prefix = generatePrefix();                    qname = prefix + ':' + qname;                       handler.startElement(namespace, qname, qname);                       handler.namespaceAfterStartElement(prefix, namespace);                }                else {                    handler.startElement(null, null, qname);                   }            }        }        catch (SAXException e) {            throw new RuntimeException(e.getMessage());        }            return qname;    }    