private void decorateTDiv()

in freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/TableSimplifier.java [310:364]


    private void decorateTDiv(Element tDiv)
            throws SAXException, DocgenException {
        initCellMatrix();
        
        Alignment tDivAlign = null;  // "div" refers to tbody, thead or tfoot
        VAlignment tDivVAlign = null;
        
        NamedNodeMap atts = tDiv.getAttributes();
        int attCnt = atts.getLength();
        fetchAtts: for (int attIdx = 0; attIdx < attCnt; attIdx++) {
            Attr att = (Attr) atts.item(attIdx);
            String attNS = att.getNamespaceURI();
            if (attNS != null && attNS.length() != 0) {
                continue fetchAtts;
            }
            String attName = att.getLocalName();
            String attValue = att.getValue().trim();
            
            if (attName.equals(A_ALIGN)) {
                tDivAlign = parseAlignAttribute(
                        attValue, tDiv.getLocalName());
            } else if (attName.equals(A_VALIGN)) {
                tDivVAlign = parseVAlignAttribute(
                        attValue, tDiv.getLocalName());
            } else {
                throw new DocgenException("The \"" + attName
                        + "\" attribute of the \"" + tDiv.getLocalName()
                        + "\" element is not supported by Docgen.");
            }
        }  // fetchAtts
        
        NodeList children = tDiv.getChildNodes();
        int childCnt = children.getLength();
        fetchChildren: for (int childIdx = 0; childIdx < childCnt; childIdx++) {
            Node child = children.item(childIdx);
            if (child instanceof Element) {
                Element elem = (Element) child;
                if (!elem.getNamespaceURI().equals(XMLNS_DOCBOOK5)) {
                    continue fetchChildren;
                }
                String elemName = elem.getLocalName();
                
                if (elemName.equals(E_TR)) {
                    decorateRow(elem, tDivAlign, tDivVAlign);
                } else {
                    throw new SAXException("The \"" + elemName + "\" should "
                            + "not occur inside \"" + tDiv.getLocalName()
                            + "\".");
                }
            }
            // Ignore non-elements
        }
        
        checkFinishedCellMatrix();
    }