Skip to content

XMLHelper string2Doc ignores parameter #33

@vstange

Description

@vstange

The string2Doc in XMLHelper ignores the namespaceAwareness parameter.

 /**
     * Helper program: Transforms a String to a XML Document.
     *
     * @param inputXMLString     the input xml string
     * @param namespaceAwareness the namespace awareness
     * @return parsed document
     */
    public static Document string2Doc(String inputXMLString, boolean namespaceAwareness) {
        try {
            return XmlDocumentReader.parse(inputXMLString, false);
        } catch (IOException | SAXException e) {
            log.error("Cannot parse XML string.", e);
            return null;
        }
//        try {
//            DocumentBuilder builder = getDocumentBuilder(namespaceAwareness);
//            InputSource is = new InputSource(new StringReader(inputXMLString));
//            is.setEncoding("UTF-8");
//            return builder.parse(is);
//        } catch (SAXException | ParserConfigurationException | IOException e) {
//            log.error("cannot parse following content\n\n" + inputXMLString);
//            e.printStackTrace();
//            return null;
//        }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions