Example usage for org.w3c.dom Node TEXT_NODE

List of usage examples for org.w3c.dom Node TEXT_NODE

Introduction

In this page you can find the example usage for org.w3c.dom Node TEXT_NODE.

Prototype

short TEXT_NODE

To view the source code for org.w3c.dom Node TEXT_NODE.

Click Source Link

Document

The node is a Text node.

Usage

From source file:importer.handler.post.stages.Discriminator.java

/**
 * Get the next true sibling of the given element
 * @param elem the element to get the next sibling of
 * @return the next true sibling of elem or null
 *//*  ww w.  j a  v a2s  .c  om*/
Element nextTrueSibling(Element elem) {
    Node n = elem;
    while (elem != null) {
        n = n.getNextSibling();
        if (n == null)
            elem = null;
        else if (n.getNodeType() == Node.ELEMENT_NODE) {
            Sibling s = siblings.get(n.getNodeName());
            if (s != null) {
                String sName = s.getSibling();
                String nName = n.getNodeName();
                String eName = elem.getNodeName();
                if (eName.equals(sName) || eName.equals(nName)) {
                    elem = (Element) n;
                    break;
                } else
                    elem = null;
            } else
                elem = null;
        } else if (n.getNodeType() == Node.TEXT_NODE && !isWhitespace(n.getTextContent()))
            elem = null;
    }
    return elem;
}

From source file:edu.cornell.mannlib.vitro.utilities.containerneutral.CheckContainerNeutrality.java

/**
 * Dump the first 20 nodes of an XML context, excluding comments and blank
 * text nodes.//from   ww  w  .  ja va2  s.c  om
 */
@SuppressWarnings("unused")
private int dumpXml(Node xmlNode, int... parms) {
    int remaining = (parms.length == 0) ? 20 : parms[0];
    int level = (parms.length < 2) ? 1 : parms[1];

    Node n = xmlNode;

    if (Node.COMMENT_NODE == n.getNodeType()) {
        return 0;
    }
    if (Node.TEXT_NODE == n.getNodeType()) {
        if (StringUtils.isBlank(n.getTextContent())) {
            return 0;
        }
    }

    int used = 1;

    System.out.println(StringUtils.repeat("-->", level) + n);
    NodeList nl = n.getChildNodes();
    for (int i = 0; (i < nl.getLength() && remaining > used); i++) {
        used += dumpXml(nl.item(i), remaining - used, level + 1);
    }
    return used;
}

From source file:com.hp.mqm.atrf.core.configuration.FetchConfiguration.java

private static void parseNodes(Node node, String prefix, FetchConfiguration configuration) {
    NodeList nList = node.getChildNodes();
    for (int i = 0; i < nList.getLength(); i++) {
        Node nNode = nList.item(i);
        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
            parseNodes(nNode, prefix + "." + nNode.getNodeName(), configuration);
        } else if (nNode.getNodeType() == Node.TEXT_NODE) {
            String value = nNode.getTextContent().trim();
            if (StringUtils.isNotEmpty(value)) {
                configuration.setProperty(prefix, value);
            }/* w w w.ja  v  a  2 s .  com*/

        }
    }
}

From source file:io.fabric8.tooling.archetype.builder.ArchetypeBuilder.java

/**
 * This method:<ul>//from   w w w.  j  ava 2 s .co  m
 *     <li>Copies POM from original project to archetype-resources</li>
 *     <li>Generates <code></code>archetype-descriptor.xml</code></li>
 *     <li>Generates Archetype's <code>pom.xml</code> if not present in target directory.</li>
 * </ul>
 *
 * @param projectPom POM file of original project
 * @param archetypeDir target directory of created Maven Archetype project
 * @param archetypePom created POM file for Maven Archetype project
 * @param metadataXmlOutFile generated archetype-metadata.xml file
 * @param replaceFn replace function
 * @throws IOException
 */
private void createArchetypeDescriptors(File projectPom, File archetypeDir, File archetypePom,
        File metadataXmlOutFile, Replacement replaceFn) throws IOException {
    LOG.debug("Parsing " + projectPom);
    String text = replaceFn.replace(FileUtils.readFileToString(projectPom));

    // lets update the XML
    Document doc = archetypeUtils.parseXml(new InputSource(new StringReader(text)));
    Element root = doc.getDocumentElement();

    // let's get some values from the original project
    String originalArtifactId, originalName, originalDescription;
    Element artifactIdEl = (Element) findChild(root, "artifactId");

    Element nameEl = (Element) findChild(root, "name");
    Element descriptionEl = (Element) findChild(root, "description");
    if (artifactIdEl != null && artifactIdEl.getTextContent() != null
            && artifactIdEl.getTextContent().trim().length() > 0) {
        originalArtifactId = artifactIdEl.getTextContent().trim();
    } else {
        originalArtifactId = archetypeDir.getName();
    }
    if (nameEl != null && nameEl.getTextContent() != null && nameEl.getTextContent().trim().length() > 0) {
        originalName = nameEl.getTextContent().trim();
    } else {
        originalName = originalArtifactId;
    }
    if (descriptionEl != null && descriptionEl.getTextContent() != null
            && descriptionEl.getTextContent().trim().length() > 0) {
        originalDescription = descriptionEl.getTextContent().trim();
    } else {
        originalDescription = originalName;
    }

    Set<String> propertyNameSet = new TreeSet<String>();

    if (root != null) {
        // remove the parent element and the following text Node
        NodeList parents = root.getElementsByTagName("parent");
        if (parents.getLength() > 0) {
            if (parents.item(0).getNextSibling().getNodeType() == Node.TEXT_NODE) {
                root.removeChild(parents.item(0).getNextSibling());
            }
            root.removeChild(parents.item(0));
        }

        // lets load all the properties defined in the <properties> element in the pom.
        Set<String> pomPropertyNames = new LinkedHashSet<String>();

        NodeList propertyElements = root.getElementsByTagName("properties");
        if (propertyElements.getLength() > 0) {
            Element propertyElement = (Element) propertyElements.item(0);
            NodeList children = propertyElement.getChildNodes();
            for (int cn = 0; cn < children.getLength(); cn++) {
                Node e = children.item(cn);
                if (e instanceof Element) {
                    pomPropertyNames.add(e.getNodeName());
                }
            }
        }
        LOG.debug("Found <properties> in the pom: {}", pomPropertyNames);

        // lets find all the property names
        NodeList children = root.getElementsByTagName("*");
        for (int cn = 0; cn < children.getLength(); cn++) {
            Node e = children.item(cn);
            if (e instanceof Element) {
                //val text = e.childrenText
                String cText = e.getTextContent();
                String prefix = "${";
                if (cText.startsWith(prefix)) {
                    int offset = prefix.length();
                    int idx = cText.indexOf("}", offset + 1);
                    if (idx > 0) {
                        String name = cText.substring(offset, idx);
                        if (!pomPropertyNames.contains(name) && isValidRequiredPropertyName(name)) {
                            propertyNameSet.add(name);
                        }
                    }
                }
            }
        }

        // now lets replace the contents of some elements (adding new elements if they are not present)
        List<String> beforeNames = Arrays.asList("artifactId", "version", "packaging", "name", "properties");
        replaceOrAddElementText(doc, root, "version", "${version}", beforeNames);
        replaceOrAddElementText(doc, root, "artifactId", "${artifactId}", beforeNames);
        replaceOrAddElementText(doc, root, "groupId", "${groupId}", beforeNames);
    }
    archetypePom.getParentFile().mkdirs();

    archetypeUtils.writeXmlDocument(doc, archetypePom);

    // lets update the archetype-metadata.xml file
    String archetypeXmlText = defaultArchetypeXmlText();

    Document archDoc = archetypeUtils.parseXml(new InputSource(new StringReader(archetypeXmlText)));
    Element archRoot = archDoc.getDocumentElement();

    // replace @name attribute on root element
    archRoot.setAttribute("name", archetypeDir.getName());

    LOG.debug(("Found property names: {}"), propertyNameSet);
    // lets add all the properties
    Element requiredProperties = replaceOrAddElement(archDoc, archRoot, "requiredProperties",
            Arrays.asList("fileSets"));

    // lets add the various properties in
    for (String propertyName : propertyNameSet) {
        requiredProperties.appendChild(archDoc.createTextNode("\n" + indent + indent));
        Element requiredProperty = archDoc.createElement("requiredProperty");
        requiredProperties.appendChild(requiredProperty);
        requiredProperty.setAttribute("key", propertyName);
        requiredProperty.appendChild(archDoc.createTextNode("\n" + indent + indent + indent));
        Element defaultValue = archDoc.createElement("defaultValue");
        requiredProperty.appendChild(defaultValue);
        defaultValue.appendChild(archDoc.createTextNode("${" + propertyName + "}"));
        requiredProperty.appendChild(archDoc.createTextNode("\n" + indent + indent));
    }
    requiredProperties.appendChild(archDoc.createTextNode("\n" + indent));

    metadataXmlOutFile.getParentFile().mkdirs();
    archetypeUtils.writeXmlDocument(archDoc, metadataXmlOutFile);

    File archetypeProjectPom = new File(archetypeDir, "pom.xml");
    // now generate Archetype's pom
    if (!archetypeProjectPom.exists()) {
        StringWriter sw = new StringWriter();
        IOUtils.copy(getClass().getResourceAsStream("default-archetype-pom.xml"), sw, "UTF-8");
        Document pomDocument = archetypeUtils.parseXml(new InputSource(new StringReader(sw.toString())));

        List<String> emptyList = Collections.emptyList();

        // artifactId = original artifactId with "-archetype"
        Element artifactId = replaceOrAddElement(pomDocument, pomDocument.getDocumentElement(), "artifactId",
                emptyList);
        artifactId.setTextContent(archetypeDir.getName());

        // name = "Fabric8 :: Qickstarts :: xxx" -> "Fabric8 :: Archetypes :: xxx"
        Element name = replaceOrAddElement(pomDocument, pomDocument.getDocumentElement(), "name", emptyList);
        if (originalName.contains(" :: ")) {
            String[] originalNameTab = originalName.split(" :: ");
            if (originalNameTab.length > 2) {
                StringBuilder sb = new StringBuilder();
                sb.append("Fabric8 :: Archetypes");
                for (int idx = 2; idx < originalNameTab.length; idx++) {
                    sb.append(" :: ").append(originalNameTab[idx]);
                }
                name.setTextContent(sb.toString());
            } else {
                name.setTextContent("Fabric8 :: Archetypes :: " + originalNameTab[1]);
            }
        } else {
            name.setTextContent("Fabric8 :: Archetypes :: " + originalName);
        }

        // description = "Creates a new " + originalDescription
        Element description = replaceOrAddElement(pomDocument, pomDocument.getDocumentElement(), "description",
                emptyList);
        description.setTextContent("Creates a new " + originalDescription);

        archetypeUtils.writeXmlDocument(pomDocument, archetypeProjectPom);
    }
}

From source file:XMLReader.java

/** Returns element value
 * @param elem element (it is XML tag)/*from   w ww  .j  a  v  a2 s  .c om*/
 * @return Element value otherwise empty String
 */
private final static String getElementValue(Node elem) {
    Node kid;
    if (elem != null) {
        if (elem.hasChildNodes()) {
            for (kid = elem.getFirstChild(); kid != null; kid = kid.getNextSibling()) {
                if (kid.getNodeType() == Node.TEXT_NODE) {
                    return kid.getNodeValue();
                }
            }
        }
    }
    return "";
}

From source file:com.fiorano.openesb.application.aps.ApplicationHeader.java

/**
 *  Sets all the fieldValues of this <code>ApplicationHeader</code> object
 *  using the specified XML string.//from w  ww  .  j a  v  a2 s  .c om
 *
 * @param appHeaderElement The new fieldValues value
 * @exception FioranoException if an error occurs while parsing the
 *      XMLString
 * @since Tifosi2.0
 */
public void setFieldValues(Element appHeaderElement) throws FioranoException {
    if (appHeaderElement != null) {
        boolean canSub = XMLDmiUtil.getAttributeAsBoolean(appHeaderElement, "isSubgraphable");

        setCanBeSubGraphed(canSub);

        String scope = appHeaderElement.getAttribute("Scope");

        setScope(scope);

        NodeList childList = appHeaderElement.getChildNodes();
        Node appchild;

        for (int i = 0; i < childList.getLength(); i++) {
            appchild = childList.item(i);
            if (appchild.getNodeType() == Node.TEXT_NODE)
                continue;

            String nodeName = appchild.getNodeName();
            String nodeValue = XMLUtils.getNodeValueAsString(appchild);

            if (nodeName.equalsIgnoreCase("Name"))
                setApplicationName(nodeValue);

            else if (nodeName.equalsIgnoreCase("ApplicationGUID"))
                setApplicationGUID(nodeValue);

            else if (nodeName.equalsIgnoreCase("Author"))
                addAuthor(nodeValue);

            else if (nodeName.equalsIgnoreCase("CreationDate"))
                setCreationDate(nodeValue);

            else if (nodeName.equalsIgnoreCase("Icon"))
                setIcon(nodeValue);

            else if (nodeName.equalsIgnoreCase("Version")) {
                boolean isLocked = XMLDmiUtil.getAttributeAsBoolean(((Element) appchild), "isLocked");

                setIsVersionLocked(isLocked);
                setVersionNumber(nodeValue);
            } else if (nodeName.equalsIgnoreCase("Label"))
                m_strProfile = nodeValue;

            else if (nodeName.equalsIgnoreCase("CompatibleWith"))
                addCompatibleWith(nodeValue);

            else if (nodeName.equalsIgnoreCase("Category"))
                setCategoryIn(nodeValue);

            else if (nodeName.equalsIgnoreCase("LongDescription"))
                setLongDescription(nodeValue);

            else if (nodeName.equalsIgnoreCase("ShortDescription"))
                setShortDescription(nodeValue);

            else if (nodeName.equalsIgnoreCase("Param")) {
                Param param = new Param();

                param.setFieldValues((Element) appchild);

                m_params.add(param);
            } else if (nodeName.equalsIgnoreCase("ApplicationContext")) {
                m_appContext = new ApplicationContext();
                m_appContext.setFieldValues((Element) appchild);
            }
        }
    }
    validate();
}

From source file:com.twinsoft.convertigo.beans.core.Step.java

protected String getNodeValue(Node node) {
    if (node != null) {
        int len;/*from   www  .  j  a  va  2 s  . c o m*/
        int nodeType = node.getNodeType();
        switch (nodeType) {
        case Node.ELEMENT_NODE:
            if (sequence.getProject().isStrictMode()) {
                return XMLUtils.prettyPrintElement((Element) node, true, false);
            } else {
                len = node.getChildNodes().getLength();
                Node firstChild = node.getFirstChild();
                if (firstChild != null) {
                    int firstChildType = firstChild.getNodeType();
                    switch (firstChildType) {
                    case Node.CDATA_SECTION_NODE:
                    case Node.TEXT_NODE:
                        return ((len < 2) ? firstChild.getNodeValue() : XMLUtils.getNormalizedText(node));
                    case Node.ELEMENT_NODE:
                        return XMLUtils.prettyPrintElement((Element) node, true, false);
                    default:
                        return null;
                    }
                } else {
                    if (Engine.logBeans.isInfoEnabled())
                        Engine.logBeans.warn("Applied XPath on step '" + this
                                + "' returned node with null value ('" + node.getNodeName() + "')");
                    return null;
                }
            }
        case Node.CDATA_SECTION_NODE:
        case Node.TEXT_NODE:
            len = node.getChildNodes().getLength();
            return ((len < 2) ? node.getNodeValue() : XMLUtils.getNormalizedText(node));
        case Node.ATTRIBUTE_NODE:
            return node.getNodeValue();
        default:
            if (Engine.logBeans.isInfoEnabled())
                Engine.logBeans.warn("Applied XPath on step '" + this + "' is not supported");
            return null;
        }
    }
    return null;
}

From source file:ch.kostceco.tools.kostval.validation.modulejp2.impl.ValidationAvalidationAModuleImpl.java

@Override
public boolean validate(File valDatei, File directoryOfLogfile) throws ValidationAjp2validationException {

    // Start mit der Erkennung

    // Eine JP2 Datei (.jp2) muss mit ....jP ...ftypjp2
    // [0000000c6a5020200d0a870a] beginnen
    if (valDatei.isDirectory()) {
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                + getTextResourceService().getText(ERROR_XML_A_JP2_ISDIRECTORY));
        return false;
    } else if ((valDatei.getAbsolutePath().toLowerCase().endsWith(".jp2"))) {

        FileReader fr = null;//from ww w .  j a v  a2s . c  om

        try {
            fr = new FileReader(valDatei);
            BufferedReader read = new BufferedReader(fr);

            // wobei hier nur die ersten 10 Zeichen der Datei ausgelesen werden
            // 1 00 010203
            // 2 0c 04
            // 3 6a 05
            // 4 50 06
            // 5 20 0708
            // 6 0d 09
            // 7 0a 10

            // Hex 00 in Char umwandeln
            String str1 = "00";
            int i1 = Integer.parseInt(str1, 16);
            char c1 = (char) i1;
            // Hex 0c in Char umwandeln
            String str2 = "0c";
            int i2 = Integer.parseInt(str2, 16);
            char c2 = (char) i2;
            // Hex 6a in Char umwandeln
            String str3 = "6a";
            int i3 = Integer.parseInt(str3, 16);
            char c3 = (char) i3;
            // Hex 50 in Char umwandeln
            String str4 = "50";
            int i4 = Integer.parseInt(str4, 16);
            char c4 = (char) i4;
            // Hex 20 in Char umwandeln
            String str5 = "20";
            int i5 = Integer.parseInt(str5, 16);
            char c5 = (char) i5;
            // Hex 0d in Char umwandeln
            String str6 = "0d";
            int i6 = Integer.parseInt(str6, 16);
            char c6 = (char) i6;
            // Hex 0a in Char umwandeln
            String str7 = "0a";
            int i7 = Integer.parseInt(str7, 16);
            char c7 = (char) i7;

            // auslesen der ersten 10 Zeichen der Datei
            int length;
            int i;
            char[] buffer = new char[10];
            length = read.read(buffer);
            for (i = 0; i != length; i++)
                ;

            /* die beiden charArrays (soll und ist) mit einander vergleichen IST = c1c1c1c2c3c4c5c5c6c7 */
            char[] charArray1 = buffer;
            char[] charArray2 = new char[] { c1, c1, c1, c2, c3, c4, c5, c5, c6, c7 };

            if (Arrays.equals(charArray1, charArray2)) {
                /* hchstwahrscheinlich ein JP2 da es mit 0000000c6a5020200d0a respektive ....jP ..
                 * beginnt */
            } else {
                // TODO: Droid-Erkennung, damit Details ausgegeben werden knnen
                String nameOfSignature = getConfigurationService().getPathToDroidSignatureFile();
                if (nameOfSignature == null) {
                    getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                            + getTextResourceService().getText(MESSAGE_XML_CONFIGURATION_ERROR_NO_SIGNATURE));
                    return false;
                }
                // existiert die SignatureFile am angebenen Ort?
                File fnameOfSignature = new File(nameOfSignature);
                if (!fnameOfSignature.exists()) {
                    getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                            + getTextResourceService().getText(MESSAGE_XML_CA_DROID));
                    return false;
                }

                Droid droid = null;
                try {
                    /* kleiner Hack, weil die Droid libraries irgendwo ein System.out drin haben, welche den
                     * Output stren Util.switchOffConsole() als Kommentar markieren wenn man die
                     * Fehlermeldung erhalten mchte */
                    Util.switchOffConsole();
                    droid = new Droid();

                    droid.readSignatureFile(nameOfSignature);

                } catch (Exception e) {
                    getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                            + getTextResourceService().getText(ERROR_XML_CANNOT_INITIALIZE_DROID));
                    return false;
                } finally {
                    Util.switchOnConsole();
                }
                File file = valDatei;
                String puid = "";
                IdentificationFile ifile = droid.identify(file.getAbsolutePath());
                for (int x = 0; x < ifile.getNumHits(); x++) {
                    FileFormatHit ffh = ifile.getHit(x);
                    FileFormat ff = ffh.getFileFormat();
                    puid = ff.getPUID();
                }
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                        + getTextResourceService().getText(ERROR_XML_A_JP2_INCORRECTFILE, puid));
                return false;
            }
        } catch (Exception e) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                    + getTextResourceService().getText(ERROR_XML_A_JP2_INCORRECTFILE));
            return false;
        }
    } else {
        // die Datei endet nicht mit jp2 -> Fehler
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                + getTextResourceService().getText(ERROR_XML_A_JP2_INCORRECTFILEENDING));
        return false;
    }
    // Ende der Erkennung

    boolean isValid = false;

    // TODO: Erledigt - Initialisierung Jpylyzer -> existiert Jpylyzer?
    String pathToJpylyzerExe = "resources" + File.separator + "jpylyzer" + File.separator + "jpylyzer.exe";

    File fJpylyzerExe = new File(pathToJpylyzerExe);
    if (!fJpylyzerExe.exists()) {
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                + getTextResourceService().getText(ERROR_XML_A_JP2_JPYLYZER_MISSING));
    }

    pathToJpylyzerExe = "\"" + pathToJpylyzerExe + "\"";

    try {
        File report;
        Document doc = null;

        try {
            // jpylyzer-Befehl: pathToJpylyzerExe valDatei > valDatei.jpylyzer-log.xml
            String outputPath = directoryOfLogfile.getAbsolutePath();
            String outputName = File.separator + valDatei.getName() + ".jpylyzer-log.xml";
            String pathToJpylyzerReport = outputPath + outputName;
            File output = new File(pathToJpylyzerReport);
            Runtime rt = Runtime.getRuntime();
            Process proc = null;

            try {
                report = output;

                // falls das File bereits existiert, z.B. von einem vorhergehenden Durchlauf, lschen wir
                // es
                if (report.exists()) {
                    report.delete();
                }

                /* Das redirect Zeichen verunmglicht eine direkte eingabe. mit dem geschachtellten Befehl
                 * gehts: cmd /c\"urspruenlicher Befehl\" */
                String command = "cmd /c \"" + pathToJpylyzerExe + " \"" + valDatei.getAbsolutePath()
                        + "\" > \"" + output.getAbsolutePath() + "\"\"";
                proc = rt.exec(command.toString().split(" "));
                // .split(" ") ist notwendig wenn in einem Pfad ein Doppelleerschlag vorhanden ist!

                // Warte, bis proc fertig ist
                proc.waitFor();

            } catch (Exception e) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                        + getTextResourceService().getText(ERROR_XML_A_JP2_SERVICEFAILED, e.getMessage()));
                return false;
            } finally {
                if (proc != null) {
                    closeQuietly(proc.getOutputStream());
                    closeQuietly(proc.getInputStream());
                    closeQuietly(proc.getErrorStream());
                }
            }
            if (report.exists()) {
                // alles io
            } else {
                // Datei nicht angelegt...
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                        + getTextResourceService().getText(ERROR_XML_A_JP2_NOREPORT));
                return false;
            }

            // Ende Jpylyzer direkt auszulsen

            // TODO: Erledigt - Ergebnis auslesen

            BufferedInputStream bis = new BufferedInputStream(new FileInputStream(pathToJpylyzerReport));
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(bis);
            doc.normalize();

            NodeList nodeLstI = doc.getElementsByTagName("isValidJP2");

            // Node isValidJP2 enthlt im TextNode das Resultat TextNode ist ein ChildNode
            for (int s = 0; s < nodeLstI.getLength(); s++) {
                Node resultNode = nodeLstI.item(s);
                StringBuffer buf = new StringBuffer();
                NodeList children = resultNode.getChildNodes();
                for (int i = 0; i < children.getLength(); i++) {
                    Node textChild = children.item(i);
                    if (textChild.getNodeType() != Node.TEXT_NODE) {
                        continue;
                    }
                    buf.append(textChild.getNodeValue());
                }
                String result = buf.toString();

                // Das Resultat ist False oder True
                if (result.equalsIgnoreCase("True")) {
                    // valid
                    isValid = true;
                } else {
                    // invalide
                    getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                            + getTextResourceService().getText(ERROR_XML_A_JP2_JPYLYZER_FAIL));
                    isValid = false;
                }
            }

        } catch (Exception e) {
            getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                    + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
            return false;
        }
        // TODO: Erledigt: Fehler Auswertung

        if (!isValid) {
            // Invalide JP2-Datei
            int isignatureBox = 0;
            int ifileTypeBox = 0;
            int iimageHeaderBox = 0;
            int ibitsPerComponentBox = 0;
            int icolourSpecificationBox = 0;
            int ipaletteBox = 0;
            int icomponentMappingBox = 0;
            int ichannelDefinitionBox = 0;
            int iresolutionBox = 0;
            int itileParts = 0;
            int isiz = 0;
            int icod = 0;
            int iqcd = 0;
            int icoc = 0;
            int icom = 0;
            int iqcc = 0;
            int irgn = 0;
            int ipoc = 0;
            int iplm = 0;
            int ippm = 0;
            int itlm = 0;
            int icrg = 0;
            int iplt = 0;
            int ippt = 0;
            int ixmlBox = 0;
            int iuuidBox = 0;
            int iuuidInfoBox = 0;
            int iunknownBox = 0;
            int icontainsImageHeaderBox = 0;
            int icontainsColourSpecificationBox = 0;
            int icontainsBitsPerComponentBox = 0;
            int ifirstJP2HeaderBoxIsImageHeaderBox = 0;
            int inoMoreThanOneImageHeaderBox = 0;
            int inoMoreThanOneBitsPerComponentBox = 0;
            int inoMoreThanOnePaletteBox = 0;
            int inoMoreThanOneComponentMappingBox = 0;
            int inoMoreThanOneChannelDefinitionBox = 0;
            int inoMoreThanOneResolutionBox = 0;
            int icolourSpecificationBoxesAreContiguous = 0;
            int ipaletteAndComponentMappingBoxesOnlyTogether = 0;

            int icodestreamStartsWithSOCMarker = 0;
            int ifoundSIZMarker = 0;
            int ifoundCODMarker = 0;
            int ifoundQCDMarker = 0;
            int iquantizationConsistentWithLevels = 0;
            int ifoundExpectedNumberOfTiles = 0;
            int ifoundExpectedNumberOfTileParts = 0;
            int ifoundEOCMarker = 0;

            NodeList nodeLstTest = doc.getElementsByTagName("tests");

            // Node test enthlt alle invaliden tests
            for (int s = 0; s < nodeLstTest.getLength(); s++) {
                Node testNode = nodeLstTest.item(s);
                NodeList children = testNode.getChildNodes();
                for (int i = 0; i < children.getLength(); i++) {
                    Node textChild = children.item(i);
                    if (textChild.getNodeType() == Node.ELEMENT_NODE) {
                        if (textChild.getNodeName().equals("signatureBox")) {
                            isignatureBox = isignatureBox + 1;
                        } else if (textChild.getNodeName().equals("fileTypeBox")) {
                            ifileTypeBox = ifileTypeBox + 1;
                        } else if (textChild.getNodeName().equals("jp2HeaderBox")) {
                            NodeList childrenII = textChild.getChildNodes();
                            for (int j = 0; j < childrenII.getLength(); j++) {
                                Node textChildII = childrenII.item(j);
                                if (textChildII.getNodeType() == Node.ELEMENT_NODE) {
                                    if (textChildII.getNodeName().equals("imageHeaderBox")) {
                                        iimageHeaderBox = iimageHeaderBox + 1;
                                    } else if (textChildII.getNodeName().equals("bitsPerComponentBox")) {
                                        ibitsPerComponentBox = ibitsPerComponentBox + 1;
                                    } else if (textChildII.getNodeName().equals("colourSpecificationBox")) {
                                        icolourSpecificationBox = icolourSpecificationBox + 1;
                                    } else if (textChildII.getNodeName().equals("paletteBox")) {
                                        ipaletteBox = ipaletteBox + 1;
                                    } else if (textChildII.getNodeName().equals("componentMappingBox")) {
                                        icomponentMappingBox = icomponentMappingBox + 1;
                                    } else if (textChildII.getNodeName().equals("channelDefinitionBox")) {
                                        ichannelDefinitionBox = ichannelDefinitionBox + 1;
                                    } else if (textChildII.getNodeName().equals("resolutionBox")) {
                                        iresolutionBox = iresolutionBox + 1;
                                    } else if (textChildII.getNodeName().equals("containsImageHeaderBox")) {
                                        icontainsImageHeaderBox = icontainsImageHeaderBox + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("containsColourSpecificationBox")) {
                                        icontainsColourSpecificationBox = icontainsColourSpecificationBox + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("containsBitsPerComponentBox")) {
                                        icontainsBitsPerComponentBox = icontainsBitsPerComponentBox + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("firstJP2HeaderBoxIsImageHeaderBox")) {
                                        ifirstJP2HeaderBoxIsImageHeaderBox = ifirstJP2HeaderBoxIsImageHeaderBox
                                                + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("noMoreThanOneImageHeaderBox")) {
                                        inoMoreThanOneImageHeaderBox = inoMoreThanOneImageHeaderBox + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("noMoreThanOneBitsPerComponentBox")) {
                                        inoMoreThanOneBitsPerComponentBox = inoMoreThanOneBitsPerComponentBox
                                                + 1;
                                    } else if (textChildII.getNodeName().equals("noMoreThanOnePaletteBox")) {
                                        inoMoreThanOnePaletteBox = inoMoreThanOnePaletteBox + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("noMoreThanOneComponentMappingBox")) {
                                        inoMoreThanOneComponentMappingBox = inoMoreThanOneComponentMappingBox
                                                + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("noMoreThanOneChannelDefinitionBox")) {
                                        inoMoreThanOneChannelDefinitionBox = inoMoreThanOneChannelDefinitionBox
                                                + 1;
                                    } else if (textChildII.getNodeName().equals("noMoreThanOneResolutionBox")) {
                                        inoMoreThanOneResolutionBox = inoMoreThanOneResolutionBox + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("colourSpecificationBoxesAreContiguous")) {
                                        icolourSpecificationBoxesAreContiguous = icolourSpecificationBoxesAreContiguous
                                                + 1;
                                    } else if (textChildII.getNodeName()
                                            .equals("paletteAndComponentMappingBoxesOnlyTogether")) {
                                        ipaletteAndComponentMappingBoxesOnlyTogether = ipaletteAndComponentMappingBoxesOnlyTogether
                                                + 1;
                                    }
                                }
                                continue;
                            }
                        } else if (textChild.getNodeName().equals("contiguousCodestreamBox")) {
                            NodeList childrenIII = textChild.getChildNodes();
                            for (int k = 0; k < childrenIII.getLength(); k++) {
                                Node textChildIII = childrenIII.item(k);
                                if (textChildIII.getNodeType() == Node.ELEMENT_NODE) {
                                    if (textChildIII.getNodeName().equals("tileParts")) {
                                        itileParts = itileParts + 1;
                                    } else if (textChildIII.getNodeName().equals("siz")) {
                                        isiz = isiz + 1;
                                    } else if (textChildIII.getNodeName().equals("cod")) {
                                        icod = icod + 1;
                                    } else if (textChildIII.getNodeName().equals("qcd")) {
                                        iqcd = iqcd + 1;
                                    } else if (textChildIII.getNodeName().equals("coc")) {
                                        icoc = icoc + 1;
                                    } else if (textChildIII.getNodeName().equals("com")) {
                                        icom = icom + 1;
                                    } else if (textChildIII.getNodeName().equals("qcc")) {
                                        iqcc = iqcc + 1;
                                    } else if (textChildIII.getNodeName().equals("rgn")) {
                                        irgn = irgn + 1;
                                    } else if (textChildIII.getNodeName().equals("poc")) {
                                        ipoc = ipoc + 1;
                                    } else if (textChildIII.getNodeName().equals("plm")) {
                                        iplm = iplm + 1;
                                    } else if (textChildIII.getNodeName().equals("ppm")) {
                                        ippm = ippm + 1;
                                    } else if (textChildIII.getNodeName().equals("tlm")) {
                                        itlm = itlm + 1;
                                    } else if (textChildIII.getNodeName().equals("crg")) {
                                        icrg = icrg + 1;
                                    } else if (textChildIII.getNodeName().equals("plt")) {
                                        iplt = iplt + 1;
                                    } else if (textChildIII.getNodeName().equals("ppt")) {
                                        ippt = ippt + 1;
                                    } else if (textChildIII.getNodeName()
                                            .equals("codestreamStartsWithSOCMarker")) {
                                        icodestreamStartsWithSOCMarker = icodestreamStartsWithSOCMarker + 1;
                                    } else if (textChildIII.getNodeName().equals("foundSIZMarker")) {
                                        ifoundSIZMarker = ifoundSIZMarker + 1;
                                    } else if (textChildIII.getNodeName().equals("foundCODMarker")) {
                                        ifoundCODMarker = ifoundCODMarker + 1;
                                    } else if (textChildIII.getNodeName().equals("foundQCDMarker")) {
                                        ifoundQCDMarker = ifoundQCDMarker + 1;
                                    } else if (textChildIII.getNodeName()
                                            .equals("quantizationConsistentWithLevels")) {
                                        iquantizationConsistentWithLevels = iquantizationConsistentWithLevels
                                                + 1;
                                    } else if (textChildIII.getNodeName()
                                            .equals("foundExpectedNumberOfTiles")) {
                                        ifoundExpectedNumberOfTiles = ifoundExpectedNumberOfTiles + 1;
                                    } else if (textChildIII.getNodeName()
                                            .equals("foundExpectedNumberOfTileParts")) {
                                        ifoundExpectedNumberOfTileParts = ifoundExpectedNumberOfTileParts + 1;
                                    } else if (textChildIII.getNodeName().equals("foundEOCMarker")) {
                                        ifoundEOCMarker = ifoundEOCMarker + 1;
                                    }
                                }
                                continue;
                            }
                        } else if (textChild.getNodeName().equals("xmlBox")) {
                            ixmlBox = ixmlBox + 1;
                        } else if (textChild.getNodeName().equals("uuidBox")) {
                            iuuidBox = iuuidBox + 1;
                        } else if (textChild.getNodeName().equals("uuidInfoBox")) {
                            iuuidInfoBox = iuuidInfoBox + 1;
                        } else if (textChild.getNodeName().equals("unknownBox")) {
                            iunknownBox = iunknownBox + 1;
                        }
                    }
                    continue;
                }
                continue;
            }

            if (isignatureBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                        + getTextResourceService().getText(ERROR_XML_A_JP2_SIGNATURE));
            }
            if (ifileTypeBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                        + getTextResourceService().getText(ERROR_XML_A_JP2_FILETYPE));
            }
            if (iimageHeaderBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_IMAGE));
            }
            if (ibitsPerComponentBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_BITSPC));
            }
            if (icolourSpecificationBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_COLOUR));
            }
            if (ipaletteBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_PALETTE));
            }
            if (icomponentMappingBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_MAPPING));
            }
            if (ichannelDefinitionBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_CHANNEL));
            }
            if (iresolutionBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_RESOLUTION));
            }

            if (icontainsImageHeaderBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_NOIHB));
            }
            if (icontainsColourSpecificationBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_NOCSB));
            }
            if (icontainsBitsPerComponentBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_NBPCB));
            }
            if (ifirstJP2HeaderBoxIsImageHeaderBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_IHBNF));
            }
            if (inoMoreThanOneImageHeaderBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_IHBMO));
            }
            if (inoMoreThanOneBitsPerComponentBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_OBPCMO));
            }
            if (inoMoreThanOnePaletteBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_OPBMO));
            }
            if (inoMoreThanOneComponentMappingBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_CMBMO));
            }
            if (inoMoreThanOneChannelDefinitionBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_CDBMO));
            }
            if (inoMoreThanOneResolutionBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_RBMO));
            }
            if (icolourSpecificationBoxesAreContiguous >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_CSBNC));
            }
            if (ipaletteAndComponentMappingBoxesOnlyTogether >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_B_JP2)
                        + getTextResourceService().getText(ERROR_XML_B_JP2_PACMB));
            }

            if (icodestreamStartsWithSOCMarker >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_SOC));
            }
            if (ifoundSIZMarker >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_FSIZ));
            }
            if (ifoundCODMarker >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_FCOD));
            }
            if (ifoundQCDMarker >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_FQCD));
            }
            if (iquantizationConsistentWithLevels >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_PQCD));
            }
            if (ifoundExpectedNumberOfTiles >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_NOTILES));
            }
            if (ifoundExpectedNumberOfTileParts >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_NOTILESPART));
            }
            if (ifoundEOCMarker >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_EOC));
            }

            if (itileParts >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_TILEPARTS));
            }
            if (isiz >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_SIZ));
            }
            if (icod >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_COD));
            }
            if (iqcd >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_QCD));
            }
            if (icom >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_COM));
            }
            if (icoc >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_COC));
            }
            if (irgn >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_RGN));
            }
            if (iqcc >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_QCC));
            }
            if (ipoc >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_POC));
            }
            if (iplm >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_PLM));
            }
            if (ippm >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_PPM));
            }
            if (itlm >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_TLM));
            }
            if (icrg >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_CRG));
            }
            if (iplt >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_PLT));
            }
            if (ippt >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_C_JP2)
                        + getTextResourceService().getText(ERROR_XML_C_JP2_PPT));
            }

            if (ixmlBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_D_JP2)
                        + getTextResourceService().getText(ERROR_XML_D_JP2_XML));
            }
            if (iuuidBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_D_JP2)
                        + getTextResourceService().getText(ERROR_XML_D_JP2_UUID));
            }
            if (iuuidInfoBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_D_JP2)
                        + getTextResourceService().getText(ERROR_XML_D_JP2_UUIDINFO));
            }
            if (iunknownBox >= 1) {
                getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_D_JP2)
                        + getTextResourceService().getText(ERROR_XML_D_JP2_UNKNOWN));
            }
        }

    } catch (Exception e) {
        getMessageService().logError(getTextResourceService().getText(MESSAGE_XML_MODUL_A_JP2)
                + getTextResourceService().getText(ERROR_XML_UNKNOWN, e.getMessage()));
    }
    return isValid;
}

From source file:com.acrutiapps.browser.tasks.HistoryBookmarksImportTask.java

/**
 * Get the content of a node, why Android does not include Node.getTextContent() ?
 * @param node The node./*from w  w  w . j  a v  a  2 s .c  o  m*/
 * @return The node content.
 */
private String getNodeContent(Node node) {
    StringBuffer buffer = new StringBuffer();
    NodeList childList = node.getChildNodes();
    for (int i = 0; i < childList.getLength(); i++) {
        Node child = childList.item(i);
        if (child.getNodeType() != Node.TEXT_NODE) {
            continue; // skip non-text nodes
        }
        buffer.append(child.getNodeValue());
    }

    return buffer.toString();
}

From source file:org.dozer.eclipse.plugin.sourcepage.contentassist.DozerContentAssistProcessor.java

@Override
@SuppressWarnings("restriction")
protected ContentAssistRequest computeContentProposals(int documentPosition, String matchString,
        ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) {
    if ("class-a".equals(node.getNodeName()) || "class-b".equals(node.getNodeName())) {
        if (nodeAtOffset.getNodeType() == Node.TEXT_NODE) {
            return computeDozerClassContentProposals(documentPosition, nodeAtOffset.getNodeValue(),
                    completionRegion, nodeAtOffset, node);
        }/*from  w  w  w . j  ava 2s .com*/
    } else if ("a".equals(node.getNodeName()) || "b".equals(node.getNodeName())) {
        if (nodeAtOffset.getNodeType() == Node.TEXT_NODE
                && "field".equals(node.getParentNode().getNodeName())) {
            return computeDozerPropertyContentProposals(documentPosition, nodeAtOffset.getNodeValue(),
                    completionRegion, nodeAtOffset, node);
        }
    }

    return super.computeContentProposals(documentPosition, matchString, completionRegion, nodeAtOffset, node);
}