protected final void copyNS ( final int nodeID , SerializationHandler handler , boolean inScope ) throws SAXException { // %OPT% Optimization for documents which does not have any explicit // namespace nodes. For these documents, there is an implicit // namespace node (xmlns:xml="http://www.w3.org/XML/1998/namespace") // declared on the root element node. In this case, there is no // need to do namespace copying. We can safely return without // doing anything. if ( m_namespaceDeclSetElements != null && m_namespaceDeclSetElements . size ( ) == 1 && m_namespaceDeclSets != null && ( ( SuballocatedIntVector ) m_namespaceDeclSets . elementAt ( 0 ) ) . size ( ) == 1 ) return ; SuballocatedIntVector nsContext = null ; int nextNSNode ; // Find the first namespace node if ( inScope ) { nsContext = findNamespaceContext ( nodeID ) ; if ( nsContext == null || nsContext . size ( ) < 1 ) return ; else nextNSNode = makeNodeIdentity ( nsContext . elementAt ( 0 ) ) ; } else nextNSNode = getNextNamespaceNode2 ( nodeID ) ; int nsIndex = 1 ; while ( nextNSNode != DTM . NULL ) { // Retrieve the name of the namespace node int eType = _exptype2 ( nextNSNode ) ; String nodeName = m_extendedTypes [ eType ] . getLocalName ( ) ; // Retrieve the node value of the namespace node int dataIndex = m_dataOrQName . elementAt ( nextNSNode ) ; if ( dataIndex < 0 ) { dataIndex = - dataIndex ; dataIndex = m_data . elementAt ( dataIndex + 1 ) ; } String nodeValue = ( String ) m_values . elementAt ( dataIndex ) ; handler . namespaceAfterStartElement ( nodeName , nodeValue ) ; if ( inScope ) { if ( nsIndex < nsContext . size ( ) ) { nextNSNode = makeNodeIdentity ( nsContext . elementAt ( nsIndex ) ) ; nsIndex ++ ; } else return ; } else nextNSNode = getNextNamespaceNode2 ( nextNSNode ) ; } }
Copy namespace nodes .