Click here to Skip to main content
15,845,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
<string xmlns="http://tempuri.org/">

    [{"POSCODE":"01","POSDESC":"BAR"},
    {"POSCODE":"13","POSDESC":"CAT AC"},
    {"POSCODE":"02","POSDESC":"CATERING"},
    {"POSCODE":"15","POSDESC":"CLUB FUNCTIONS"},
    {"POSCODE":"07","POSDESC":"GYM"},
    {"POSCODE":"14","POSDESC":"OTHERS"},

</string>


This is my Asp.net webservice JsonString Output

my webservice Responce string xmlns=&quot;http://tempuri.org when i try to create Json Array. Is there any possible to remove string xmlns=&quot;http://tempuri.org/&quot; from android??

[Edit]Pre tags placement modified - Naz_Firdouse[/Edit]
Posted
Updated 29-May-14 22:21pm
v2

Your string result is already in JSON ;)
Just revise the end of your string, then read it and use it as you want.
JavaScript
[{"POSCODE":"01","POSDESC":"BAR"},
{"POSCODE":"13","POSDESC":"CAT AC"},
{"POSCODE":"02","POSDESC":"CATERING"},
{"POSCODE":"15","POSDESC":"CLUB FUNCTIONS"},
{"POSCODE":"07","POSDESC":"GYM"},
{"POSCODE":"14","POSDESC":"OTHERS"}]

If your result was in a "real" XML format, I've suggested this link to you ;)
http://stackoverflow.com/questions/18337394/convert-xml-to-json-object-in-android[^]
 
Share this answer
 
v2
You already have it done! If you just want to remove that one particular text part. You can use this simple method too.

Java
// ignore this part.
xmlns="http://tempuri.org/"
// 
String stringContent = "JsonResultAsStringHere";
String newString = stringContent.Replace("xmlns=\"http://tempuri.org/\"", "");
// use it anywhere as newString.


This would do it. It would just remove the attribute from the String and then you can convert it back to the XML.
 
Share this answer
 
C# Xml to Json code here.

http://xamarin.me/wordpress/?p=7[^]


Thanks,
Harshad
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900