Example usage for org.w3c.dom Attr getNodeName

List of usage examples for org.w3c.dom Attr getNodeName

Introduction

In this page you can find the example usage for org.w3c.dom Attr getNodeName.

Prototype

public String getNodeName();

Source Link

Document

The name of this node, depending on its type; see the table above.

Usage

From source file:eu.elf.license.LicenseQueryHandler.java

/**
 * Gets the price of the License Model/*from  w w w.  j a v a  2  s  .c o m*/
 *
 * @param lm     - LicenseModel object
 * @param userId - UserId
 * @throws Exception
 * @return         - ProductPriceSum as String
 */
public String getLicenseModelPrice(LicenseModel lm, String userId) throws Exception {
    StringBuffer buf = null;
    String productPriceSum = "";
    List<LicenseParam> lpList = lm.getParams();

    String productPriceQuery = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
            + "<wpos:WPOSRequest xmlns:wpos=\"http://www.conterra.de/wpos/1.1\" version=\"1.1.0\">"
            + "<wpos:GetPrice collapse=\"true\">" + "<wpos:Product id=\""
            + StringEscapeUtils.escapeXml10(lm.getId()) + "\">" + "<wpos:ConfigParams>";

    for (int i = 0; i < lpList.size(); i++) {
        if (lpList.get(i).getParameterClass().equals("configurationParameter")) {

            LicenseParam lp = (LicenseParam) lpList.get(i);

            String priceQuery = "<wpos:Parameter name=\"" + StringEscapeUtils.escapeXml10(lp.getName()) + "\">";

            if (lp instanceof LicenseParamInt) {
                LicenseParamInt lpi = (LicenseParamInt) lp;

                priceQuery += "<wpos:Value selected=\"true\">" + lpi.getValue() + "</wpos:Value>"
                        + "</wpos:Parameter>";
            } else if (lp instanceof LicenseParamBln) {
                LicenseParamBln lpBln = (LicenseParamBln) lp;

                priceQuery += "<wpos:Value selected=\"true\">" + lpBln.getValue() + "</wpos:Value>"
                        + "</wpos:Parameter>";
            } else if (lp instanceof LicenseParamDisplay) {
                LicenseParamDisplay lpd = (LicenseParamDisplay) lp;
                List<String> values = lpd.getValues();

                if (lp.getName().equals("LICENSE_USER_GROUP")) {
                    priceQuery += "<wpos:Value>Users</wpos:Value>";

                } else if (lp.getName().equals("LICENSE_USER_ID")) {
                    priceQuery += "<wpos:Value>" + userId + "</wpos:Value>";

                } else {
                    for (int l = 0; l < values.size(); l++) {
                        priceQuery += "<wpos:Value selected=\"true\">"
                                + StringEscapeUtils.escapeXml10(values.get(l)) + "</wpos:Value>";
                    }
                }

                priceQuery += "</wpos:Parameter>";
            } else if (lp instanceof LicenseParamEnum) {
                LicenseParamEnum lpEnum = (LicenseParamEnum) lp;

                List<String> tempOptions = lpEnum.getOptions();
                List<String> tempSelections = lpEnum.getSelections();

                if (tempSelections.size() == 0) {
                    priceQuery = "";
                } else {
                    String selectionsString = "";

                    for (int j = 0; j < tempSelections.size(); j++) {
                        if (j == 0) {
                            selectionsString = tempSelections.get(j);
                        } else {
                            selectionsString += ", " + tempSelections.get(j);
                        }
                    }

                    priceQuery += "<wpos:Value selected=\"true\">"
                            + StringEscapeUtils.escapeXml10(selectionsString) + "</wpos:Value>"
                            + "</wpos:Parameter>";
                }
            } else if (lp instanceof LicenseParamText) {
                LicenseParamText lpText = (LicenseParamText) lp;
                List<String> values = lpText.getValues();

                for (int k = 0; k < values.size(); k++) {
                    priceQuery += "<wpos:Value selected=\"true\">" + lpText.getValues() + "</wpos:Value>";
                }
                priceQuery += "</wpos:Parameter>";
            }

            productPriceQuery += priceQuery;
        }

    }

    productPriceQuery += "</wpos:ConfigParams>" + "</wpos:Product>" + "</wpos:GetPrice>"
            + "</wpos:WPOSRequest>";

    //System.out.println("query: "+productPriceQuery.toString());

    try {
        buf = doHTTPQuery(this.wposURL, "post", productPriceQuery, false);
        //System.out.println("response: "+buf.toString());

        // Get productPriceInfo from the response
        Document xmlDoc = LicenseParser.createXMLDocumentFromString(buf.toString());
        Element catalogElement = (Element) xmlDoc
                .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "catalog").item(0);
        NodeList productGroupElementList = catalogElement
                .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "productGroup");

        for (int m = 0; m < productGroupElementList.getLength(); m++) {
            Element productGroupElement = (Element) productGroupElementList.item(m);
            Element calculationElement = (Element) productGroupElement
                    .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "calculation").item(0);
            Element declarationListElement = (Element) calculationElement
                    .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "declarationList").item(0);
            Element referencedParametersElement = (Element) declarationListElement
                    .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "referencedParameters").item(0);
            NodeList referencedParametersParameterList = referencedParametersElement
                    .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "parameter");

            for (int n = 0; n < referencedParametersParameterList.getLength(); n++) {
                Element referencedParametersParameterElement = (Element) referencedParametersParameterList
                        .item(n);

                NamedNodeMap referencedParametersParameterAttributeMap = referencedParametersParameterElement
                        .getAttributes();

                for (int o = 0; o < referencedParametersParameterAttributeMap.getLength(); o++) {
                    Attr attrs = (Attr) referencedParametersParameterAttributeMap.item(o);

                    if (attrs.getNodeName().equals("name")) {
                        if (attrs.getNodeValue().equals("productPriceSum")) {
                            Element valueElement = (Element) referencedParametersParameterElement
                                    .getElementsByTagNameNS("http://www.conterra.de/xcpf/1.1", "value").item(0);

                            productPriceSum = valueElement.getTextContent();
                        }
                    }
                }

            }

        }

    } catch (Exception e) {
        throw e;
    }

    return productPriceSum;
}

From source file:org.mumod.android.provider.StatusNet.java

private String getTagValueWithMultiItem(Element eElement) {
    String returnVal = "";
    Node eNode;/*  www . java2s  .c om*/
    int NumOFItem = eElement.getElementsByTagName("link").getLength();
    for (int y = 0; y < NumOFItem; y++) {
        eNode = eElement.getElementsByTagName("link").item(y);
        NamedNodeMap attributes = eNode.getAttributes();
        for (int g = 0; g < attributes.getLength(); g++) {
            Attr attribute = (Attr) attributes.item(g);
            if (attribute.getNodeName().equals("rel") && attribute.getNodeValue().equals("alternate")) {
                try {
                    if (eNode.getAttributes().getNamedItem("type").getNodeValue()
                            .equals("application/atom+xml"))
                        returnVal = eNode.getAttributes().getNamedItem("href").getNodeValue();
                } catch (Exception e) {
                    if (MustardApplication.DEBUG)
                        e.printStackTrace();
                }
            }
        }
    }
    return returnVal;
}

From source file:com.nridge.core.base.io.xml.DSCriteriaXML.java

/**
 * Parses an XML DOM element and loads it into a criteria.
 *
 * @param anElement DOM element.//  w ww  .  j a v  a2 s  . c o m
 *
 * @throws java.io.IOException I/O related exception.
 */
@Override
public void load(Element anElement) throws IOException {
    Node nodeItem;
    Attr nodeAttr;
    Element nodeElement;
    DataField dataField;
    String nodeName, nodeValue, logicalOperator;

    String className = mDSCriteria.getClass().getName();
    String attrValue = anElement.getAttribute("type");
    if ((StringUtils.isNotEmpty(attrValue)) && (!IO.isTypesEqual(attrValue, className)))
        throw new IOException("Unsupported type: " + attrValue);

    attrValue = anElement.getAttribute("name");
    if (StringUtils.isNotEmpty(attrValue))
        mDSCriteria.setName(attrValue);

    NamedNodeMap namedNodeMap = anElement.getAttributes();
    int attrCount = namedNodeMap.getLength();
    for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) {
        nodeAttr = (Attr) namedNodeMap.item(attrOffset);
        nodeName = nodeAttr.getNodeName();
        nodeValue = nodeAttr.getNodeValue();

        if (StringUtils.isNotEmpty(nodeValue)) {
            if ((StringUtils.equalsIgnoreCase(nodeName, "name"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "type")))
                continue;
            else
                mDSCriteria.addFeature(nodeName, nodeValue);
        }
    }

    NodeList nodeList = anElement.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        nodeItem = nodeList.item(i);

        if (nodeItem.getNodeType() != Node.ELEMENT_NODE)
            continue;

        nodeName = nodeItem.getNodeName();
        if (nodeName.equalsIgnoreCase(IO.XML_FIELD_NODE_NAME)) {
            nodeElement = (Element) nodeItem;
            dataField = mDataFieldXML.load(nodeElement);
            if (dataField != null) {
                logicalOperator = dataField.getFeature("operator");
                if (StringUtils.isEmpty(logicalOperator))
                    logicalOperator = Field.operatorToString(Field.Operator.EQUAL);
                mDSCriteria.add(dataField, Field.stringToOperator(logicalOperator));
            }
        }
    }
}

From source file:com.nridge.core.base.io.xml.DataFieldXML.java

public DataField load(Element anElement) throws IOException {
    Attr nodeAttr;
    Node nodeItem;/*from ww w.  j  av  a  2  s  .  c o  m*/
    DataField dataField;
    Element nodeElement;
    Field.Type fieldType;
    String nodeName, nodeValue;

    String attrValue = anElement.getAttribute("name");
    if (StringUtils.isNotEmpty(attrValue)) {
        String fieldName = attrValue;
        attrValue = anElement.getAttribute("type");
        if (StringUtils.isNotEmpty(attrValue))
            fieldType = Field.stringToType(attrValue);
        else
            fieldType = Field.Type.Text;
        dataField = new DataField(fieldType, fieldName);

        NamedNodeMap namedNodeMap = anElement.getAttributes();
        int attrCount = namedNodeMap.getLength();
        for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) {
            nodeAttr = (Attr) namedNodeMap.item(attrOffset);
            nodeName = nodeAttr.getNodeName();
            nodeValue = nodeAttr.getNodeValue();

            if (StringUtils.isNotEmpty(nodeValue)) {
                if ((StringUtils.equalsIgnoreCase(nodeName, "name"))
                        || (StringUtils.equalsIgnoreCase(nodeName, "type"))
                        || (StringUtils.equalsIgnoreCase(nodeName, "rangeType")))
                    continue;
                else if (StringUtils.equalsIgnoreCase(nodeName, "title"))
                    dataField.setTitle(nodeValue);
                else if (StringUtils.equalsIgnoreCase(nodeName, "isMultiValue"))
                    dataField.setMultiValueFlag(StrUtl.stringToBoolean(nodeValue));
                else if (StringUtils.equalsIgnoreCase(nodeName, "displaySize"))
                    dataField.setDisplaySize(Field.createInt(nodeValue));
                else if (StringUtils.equalsIgnoreCase(nodeName, "sortOrder"))
                    dataField.setSortOrder(Field.Order.valueOf(nodeValue));
                else if (StringUtils.equalsIgnoreCase(nodeName, "defaultValue"))
                    dataField.setDefaultValue(nodeValue);
                else
                    dataField.addFeature(nodeName, nodeValue);
            }
        }
        String rangeType = anElement.getAttribute("rangeType");
        if (StringUtils.isNotEmpty(rangeType)) {
            NodeList nodeList = anElement.getChildNodes();
            for (int i = 0; i < nodeList.getLength(); i++) {
                nodeItem = nodeList.item(i);

                if (nodeItem.getNodeType() != Node.ELEMENT_NODE)
                    continue;

                nodeName = nodeItem.getNodeName();
                if (StringUtils.equalsIgnoreCase(nodeName, "Range")) {
                    nodeElement = (Element) nodeItem;
                    dataField.setRange(mRangeXML.load(nodeElement));
                } else if (StringUtils.equalsIgnoreCase(nodeName, "Value")) {
                    nodeValue = XMLUtl.getNodeStrValue(nodeItem);
                    String mvDelimiter = dataField.getFeature(Field.FEATURE_MV_DELIMITER);
                    if (StringUtils.isNotEmpty(mvDelimiter))
                        dataField.expand(nodeValue, mvDelimiter.charAt(0));
                    else
                        dataField.expand(nodeValue);
                }
            }
        } else {
            nodeItem = (Node) anElement;
            if (dataField.isFeatureTrue(Field.FEATURE_IS_CONTENT))
                nodeValue = XMLUtl.getNodeCDATAValue(nodeItem);
            else
                nodeValue = XMLUtl.getNodeStrValue(nodeItem);
            if (dataField.isMultiValue()) {
                String mvDelimiter = dataField.getFeature(Field.FEATURE_MV_DELIMITER);
                if (StringUtils.isNotEmpty(mvDelimiter))
                    dataField.expand(nodeValue, mvDelimiter.charAt(0));
                else
                    dataField.expand(nodeValue);
            } else
                dataField.setValue(nodeValue);
        }
    } else
        dataField = null;

    return dataField;
}

From source file:com.nridge.core.base.io.xml.DocumentOpXML.java

private void loadOperation(Element anElement) throws IOException {
    Attr nodeAttr;
    Node nodeItem;/*from  ww w.j  a va 2s . c om*/
    Document document;
    Element nodeElement;
    DocumentXML documentXML;
    DSCriteriaXML criteriaXML;
    String nodeName, nodeValue;

    mCriteria = null;
    mDocumentList.clear();
    mField.clearFeatures();

    String attrValue = anElement.getAttribute(Doc.FEATURE_OP_NAME);
    if (StringUtils.isNotEmpty(attrValue)) {
        mField.setName(attrValue);
        NamedNodeMap namedNodeMap = anElement.getAttributes();
        int attrCount = namedNodeMap.getLength();
        for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) {
            nodeAttr = (Attr) namedNodeMap.item(attrOffset);
            nodeName = nodeAttr.getNodeName();
            nodeValue = nodeAttr.getNodeValue();

            if (StringUtils.isNotEmpty(nodeValue)) {
                if ((!StringUtils.equalsIgnoreCase(nodeName, Doc.FEATURE_OP_NAME))
                        && (!StringUtils.equalsIgnoreCase(nodeName, Doc.FEATURE_OP_COUNT)))
                    mField.addFeature(nodeName, nodeValue);
            }
        }
    }

    NodeList nodeList = anElement.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        nodeItem = nodeList.item(i);

        if (nodeItem.getNodeType() != Node.ELEMENT_NODE)
            continue;

        nodeName = nodeItem.getNodeName();
        if (nodeName.equalsIgnoreCase(IO.XML_CRITERIA_NODE_NAME)) {
            nodeElement = (Element) nodeItem;
            criteriaXML = new DSCriteriaXML();
            criteriaXML.load(nodeElement);
            mCriteria = criteriaXML.getCriteria();
        } else if (StringUtils.startsWithIgnoreCase(nodeName, IO.XML_DOCUMENT_NODE_NAME)) {
            nodeElement = (Element) nodeItem;
            documentXML = new DocumentXML();
            documentXML.load(nodeElement);
            document = documentXML.getDocument();
            if (document != null)
                mDocumentList.add(document);
        }
    }
}

From source file:com.nridge.core.base.io.xml.DocumentReplyXML.java

/**
 * Parses an XML DOM element and loads it into a document list.
 *
 * @param anElement DOM element./*from www .ja  v a2 s  .  c  om*/
 * @throws java.io.IOException I/O related exception.
 */
@Override
public void load(Element anElement) throws IOException {
    Attr nodeAttr;
    Node nodeItem;
    Document document;
    Element nodeElement;
    DocumentXML documentXML;
    String nodeName, nodeValue;

    nodeName = anElement.getNodeName();
    if (StringUtils.equalsIgnoreCase(nodeName, IO.XML_REPLY_NODE_NAME)) {
        mField.clearFeatures();
        String attrValue = anElement.getAttribute(Doc.FEATURE_OP_STATUS_CODE);
        if (StringUtils.isNotEmpty(attrValue)) {
            mField.setName(Doc.FEATURE_OP_STATUS_CODE);
            mField.setValue(attrValue);
            NamedNodeMap namedNodeMap = anElement.getAttributes();
            int attrCount = namedNodeMap.getLength();
            for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) {
                nodeAttr = (Attr) namedNodeMap.item(attrOffset);
                nodeName = nodeAttr.getNodeName();
                nodeValue = nodeAttr.getNodeValue();

                if (StringUtils.isNotEmpty(nodeValue)) {
                    if ((!StringUtils.equalsIgnoreCase(nodeName, Doc.FEATURE_OP_STATUS_CODE))
                            && (!StringUtils.equalsIgnoreCase(nodeName, Doc.FEATURE_OP_COUNT)))
                        mField.addFeature(nodeName, nodeValue);
                }
            }
        }
        NodeList nodeList = anElement.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            nodeItem = nodeList.item(i);

            if (nodeItem.getNodeType() != Node.ELEMENT_NODE)
                continue;

            // We really do not know how the node was named, so we will just accept it.

            nodeElement = (Element) nodeItem;
            documentXML = new DocumentXML();
            documentXML.load(nodeElement);
            document = documentXML.getDocument();
            if (document != null)
                mDocumentList.add(document);
        }
    }
}

From source file:com.nridge.core.base.io.xml.DataBagXML.java

/**
 * Parses an XML DOM element and loads it into a bag/table.
 *
 * @param anElement DOM element./*from ww  w.ja  va  2s  .  c o m*/
 * @throws java.io.IOException I/O related exception.
 */
@Override
public void load(Element anElement) throws IOException {
    Node nodeItem;
    Attr nodeAttr;
    Element nodeElement;
    DataField dataField;
    String nodeName, nodeValue;

    String className = mBag.getClass().getName();
    String attrValue = anElement.getAttribute("type");
    if ((StringUtils.isNotEmpty(attrValue)) && (!IO.isTypesEqual(attrValue, className)))
        throw new IOException("Unsupported type: " + attrValue);

    attrValue = anElement.getAttribute("name");
    if (StringUtils.isNotEmpty(attrValue))
        mBag.setName(attrValue);
    attrValue = anElement.getAttribute("title");
    if (StringUtils.isNotEmpty(attrValue))
        mBag.setTitle(attrValue);

    NamedNodeMap namedNodeMap = anElement.getAttributes();
    int attrCount = namedNodeMap.getLength();
    for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) {
        nodeAttr = (Attr) namedNodeMap.item(attrOffset);
        nodeName = nodeAttr.getNodeName();
        nodeValue = nodeAttr.getNodeValue();

        if (StringUtils.isNotEmpty(nodeValue)) {
            if ((StringUtils.equalsIgnoreCase(nodeName, "name"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "type"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "count"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "title"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "version")))
                continue;
            else
                mBag.addFeature(nodeName, nodeValue);
        }
    }

    NodeList nodeList = anElement.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        nodeItem = nodeList.item(i);

        if (nodeItem.getNodeType() != Node.ELEMENT_NODE)
            continue;

        nodeName = nodeItem.getNodeName();
        if (nodeName.equalsIgnoreCase(IO.XML_FIELD_NODE_NAME)) {
            nodeElement = (Element) nodeItem;
            dataField = mDataFieldXML.load(nodeElement);
            if (dataField != null)
                mBag.add(dataField);
        }
    }
}

From source file:com.nridge.core.base.io.xml.DocumentXML.java

private Document loadDocument(Element anElement) throws IOException {
    Node nodeItem;//from   w w  w .j a  v  a2 s.c om
    Attr nodeAttr;
    Document document;
    Element nodeElement;
    String nodeName, nodeValue;

    String docName = anElement.getAttribute("name");
    String typeName = anElement.getAttribute("type");
    String docTitle = anElement.getAttribute("title");
    String schemaVersion = anElement.getAttribute("schemaVersion");
    if ((StringUtils.isNotEmpty(typeName)) && (StringUtils.isNotEmpty(schemaVersion)))
        document = new Document(typeName);
    else
        document = new Document("Unknown");
    if (StringUtils.isNotEmpty(docName))
        document.setName(docName);
    if (StringUtils.isNotEmpty(docTitle))
        document.setName(docTitle);

    NamedNodeMap namedNodeMap = anElement.getAttributes();
    int attrCount = namedNodeMap.getLength();
    for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) {
        nodeAttr = (Attr) namedNodeMap.item(attrOffset);
        nodeName = nodeAttr.getNodeName();
        nodeValue = nodeAttr.getNodeValue();

        if (StringUtils.isNotEmpty(nodeValue)) {
            if ((StringUtils.equalsIgnoreCase(nodeName, "name"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "type"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "title"))
                    || (StringUtils.equalsIgnoreCase(nodeName, "schemaVersion")))
                continue;
            else
                document.addFeature(nodeName, nodeValue);
        }
    }

    NodeList nodeList = anElement.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        nodeItem = nodeList.item(i);

        if (nodeItem.getNodeType() != Node.ELEMENT_NODE)
            continue;

        nodeName = nodeItem.getNodeName();
        if (StringUtils.equalsIgnoreCase(nodeName, IO.XML_TABLE_NODE_NAME)) {
            nodeElement = (Element) nodeItem;
            DataTableXML dataTableXML = new DataTableXML();
            dataTableXML.load(nodeElement);
            document.setTable(dataTableXML.getTable());
        } else if (StringUtils.equalsIgnoreCase(nodeName, IO.XML_RELATED_NODE_NAME)) {
            nodeElement = (Element) nodeItem;
            loadRelated(document, nodeElement);
        } else if (StringUtils.equalsIgnoreCase(nodeName, IO.XML_ACL_NODE_NAME)) {
            nodeElement = (Element) nodeItem;
            loadACL(document, nodeElement);
        }
    }

    return document;
}

From source file:com.nridge.ds.solr.SolrSchemaXML.java

private DataField loadField(Element anElement) {
    Attr nodeAttr;
    DataField dataField;/*from   ww  w  .  j  a  va 2  s  . c  o  m*/
    Field.Type fieldType;
    String nodeName, nodeValue;
    Logger appLogger = mAppMgr.getLogger(this, "loadField");

    appLogger.trace(mAppMgr.LOGMSG_TRACE_ENTER);

    String attrValue = anElement.getAttribute("name");
    if (StringUtils.isNotEmpty(attrValue)) {
        String fieldName = attrValue;
        attrValue = anElement.getAttribute("type");
        if (StringUtils.isNotEmpty(attrValue))
            fieldType = mapSolrFieldType(attrValue);
        else
            fieldType = Field.Type.Text;
        dataField = new DataField(fieldType, fieldName);
        dataField.setTitle(Field.nameToTitle(fieldName));

        NamedNodeMap namedNodeMap = anElement.getAttributes();
        int attrCount = namedNodeMap.getLength();
        for (int attrOffset = 0; attrOffset < attrCount; attrOffset++) {
            nodeAttr = (Attr) namedNodeMap.item(attrOffset);
            nodeName = nodeAttr.getNodeName();
            nodeValue = nodeAttr.getNodeValue();

            if (StringUtils.isNotEmpty(nodeValue)) {
                if ((!StringUtils.equalsIgnoreCase(nodeName, "name"))
                        && (!StringUtils.equalsIgnoreCase(nodeName, "type")))
                    assignSolrFieldFeature(dataField, nodeName, nodeValue);
            }
        }
    } else
        dataField = null;

    appLogger.trace(mAppMgr.LOGMSG_TRACE_DEPART);

    return dataField;
}

From source file:nl.strohalm.cyclos.utils.conversion.HtmlConverter.java

private static void removeBadNodes(final Document document) {
    final NodeList elements = document.getElementsByTagName("*");
    for (int i = 0; i < elements.getLength(); i++) {
        final Element element = (Element) elements.item(i);
        if (ArrayUtils.contains(BAD_TAGS, element.getTagName())) {
            element.getParentNode().removeChild(element);
        }/*  w ww.j  a  v  a 2s .  co  m*/
        final NamedNodeMap attributes = element.getAttributes();
        for (int j = 0; j < attributes.getLength(); j++) {
            final Attr attr = (Attr) attributes.item(j);
            if (attr.getNodeName().startsWith("on")) {
                // This is an event handler: remove it
                element.removeAttributeNode(attr);
            }
        }
    }
}