Search in sources :

Example 26 with Element

use of org.w3c.dom.Element in project head by mifos.

the class TableTagParser method createPath.

protected Path[] createPath(Node table) throws TableTagParseException {
    NodeList pathNodeList = ((Element) table).getElementsByTagName(TableTagConstants.PATH);
    if (pathNodeList.getLength() == 0) {
        throw new TableTagParseException(TableTagConstants.UNEXPECTED_ERROR);
    }
    Path[] path = new Path[pathNodeList.getLength()];
    for (int i = 0; i < pathNodeList.getLength(); i++) {
        path[i] = new Path();
        path[i].setKey((pathNodeList.item(i).getAttributes().getNamedItem(TableTagConstants.KEY).getNodeValue()));
        path[i].setAction((pathNodeList.item(i).getAttributes().getNamedItem(TableTagConstants.PATHACTION).getNodeValue()));
        path[i].setForwardkey((pathNodeList.item(i).getAttributes().getNamedItem(TableTagConstants.FORWARDKEY).getNodeValue()));
    }
    return path;
}
Also used : TableTagParseException(org.mifos.framework.exceptions.TableTagParseException) NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element)

Example 27 with Element

use of org.w3c.dom.Element in project head by mifos.

the class TableTagParser method createDisplayName.

protected DisplayName createDisplayName(Node column) throws TableTagParseException {
    NodeList displayNodeList = ((Element) column).getElementsByTagName(TableTagConstants.DISPLAYNAME);
    DisplayName displayName = new DisplayName();
    setFragmentDetails(displayName, displayNodeList.item(0));
    displayName.setBold((displayNodeList.item(0).getAttributes().getNamedItem(TableTagConstants.BOLDDISPLAY).getNodeValue()));
    return displayName;
}
Also used : NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element)

Example 28 with Element

use of org.w3c.dom.Element in project head by mifos.

the class TypeParser method createFileName.

private FileName[] createFileName(Node file) throws TableTagTypeParserException {
    NodeList fileNameNodeList = ((Element) file).getElementsByTagName(TableTagConstants.FILENAME);
    if (fileNameNodeList.getLength() == 0) {
        throw new TableTagTypeParserException(fileNameNodeList.toString());
    }
    FileName[] fileName = new FileName[fileNameNodeList.getLength()];
    for (int i = 0; i < fileNameNodeList.getLength(); i++) {
        fileName[i] = new FileName();
        fileName[i].setName((fileNameNodeList.item(i).getAttributes().getNamedItem(TableTagConstants.NAME).getNodeValue()));
        fileName[i].setPath((fileNameNodeList.item(i).getAttributes().getNamedItem(TableTagConstants.PATH).getNodeValue()));
    }
    return fileName;
}
Also used : NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element) TableTagTypeParserException(org.mifos.framework.exceptions.TableTagTypeParserException)

Example 29 with Element

use of org.w3c.dom.Element in project head by mifos.

the class TableTagParser method createHeaderDetails.

protected HeaderDetails createHeaderDetails(Node table) throws TableTagParseException {
    NodeList headerNodeList = ((Element) table).getElementsByTagName(TableTagConstants.HEADERDETAILS);
    if (headerNodeList.getLength() == 0) {
        throw new TableTagParseException(headerNodeList.toString());
    }
    HeaderDetails headerDetails = new HeaderDetails();
    headerDetails.setHeaderStyle(headerNodeList.item(0).getAttributes().getNamedItem(TableTagConstants.HEADERSTYLE).getNodeValue());
    return headerDetails;
}
Also used : TableTagParseException(org.mifos.framework.exceptions.TableTagParseException) NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element)

Example 30 with Element

use of org.w3c.dom.Element in project head by mifos.

the class TableTagParser method createRow.

protected Row createRow(Node table) throws TableTagParseException {
    NodeList rowNodeList = ((Element) table).getElementsByTagName(TableTagConstants.ROW);
    if (rowNodeList.getLength() == 0) {
        throw new TableTagParseException(rowNodeList.toString());
    }
    Row row = new Row();
    row.setTotWidth((rowNodeList.item(0).getAttributes().getNamedItem(TableTagConstants.TOTWIDTH).getNodeValue()));
    row.setBottomLineRequired((rowNodeList.item(0).getAttributes().getNamedItem(TableTagConstants.BOTTOMLINEREQUIRED).getNodeValue()));
    row.setColumn(createColumn(rowNodeList.item(0)));
    return row;
}
Also used : TableTagParseException(org.mifos.framework.exceptions.TableTagParseException) NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element)

Aggregations

Element (org.w3c.dom.Element)9072 Document (org.w3c.dom.Document)2651 NodeList (org.w3c.dom.NodeList)2103 Node (org.w3c.dom.Node)1855 ArrayList (java.util.ArrayList)957 DocumentBuilder (javax.xml.parsers.DocumentBuilder)793 IOException (java.io.IOException)732 Test (org.junit.Test)693 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)591 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)489 HashMap (java.util.HashMap)434 SAXException (org.xml.sax.SAXException)406 File (java.io.File)358 Attr (org.w3c.dom.Attr)333 InputStream (java.io.InputStream)309 QName (javax.xml.namespace.QName)292 Map (java.util.Map)285 JAXBElement (javax.xml.bind.JAXBElement)285 NamedNodeMap (org.w3c.dom.NamedNodeMap)266 List (java.util.List)264