private void decorateRow()

in freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/TableSimplifier.java [366:423]


    private void decorateRow(
            Element tr, Alignment tDivAlign, VAlignment tDivVAlign)
            throws SAXException, DocgenException {
        addRowToCellMatrix();
        
        Alignment trAlign = null;
        VAlignment trVAlign = null;
        
        NamedNodeMap atts = tr.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)) {
                trAlign = parseAlignAttribute(attValue, E_TR);
            } else if (attName.equals(A_VALIGN)) {
                trVAlign = parseVAlignAttribute(attValue, E_TR);
            } else {
                throw new DocgenException("The \"" + attName
                        + "\" attribute of the \"" + E_TR
                        + "\" element is not supported by Docgen.");
            }
        }  // fetchAtts
        
        if (trAlign == null) {
            trAlign = tDivAlign;
        }
        if (trVAlign == null) {
            trVAlign = tDivVAlign;
        }
        
        NodeList children = tr.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_TD) || elemName.equals(E_TH)) {
                    decorateCell(elem, trAlign, trVAlign);
                } else {
                    throw new SAXException("The \"" + elemName + "\" should "
                            + "not occur inside \"" + E_TR + "\".");
                }
            }
            // Ignore non-elements
        }
    }