File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
main/java/com/github/underscore/lodash
test/java/com/github/underscore/lodash Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -937,6 +937,7 @@ private static String getRootName(final Map localMap) {
937937 if (String .valueOf (entry .getKey ()).startsWith ("-" )) {
938938 foundAttrs += 1 ;
939939 } else if (!String .valueOf (entry .getKey ()).startsWith (COMMENT )
940+ && !String .valueOf (entry .getKey ()).startsWith ("?" )
940941 && (!(entry .getValue () instanceof List ) || ((List ) entry .getValue ()).size () <= 1 )) {
941942 foundElements += 1 ;
942943 }
Original file line number Diff line number Diff line change @@ -2146,6 +2146,14 @@ public void toJsonFromXml24() {
21462146 + "}" ;
21472147 assertEquals (json , U .toJson ((Map <String , Object >) U .fromXml (xml )));
21482148 assertEquals (xml , U .toXml ((Map <String , Object >) U .fromJson (json )));
2149+ final String xml2 = "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>\n <?b c=\" d\" ?>\n <a></a>" ;
2150+ final String json2 = "{\n "
2151+ + " \" ?b\" : \" c=\\ \" d\\ \" \" ,\n "
2152+ + " \" a\" : {\n "
2153+ + " }\n "
2154+ + "}" ;
2155+ assertEquals (json2 , U .toJson ((Map <String , Object >) U .fromXml (xml2 )));
2156+ assertEquals (xml2 , U .toXml ((Map <String , Object >) U .fromJson (json2 )));
21492157 }
21502158
21512159 @ SuppressWarnings ("unchecked" )
You can’t perform that action at this time.
0 commit comments