I have problem with xml parsing
I got an XML response from the server with this header:
?xml version="1.0"?
So I can't parse it and I can't get my attribute values. In same structure static I will parse else it won't work .
If i add my header file statically like this ?xml version=\"1.0\" encoding=\"UTF-8\"? it will work fine .
However if I dynamically append this "encoding=\"UTF-8\" in my xml it shows an error
Parser error Error Domain=NSXMLParserErrorDomain Code=64 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 64.)"
see the full xml file
Related
I am getting a schema validation error when i host my SWAGGER.JSON file on my local server that runs the swagger.html.
But, when i put the file in
https://raw.githubusercontent.com/novastorm123/abapswaggerNW7.0/master/swagger_70.json
It works.
I don't get any console error in both cases.
I treid to disable the online validator error from swagger.
I used
validatorUrl : null
But it is not working and i am still getting the error at the bottom of the page.
On clicking of the error i am getting the message
{"schemaValidationMessages":[{"level":"error","message":"Can't read from file
/api/swagger.json"}]}
Whenever i am pasting my JSON in the online editor, it is accepting it as a valid JSON Input
I am developing an iPhone app. I have to get data from .NET server. The response is in the following form.
<string xmlns="http://tempuri.org/">
{"success":1,"message":"Data Save Successfully.","returnvalue":"106"}
</string>
I am using NSXMLParser to parse to parse it. I want to get the json string . But the parser is giving error
Server was unable to process request. ---> Data at the root level is invalid. Line 1, position 1.
How can i fix the error.
Thanks in advance
The String in the respons is a JSON, So i think the NSXMLParser don't work with a JSON input. The parsing error is because the syntax of XML is different then from JSON.
This link will help you to read the String JSON response you get.
how to parse json with swift2
I have a strange issue while getting response from SVC webservice.
I have a response as below:
When I am fetching content from "AboutOrganization" key.
I am getting error as below:-
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Something looked like a 'null' but wasn't around character 324840.) UserInfo=0xc52345b0 {NSDebugDescription=Something looked like a 'null' but wasn't around character 324840.}
I have used NSJSONSerialization to get data from Webservice response.
I am not sure, But getting this type of Error because JSON object contents HTML escape sequence characters as below:
If I am right then give me solution for the same. And If i am wrong then guide me why i am getting this type of error.
Appreciate your time and help
Thank you in advance.
I'm using sudzc soap client in an iOS app.
Here is soap method declaration
(SoapRequest*) UploadData: (myid <SoapDelegate>) handler myid: (NSString*) myid props: (NSString*) props
For example, if i pass string "<test>" in the second parameter, i get following error:
a:DeserializationFailed The formatter threw an exception while trying
to deserialize the message: Error in deserializing body of request
message for operation 'UploadData'. End element 'props' from namespace
'http://tempuri.org/' expected. Found element 'test' from namespace
'http://tempuri.org/'. Line 1, position 338.
Why can't sudzc handle "<" or ">" characters in string parameter? Do i have to manually escape these characters?
I don't think this error is related to iOS or sudzc generator. SOAP uses XML for data transfer, so you have to encode any special characters according to XML spec. See the following answer.
when i try to parse the response returned from a web service i got this stack:
JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character\" UserInfo=0x6e76c30 {NSLocalizedDescription=Unrecognised leading character}"
)
My code is like this:
if(request.responseStatusCode==200)
{
NSLog(#"so far, this block of code works");//this log is displayed
//parse the response
NSArray *array=[[request responseString]JSONValue];
//processing the array and do whatever
In this thread they talking about an old version of the JSON library and how to update it, please help me figure out what should i do.
EDIT:
when trying to parse the response, i wanted to see why the server return, so an NSLog like so:
if(request.responseStatusCode==200)
{
NSLog(#"the request is %#", request.responseString);
//parse the response
NSArray *array=[[request responseString]JSONValue];
//processing the array and do whatever
give me this stack:
the request is <br />
<b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in <b>/homepages/25/xxxx/htdocs/my app/webservices/index.php</b> on line <b>39</b><br />
<br />
<b>Fatal error</b>: Call to undefined function sendResponse() in <b>/homepages/25/xxxxx/htdocs/my app/webservices/index.php</b> on line <b>57</b><br />
2012-01-20 15:10:45.491 my-iPhone-application[882:11603] -JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character\" UserInfo=0x6ebd450 {NSLocalizedDescription=Unrecognised leading character}"
)
EDIT 2:
My application sent an array that is supposed to be received and processed in the web services. So one example of how the array received looks like is:
(
Mairie,
\"Pr\\U00e9fectures et sous-pr\\U00e9fectures\",
\"Auto-\\U00e9cole\"
)
The strange ant-slashes and 00 are the é caracter. Am i wrong to use them in my data? Is this which is causing my problem?
The error pretty much says it all, the parser does not consider the JSON string is it reading to be valid JSON. "Unrecognised leading character" means that it found something other than a { or [ character as the first character in the string returned from [request responseString]
If you post the raw JSON we might be able to help you point out exactly what is wrong with the response.
HTH
If request.responseString returns <br /> then it looks like your server is returning HTML and HTML isn't JSON ;)
Your use of the JSON library is correct, it's either your request or (more likely given the response) your server thats broken.
On the plus side, you have accidentally done some error testing on your app :)