Search Results

Search found 3176 results on 128 pages for 'parsing'.

Page 23/128 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Parsing a JSON Response from a .Net webservice

    - by Maskau
    Just to get this out in the open I am new to JAVA, KSOAP, and JSON. So I'll try to explain this the best I can. A while ago I created a webservice to be consumed by Blackberry Apps that we're built using the plug in for Visual Studio. Now the project I am working on, I want to consume the same webservice for Android devices. For the most part I have the base code for the Android app done and working. Here's my problem: I can successfully call the webservice and get a response. I know from creating the webservice that it sends a JSON response. My problem is trying to parse through the JSON response. I have found a few examples that I have been suiting to my needs however I am hung up on one thing. In the JSON each element is preceeded by "anyType" which is forcing my code to return no results (Ultimately I am binding the data to an ArrayList) Here's what I get if I "getProperty(0).toString()... anyType{Artist=anyType{TrackName=Champagne Supernova;}; Here is the code I am using to parse the JSON Object.... SoapObject gr = (SoapObject)envelope.getResponse(); String ro = gr.getProperty(0).toString(); //Added just to see structure of response Artist_Result.add(gr.toString()); if (ro.startsWith("{")) { JSONObject JSONObj = new JSONObject(ro); Iterator<String> itr = JSONObj.keys(); while (itr.hasNext()) { String key = (String)itr.next(); String value = JSONObj.getString(key); //bundleResult.putString(key, value); Artist_Result.add(value); } } else if (ro.startsWith("[")) { JSONArr = new JSONArray(ro); for (int i = 0; i < JSONArr.length(); i++) { JSONObj = (JSONObject)JSONArr.get(i); //bundleResult.putString(String.valueOf(i), JSONObj.toString()); Artist_Result.add(JSONObj.toString()); } } WebService Code: [WebMethod] [return: System.Xml.Serialization.XmlArrayItemAttribute(typeof(Artist))] public Artist[] GetArtist(string ArtistQuery) { // All the SQL Stuff Here SqlDataReader sReader; sReader = cmd.ExecuteReader(); List<Artist> Artists = new List<Artist>(); while (sReader.Read()) { Artist result = new Artist(); result.TrackName = sReader.GetString(0); Artists.Add(result); } sReader.Close(); sqlConn.Close(); return Artists.ToArray(); } public class Artist { public string TrackName; } Sample of XML Output from a browser: <?xml version="1.0" encoding="utf-8" ?> - <ArrayOfArtist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://bb.mcrcog.com/"> - <Artist> <TrackName>Champagne Supernova</TrackName> </Artist> - <Artist> <TrackName>Don't Look Back In Anger</TrackName> </Artist> - <Artist> <TrackName>D'you Know What I Mean</TrackName> </Artist> - <Artist> <TrackName>Go Let It Out</TrackName> </Artist> I have a feeling I will need to implement a Class, and Getters/Setters on the Android side. I'm just not sure how to go about doing that. Any help would be greatly appreciated!

    Read the article

  • Coco/R vs. ANTLR

    - by Eamon Nerbonne
    I'm evaluating using Coco/R vs. ANTLR for use in a C# project as part of what's essentially a scriptable mail-merge functionality. To parse the (simple) scripts, I'll need a parser. I've focussed on Coco/R and ANTLR because both seem fairly mature and well-maintained and capable of generating decent C# parsers. Neither seem to be trivial to use either, however, and simplicity is something I'd appreciate - particularly maintainability by others. Does anyone have any recommendations to make? What are the pros/cons of either for a parsing a small language - or am I looking into the wrong things entirely? How well do these integrate into a typical continuous integration setup? What are the pitfalls? Related: Well, many questions, such as 1, 2, 3, 4, 5.

    Read the article

  • Parsing ISO-8859-1 w/ NSXmlParser

    - by Travis
    I am usin the nsxmlparser and am wondering how I can parse ISO-8859-1 correctly into an NSString. Currently, I am getting results w/ Â for two-byte characters. The XML I'm using (not created by me) starts with <?xml version="1.0" encoding="ISO-8859-1"?> Here are the basic calls I'm using (omitted the NSThread calls). NSString *xmlFilePath = [[NSBundle mainBundle] pathForResource:sampleFileName ofType:@"xml"]; NSString *xmlFileContents = [NSString stringWithContentsOfFile:xmlFilePath encoding:NSUTF8StringEncoding error:nil]; NSData *data = [xmlFileContents dataUsingEncoding:NSUTF8StringEncoding]; NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; [parser setDelegate:self]; [parser parse];

    Read the article

  • HTML parsing - fetch and update data from the .html file

    - by Amit Jain
    I have a form in a .html files where input/select box looks like this <input type="text" id="txtName" name="txtName" value="##myName##" /> <select id="cbGender" name="cbGender"> <option>Select</option> <option selected="selected">Male</option> <option>Female</option> </select> I would need to remove '##' value textbox and also update them with different values if needed be in the textbox/checkbox/ selectbox. I would know the id of the input types. The code is to be written in groovy. Any ideas?

    Read the article

  • BOOST program_options: parsing multiple argument list.

    - by Arman
    Hello, I would like to pass the multiple arguments with positive or negative values. Is it possible to parse it? Currently I have a following initialization: vector<int> IDlist; namespace po = boost::program_options; po::options_description commands("Allowed options"); commands.add_options() ("IDlist",po::value< vector<int> >(&IDlist)->multitoken(), "Which IDs to trace: ex. --IDlist=0 1 200 -2") ("help","print help") ; and I would like to call: ./test_ids.x --IDlist=0 1 200 -2 unknown option -2 So,the program_options assumes that I am passing -2 as an another option. Can I configure the program_options in such a way that it can accept the negative integer values? Thanks Arman.

    Read the article

  • parsing a list and producing a structure of that

    - by qzar
    ;; structure representing homework points ;; nr: number - the number of the homework ;; points: number - the number of points reached (define-struct homework (nr points)) ;; parse-homework: (list of number pairs) -> (list of homework) ;; The procedure takes a list of number pairs and produces a list of homework structures ;; Example: (parse-homework (list (list 1 6) (list 2 7) (list 3 0))) should produce (list (make-homework 1 6) (make-homework 2 7) (make-homework 3 0)) (define (parse-homework homework-entries) (if (and (= (length (first homework-entries) 2))(= (length (parse-homework (rest homework-entries)) 2))) (make-homework (first homework-entries) (parse-homework (rest homework-entries))) (error 'Non-valid-input "entered list is not of length two")) ) (parse-homework (list (list 1 6) (list 2 7) (list 3 0))) This code produces the error length: expects 1 argument, given 2: (list 1 6) 2 I really appreciate every explanation that you can give me to get in in this scheme-stuff... Thank you very much

    Read the article

  • Parsing XML in a non-XML column

    - by slugster
    Hi, i am reasonably proficient with SQLServer, but i'm not a DBA so i'm not sure how to approach this. I have an XML chunk stored in an ntext column. Due to it being a legacy database and the requirements of the project i cannot change the table (yet). This is an example of the data i need to manipulate: <XmlSerializableHashtable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Entries> <Entry> <key xsi:type="xsd:string">CurrentYear</key><value xsi:type="xsd:string">2010</value> </Entry> <Entry> <key xsi:type="xsd:string">CurrentMonth</key><value xsi:type="xsd:string">4</value> </Entry> </Entries> </XmlSerializableHashtable> each row will have a chunk like this, but obviously with different keys/values in the XML. Is there any clever way i can parse this XML in to a name/value pairs style view? Or should i be using SQLServer's XML querying abilities even though it isn't an XML column? If so, how would i query a specific value out of that column? (Note: adding a computed XML column on the end of the table is a possibility, if that helps). Thanks for any assistance!

    Read the article

  • Email attachment parsing via mime4j

    - by Ashish
    Hi, I am using a small java smtp library (http://code.google.com/p/subethasmtp/), by this I need to parse the incoming emails in separate components viz body, attachments etc. I am trying to use mime4j , but the documentation suggests that mime4j can only give event notification or token notification and nothing else. For stripping out body and attachments etc I had to use my own custom logic inside the event handlers. Is my observation correct? If yes then how can I use mime4j to use for my requirement. Please suggest. I badly need an approach that takes in the smtp data stream and returns me with an array of attachment references or streams in fully parsed out form in java. Please help. Thanks in advance Ashish Sharma

    Read the article

  • html parsing in c#

    - by dasht
    hi, How can i parse values from the scoreboard of http://www.cricinfo.com/nzvaus2010/engine/current/match/423789.html Any help will be appreciated.

    Read the article

  • zend gdata google base getting link url and parsing xml with object oriented php

    - by thrice801
    Hi, So I am using Zend frameworks Gdata extension to parse xml data from google base. http://framework.zend.com/manual/en/zend.gdata.gbase.html Working fine minus one damn important thing I cant seem to parse, the link to the actual page, because there are two elements and its returned as an array. Anyways Ive tried vardumping the array but what comes out didnt help me figure out what was going on any better. So heres the specifics of the issue. echo $entry->title->text."<br />".$entry->id->text."<br />".$entry->content->text."<br />".$entry->author[0]->name."<br />"; (the above code works fine). Now according to the documentation I thought I could get the link href by going $entry-link-text or $entry-link-url (tried both, neither worked). Anyways, Im not sure whether this is zend specific or just a gap in my OOP understanding, but any help would be much appreciated!

    Read the article

  • Parameter parsing with Java Restlet

    - by Leaf
    I'm trying to make a calculator web service that has more than 10 parameters. Is there any function in the Java Restlet or in Java itself that allows you to see the parameter ids? e.g. http://mywebsite.com/calculator?id1=value1&id2=value2&id3=value3 = I'm trying to access the values of id1, id2, and id3 so that I don't have to require people using the web service to input all parameters (some of them are likely to be 0).

    Read the article

  • Parsing a given binary tree using python?

    - by kaushik
    Parse a binary tree,referring to given set of features,answering decision tree question at each node to decide left child or right child and find the path to leaf node according to answer given to the decision tree.. input wil be a set of feature which wil help in answering the question at each level to choose the left or right half and the output will be the leaf node.. i need help in implementing this can anyone suggest methods?? Please answer... thanks in advance..

    Read the article

  • JASON parsing in iphone

    - by hardik
    hello all i am having a little query i want to know that how to parse the xml string in to JASON string i want to parse the xml string in to JASON string a little code would be boost thanks in advance

    Read the article

  • Parsing an MS Project 2007 xml project file.

    - by fred-22
    Has anyone got any idea how to read the XML file saved by MS Project 2007? The standard binary format is .MPP but I'd like to view a project in a different viewer. I've saved the project spec as XML and the viewer I'm using needs the parent task Id for each task. Where can i find that in the rather huge amount of XML data created by ms project?

    Read the article

  • Need help regarding one LALR(1) parsing.

    - by AppleGrew
    I am trying to parse a context-free language, called Context Free Art. I have created its parser in Javascript using a YACC-like JS LALR(1) parser generator JSCC. Take the example of following CFA (Context Free Art) code. This code is a valid CFA. startshape A rule A { CIRCLE { s 1} } Notice the A and s in above. s is a command to scale the CIRCLE, but A is just a name of this rule. In the language's grammar I have set s as token SCALE and A comes under token STRING (I have a regular expression to match string and it is at the bottom of of all tokens). This works fine, but in the below case it breaks. startshape s rule s { CIRCLE { s 1} } This too is a perfectly valid code, but since my parser marks s after rule as SCALE token so it errors out saying that it was expecting STRING. Now my question is, if there is any way to re-write the production rules of the parser to account for this? The related production rule is:- rule: RULE STRING '{' buncha_replacements '}' [* rule(%2, 1) *] | RULE STRING RATIONAL '{' buncha_replacements '}' [* rule(%2, 1*%3) *] ; One simple solution I can think of is create a copy of above rule with STRING replaced by SCALE, but this is just one of the many similar rules which would need such fixing. Furthermore there are many other terminals which can get matched to STRING. So that means way too many rules!

    Read the article

  • Twitter integration and iOS5: semantic and parsing issues

    - by Tyler
    I was using some of Apple's example code to write the Twitter integration for my app. However, I get a whopping amount of errors (mostly being Semantic and parse errors). How can this be solved? -(IBAction)TWButton:(id)sender { ACAccountStore *accountstore = [[ACAccountStore alloc] init]; //Make sure to retrive twitter accounts ACAccountType *accountType = [accountstore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; [accountstore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) { if (granted) [{ NSArray *accountsArray = [accountstore accountsWithAccountType:accountType]; if ([accountsArray count] > 0) { ACAccount *twitterAccount = [accountsArray objectAtIndex:0]; TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/statuses/update.json"] parameters:[NSDictionary dictionaryWithObject:[@"Tweeted from iBrowser" forKey:@"status"] requestMethod:TWRequestMethodPOST]; [postRequest setAccount:twitterAccount]; [postRequest preformRequestWithHandeler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]]; [self preformSelectorOnMainThread:@selector(displaytext:) withObject:output waitUntilDone:NO]; }]; } }]; } //Now lets see if we can actually tweet -(void)canTweetStatus { if ([TWTweetComposeViewController canSendTweet]) { self.TWButton.enabled = YES self.TWButton.alpha = 1.0f; }else{ self.TWButton.enabled = NO self.TWButton.alpha = 0.5f; } }

    Read the article

  • Parsing Twitter API Datestamp

    - by Chris Armstrong
    I'm using the twitter API to return a list of status updates and the times they were created. It's returning the creation date in the following format: Fri Apr 09 12:53:54 +0000 2010 What's the simplest way (with PHP or Javascript) to format this like 09-04-2010?

    Read the article

  • Parsing SGF files in C#

    - by mafutrct
    The text-based Smart Game Format has become the sole file format for exchanging Go game records by now. I stared with disbelieve that there are almost no parsers available. Google yielded a few results in antique Java and Python, but no modern implementations. I am curious if I have to write my own parser. Do you know of a modern implementation in C# or Java? In case there really are no parsers available, how should I implement one? Are there general guidelines or tools (in a C# environment) I should know of? This is an example file: (;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2] RU[Japanese]SZ[19]KM[6.50] PW[White]PB[Black] ;B[pd] ;W[dc] ;B[dq] ;W[pp] ;B[ce] (;W[ed] ;B[ci] ;W[kc]) (;W[do] ;B[dl] ;W[gp] ;B[eo] ;W[en] ;B[fo]))

    Read the article

  • PHP simpleXML parsing

    - by FFish
    I need currency conversion, euro to dollar. The European Central bank provides the rates here: http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml I can get the USD rate by using the first node, but what if they change the order? Do I need something more reliable? I have no idea how.. $xml = @simplexml_load_file('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'); echo "dollar: " . $xml->Cube->Cube->Cube[0]->attributes()->rate;

    Read the article

  • Parsing XML with the PHP XMLReader

    - by coffeecoder
    Hi Guys, I am writing program that reads in some XML from the $_POST variable and then parses using the PHP XMLReader and the data extracted input into a database. I am using the XMLReader as the XML supplied will more than likely be too big to place into memory. However I am having some issues, my XML and basic code as are follows: '<?xml version="1.0"?> <data_root> <data> <info>value</info> </data> <action>value</action> </data_root>' $request = $_REQUEST['xml']; $reader = new XMLReader(); $reader->XML($request); while($reader->read()){ //processing code } $reader->close() My problem is that the code will work perfectly if the XML being passed does not have the <?xml version="1.0"?> line, but if i include it, and it will be included when the application goes into a live production environment, the $reader->read() code for the while loop does not work and the XML is not parsed within the while loop. Has anyone seen similar behaviour before or knows why this could be happening? Thanks in advance.

    Read the article

  • Parsing XML via jQuery, nested loops

    - by Coughlin
    I am using jQuery to parse XML on my page using $.ajax(). My code block is below and I can get this working to display say each result on the XML file, but I am having trouble because each section can have MORE THAN ONE and im trying to print ALL grades that belong to ONE STUDENT. Here is an example of the XML. <student num="505"> <name gender="male">Al Einstein</name> <course cid="1">60</course> <course cid="2">60</course> <course cid="3">40</course> <course cid="4">55</course> <comments>Lucky if he makes it to lab, hopeless.</comments> </student> Where you see the I am trying to get the results to print the grades for EACH student in each course. Any ideas on what I would do? Thanks, Ryan $.ajax({ type: "GET", url: "final_exam.xml", dataType: "xml", success: function(xml) { var student_list = $('#student-list'); $(xml).find('student').each(function(){ $(xml).find('course').each(function(){ gradeArray = $(this).text(); console.log(gradeArray); }); var name = $(this).find("name").text(); var grade = $(this).find("course").text(); var cid = $(this).find("course").attr("cid"); //console.log(cid); student_list.append("<tr><td>"+name+"</td><td>"+cid+"</td><td>"+grade+"</td></tr>"); }); } });

    Read the article

  • SimplePie not parsing flickr feed

    - by mn
    I am trying to use SimplePie to pull a group pool flickr feed: $feed = new SimplePie(); $feed->set_feed_url('http://api.flickr.com/services/feeds/groups_pool.gne?id=25938750@N00&lang=en-us&format=rss_200'); $feed->init(); $feed->handle_content_type(); Then I use typical SimplePie php calls to loop through the feed items. However, nothing is returned. The HTML is there, but the feed elements aren't inserted. When I try to use a flickr feed of tags, like: $feed->set_feed_url('http://api.flickr.com/services/feeds/photos_public.gne?tags=architecture,building&lang=en-us&format=rss_200'); I get back a list of photos from the public photo feed, but the tags aren't taken into account. Any ideas? The only thing I can think of is I need an API key, but there is nothing on the flickr website that indicates a key is needed for feed calls. Plus, I can open both types of feeds in my browser and get the feed I am looking for.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >