[json-lib-user] XML Parsing Bug?
Brought to you by:
aalmiray
|
From: DiFrango, R. (CONT) <Ron...@ca...> - 2013-05-21 16:27:18
|
All,
I have the following XML snippet:
<article>
<section>
<headline><![CDATA[Test Headline.]]></headline>
</section>
</article>
And when I run it through the following transform:
XMLSerializer xmlToJsonSerializer = new XMLSerializer();
xmlToJsonSerializer.setRemoveNamespacePrefixFromElements(true);
xmlToJsonSerializer.setNamespaceLenient(true);
xmlToJsonSerializer.setTypeHintsCompatibility(false);
JSON json = (JSON) xmlToJsonSerializer.read(xmlString);
String stringJson = json.toString(4);
I get:
[["Test Headline."]]
But if I have the following:
<?xml version="1.0" encoding="UTF-16"?>
<article>
<section>
<headline><![CDATA[Test Headling.]]></headline>
<subheadline><![CDATA[Test Headling.]]></subheadline>
</section>
</article>
It works correctly as such:
[{
"headline": "Test Headling.",
"subheadline": "Test Headling."
}]
Thanks,
Ron
The information contained in this e-mail is confidential and/or
proprietary to Capital One and/or its affiliates. The information
transmitted herewith is intended only for use by the individual
or entity to which it is addressed. If the reader of this
message is not the intended recipient, you are hereby notified
that any review, retransmission, dissemination, distribution,
copying or other use of, or taking of any action in reliance upon
this information is strictly prohibited. If you have received
this communication in error, please contact the sender and delete
the material from your computer.
|