private void writeParent ( Account account , XmlStreamWriter writer ) throws Exception { // Sequence block writer . writeStartElement ( "RDF:Seq" ) ; writer . writeAttribute ( "RDF:about" , account . getId ( ) ) ; for ( Account child : account . getChildren ( ) ) { logger . fine ( " Write-RDF:li: " + child . getId ( ) ) ; writer . writeStartElement ( "RDF:li" ) ; writer . writeAttribute ( "RDF:resource" , child . getId ( ) ) ; writer . writeEndElement ( ) ; } writer . writeEndElement ( ) ; // Descriptions of all elements including the parent writeDescription ( account , writer ) ; for ( Account child : account . getChildren ( ) ) { logger . fine ( "Write-RDF:Desc: " + child . getName ( ) ) ; writeDescription ( child , writer ) ; } // Recurse into the children for ( Account child : account . getChildren ( ) ) { if ( child . getChildren ( ) . size ( ) > 0 ) { writeParent ( child , writer ) ; } } }
Writes a parent node to the stream recursing into any children .