src/main/java/eu/digitisation/layout/SortPageXML.java
public static Document sorted(Document source) throws IOException {
        Document doc = DocumentBuilder.clone(source);
        NodeList groups = doc.getElementsByTagName("OrderedGroup");
        for (int n = 0; n < groups.getLength(); ++n) {
            Node group = groups.item(n);
            // group element -> ReadingOrder-> OrderedGroup
            Node container = group.getParentNode().getParentNode();
            List<String> order = readingOrder(group);
            sort(container, order);
        }
        return doc;
    }
/**
     * Create document where ordered groups follow the order information
     *
     * @param source the input document to be transformed
     * @return the transformed document
     * @throws java.io.IOException
     */
Create document where ordered groups follow the order information
@param source the input document to be transformed
@return the transformed document
@throws java.io.IOException
Create document where ordered groups follow the order information @param source the input document to be transformed @return the transformed document @throws java . io . IOException
public static Document sorted(Document source) throws IOException {
        Document doc = DocumentBuilder.clone(source);
        NodeList groups = doc.getElementsByTagName("OrderedGroup");
        for (int n = 0; n < groups.getLength(); ++n) {
            Node group = groups.item(n);
            Node container = group.getParentNode().getParentNode();
            List<String> order = readingOrder(group);
            sort(container, order);
        }
        return doc;
    }
public static Document sorted ( Document source ) throws IOException { Document doc = DocumentBuilder . clone ( source ) ; NodeList groups = doc . getElementsByTagName ( "OrderedGroup" ) ; for ( int n = 0 ; n < groups . getLength ( ) ; ++ n ) { Node group = groups . item ( n ) ; Node container = group . getParentNode ( ) . getParentNode ( ) ; List < String > order = readingOrder ( group ) ; sort ( container , order ) ; } return doc ; }
Create document where ordered groups follow the order information
 @param source the input document to be transformed
 @return the transformed document
 @throws java.io.IOException
Create document where ordered groups follow the order information @param source the input document to be transformed @return the transformed document @throws java . io . IOException
// group element -> ReadingOrder-> OrderedGroup