context.declareInScopeNamespace(nsQName.getLocalName(), nsQName.getNamespaceURI());
if ("xmlns".equals(nsQName.getLocalName())) context.declareInScopeNamespace("", nsQName.getNamespaceURI()); else context.declareInScopeNamespace(nsQName.getLocalName(), nsQName.getNamespaceURI());
    private void copyStartNode(NodeImpl node, DocumentBuilderReceiver receiver, boolean expandRefs)            throws SAXException {        int nr = node.nodeNumber;        switch (node.getNodeType()) {            case Node.ELEMENT_NODE:                QName nodeName = (QName) document.namePool                        .get(document.nodeName[nr]);                receiver.startElement(nodeName, null);                int attr = document.alpha[nr];                if (-1 < attr) {                    while (attr < document.nextAttr                            && document.attrParent[attr] == nr) {                        QName attrQName = (QName) document.namePool                                .get(document.attrName[attr]);                        receiver.attribute(attrQName, attrValue[attr]);                        ++attr;                    }                }                int ns = document.alphaLen[nr];                if (-1 < ns) {                	XQueryContext context = receiver.getContext();                	while (ns < document.nextNamespace                			&& document.namespaceParent[ns] == nr) {                		QName nsQName = (QName) document.namePool                        	.get(document.namespaceCode[ns]);                		receiver.addNamespaceNode(nsQName);                		context.declareInScopeNamespace(nsQName.getLocalName(), nsQName.getNamespaceURI());                		++ns;                	}                }                break;            case Node.TEXT_NODE:                receiver.characters(document.characters, document.alpha[nr],                        document.alphaLen[nr]);                break;            case Node.ATTRIBUTE_NODE:                QName attrQName = (QName) document.namePool.get(document.attrName[nr]);                receiver.attribute(attrQName, attrValue[nr]);                break;            case Node.COMMENT_NODE:                receiver.comment(document.characters, document.alpha[nr],                        document.alphaLen[nr]);                break;            case Node.PROCESSING_INSTRUCTION_NODE:                QName qn = (QName) document.namePool.get(document.nodeName[nr]);                String data = new String(document.characters,                        document.alpha[nr], document.alphaLen[nr]);                receiver.processingInstruction(qn.getLocalName(), data);                break;            case NodeImpl.REFERENCE_NODE:                if(expandRefs) {                    Serializer serializer = context.getBroker().getSerializer();                    serializer.reset();                    serializer.setProperty(Serializer.GENERATE_DOC_EVENTS, "false");                    serializer.setReceiver(receiver);                    serializer.toReceiver(document.references[document.alpha[nr]]);                } else {                    receiver.addReferenceNode(document.references[document.alpha[nr]]);                }                break;        }    }