Skip to content

Parsing array data with a namespace strips whitespace #35

@ssinger

Description

@ssinger

The following test case fails,

The difference between this test and testXmlWithSpaceArray which works is the xmlns attribute on the 'e' element.

 public void testXmlWithSpaceArrayNamespace() throws IOException, SAXException,     ParserConfigurationException {
        String xml =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<e xmlns=\"urn:foo-1.0\">\n" +
               "   <c>\n" +
                "      <u>\n" +
                "            <chg>\n" +
                "                  <a>\n" +
                "                      <s>   </s>" +
                "                      <s>   </s>" +
                "                  </a>" +
                "            </chg>\n" +
                "      </u>\n" +
                "   </c>\n" +
                "</e>";

        final XMLSerializer tested = new XMLSerializer();
        //tested.setKeepCData(true);
        tested.setTypeHintsEnabled(false);        
        tested.setRootName("data");

         final JSON jsonRepresentation = tested.read(xml);
        final String jsonText = jsonRepresentation.toString();
        assertTrue(jsonText.contains("[\"   \""));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions