-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
when create a JSONObject from XML String like
<?xml version="1.0" encoding="utf-8"?><tagA> : </tagA>
spaces at then begin and at the end of string are trimmed
public static void main(String[] args) {
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><tagA> :</tagA>";
JSONObject jo = XML.toJSONObject(xml, true);
System.out.println("Test 1");
System.out.println(jo.toString());
xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><tagA> : </tagA>";
jo = XML.toJSONObject(xml, true);
System.out.println("Test 2");
System.out.println(jo.toString());
xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><tagA>: </tagA>";
jo = XML.toJSONObject(xml, true);
System.out.println("Test 3");
System.out.println(jo.toString());
}
output
Test 1
{"tagA":":"}
Test 2
{"tagA":":"}
Test 3
{"tagA":":"}
is possible add a parameter to avoid trimming ?
i think that method involved is nextContent() of XMLTokener.java
Metadata
Metadata
Assignees
Labels
No labels