org.allcolor.yahp.cl.converter
Class CDocumentCut

java.lang.Object
  extended by org.allcolor.yahp.cl.converter.CDocumentCut

public class CDocumentCut
extends java.lang.Object

This class handle the {'http://www.allcolor.org/xmlns/yahp','pb'} tag and cut document in multiples documents according to it.

Version:
0.94
Author:
Quentin Anciaux

Nested Class Summary
private static class CDocumentCut.PbDocument
          Represend a part of a document between two pagebreak.
 
Constructor Summary
CDocumentCut()
           
 
Method Summary
private static void copyHeader(org.w3c.dom.Document doc, org.w3c.dom.Document ndoc)
          Copy the html header from doc to ndoc
static org.w3c.dom.Document[] cut(org.w3c.dom.Document doc)
          Cut the given document
private static CDocumentCut.PbDocument[] getPbDocs(org.w3c.dom.NodeList nl)
          Return the pagebreaks
private static boolean isDescendant(org.w3c.dom.Node n, org.w3c.dom.Node ref)
          return true if n is a descendant of ref
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDocumentCut

public CDocumentCut()
Method Detail

cut

public static org.w3c.dom.Document[] cut(org.w3c.dom.Document doc)
Cut the given document

Parameters:
doc - the document to cut
Returns:
an array of document

isDescendant

private static boolean isDescendant(org.w3c.dom.Node n,
                                    org.w3c.dom.Node ref)
return true if n is a descendant of ref

Parameters:
n - node to test
ref - reference node
Returns:
true if n is a descendant of ref

getPbDocs

private static CDocumentCut.PbDocument[] getPbDocs(org.w3c.dom.NodeList nl)
Return the pagebreaks

Parameters:
nl - pagebreaks nodelist
Returns:
an array of subdoc composed of space between pb.

copyHeader

private static void copyHeader(org.w3c.dom.Document doc,
                               org.w3c.dom.Document ndoc)
Copy the html header from doc to ndoc

Parameters:
doc - source of html header
ndoc - destination