Search Results

Search found 4962 results on 199 pages for 'parse'.

Page 9/199 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Easiest Way to Parse data from twitter with Cocoa

    - by happyCoding25
    Hello, I've followed the tutorial from here: Twitter Client Tutorial to make a little twitter app. Now I need to find out how to parse the XML twitter gives you when you make a request. I've looked at tons of tutorials on phrasing xml on the iPhone but none have made much sense because Im still new to cocoa. Twitter stores the text of the tweet in something like this <text> Some tweet here </text>. From reading the tutorials I think this would involve nsxmlparser but I'm not sure. If anyone could share some code that could parse the <text> Some tweet here </text> things into an array that would be really great. Thanks in advance

    Read the article

  • How can I construct and parse a JSON string in Scala / Lift

    - by David Carlson
    I am using JsonResponse to send some JSON to the client. To test that I am sending the correct response it seemed natural to me to parse the resulting JSON and validate against a data structure rather than comparing substrings. But for some reason I am unable to parse the JSON I just constructed: def tryToParse = { val jsObj :JsObj = JsObj(("foo", "bar")); // 1) val jsObjStr :String = jsObj.toJsCmd // 2) jsObjStr is: "{'foo': 'bar'}" val result = JSON.parseFull(jsObjStr) // 3) result is: None // the problem seems to be caused by the quotes: val works = JSON.parseFull("{\"foo\" : \"bar\"}") // 4) result is: Some(Map(foo -> bar)) val doesntWork = JSON.parseFull("{'foo' : 'bar'}") // 5) result is: None } How do I programmatically construct a valid JSON message in Scala/Lift that can also be parsed again?

    Read the article

  • Best tools to parse reports

    - by Andy Schaefer
    I have a report that I need to parse/scrape for loading into an alternate or query-able data store. The report looks like something akin to: this. My gut is that PERL would do a decent job, but I have several different permutations of the report and I don't really want to make a script around each form. This report is a pretty stock type report, and I have seen where Monarch Pro can parse these types of reports, but I have had a difficult time finding alternatives to how these could be parsed since I'm looking to do this working primarily in a Linux environment. Any suggestions?

    Read the article

  • DateTime.Parse with the "+" symbol

    - by Blah_Blah
    So I have a piece of code which parses and validates user input: DateTime myDateTime = DateTime.Parse(userInput,currentCulture); Current culture is being set (to en-ca or en-fr) and the user Input is always in ISO 8601 format "yyyy-MM-dd". If the user enters 1900-01-01 the date is created as expected. If the input is "1900-01+01" the date time created is 1899-12-31 6:00:00 PM No exception is thrown, the DateTime.Parse happily converts this to the wrong date. To make this work I am using DateTime.ParseExact(userInput,"yyyy-MM-dd",currentCulture). So my question is: whats up with the +01 or any + value? Am I missing something in ISO standard?

    Read the article

  • change/part doesn't work as expected with parse

    - by Rebol Tutorial
    According to http://www.rebol.com/docs/core23/rebolcore-15.html You can use change/part to parse and replace but that doesn't work well with this where I just try to replace the block <mytag > ... </mytag> by "MyString" content: {<mytag id="a" 111111111111111> </mytag> aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa <mytag id="b" 22222222222222222> </mytag> <mytag id="c" 3333333333333> </mytag> aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa <mytag id="d" 444444444444444> </mytag> } mytag: [ to {<mytag} start: ( ) thru {<mytag} to {id="} thru {id="} copy ID to {"} thru {"} to {</mytag>} thru {</mytag>} ending: (change/part start "mystring" ending) mark: ( write clipboard:// mark input) ] rule: [any mytag to end] parse content rule

    Read the article

  • Using sscanf to parse two strings out

    - by Jessica
    I have a semi xml formatted file that contains line with the following format: <param name="Distance" value="1000Km" /> The first char in the string is usually a TAB or spaces. I've been using the following to try to parse the two strings out (from name and value): if(sscanf(lineread, "\t<param name=\"%s\" value=\"%s\" />", name, value) == 1) { //do something } name and value are char* Now, the result is always the same: name gets parse (I need to remove the quotes) and name is always empty. What am I doing wrong? Thanks, code is appreciated. Jess.

    Read the article

  • using jquery to parse XML export in drupal

    - by gables20
    I need to use jquery to parse a drupal xml export that was created with views datasource module. The format of the xml export is shown below and on the browser, its access by entering, say for example, http://mydomain/test.xml, where test.xml represents the path of the xml export. <node> <node> <nothing> Lorem ipsum </nothing> </node> <node> The jquery to parse xml is shown below. But, it does nothing, which is kind of the main problem. $(document).ready(function(){ $.ajax({ type: "GET", url: "http://mydomain/test.xml", dataType: "xml", success: function(xml){ $(xml).find('node').each(function(){ var title = $(this).find('nothing').text(); $('#output').append($(this).find('nothing').text()); }); } }); });

    Read the article

  • Parse XML with XPath & namespaces in Java

    - by ripper234
    Can you help me adjust this code so it manages to parse the XML? If I drop the XML namespace it works: String webXmlContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<foo xmlns=\"http://foo.bar/boo\"><bar>baz</bar></foo>"; DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); org.w3c.dom.Document doc = builder.parse(new StringInputStream(webXmlContent)); NamespaceContextImpl namespaceContext = new NamespaceContextImpl(); namespaceContext.startPrefixMapping("foo", "http://www.w3.org/2001/XMLSchema-instance"); XPath xpath = XPathFactory.newInstance().newXPath(); xpath.setNamespaceContext(namespaceContext); XPathExpression expr = xpath.compile("/foo/bar"); Object result = expr.evaluate(doc, XPathConstants.NODESET); NodeList nodes = (NodeList) result; System.out.println("Got " + nodes.getLength() + " nodes");

    Read the article

  • How to Parse 'Mathy' Stuff...

    - by Rob P.
    Please forgive my title, I really don't know how to phrase it better. This isn't a school assignment or anything, but I realize it's a mostly academic question. But, what I've been struggling to do is parse 'math' text and come up with an answer. For Example - I can figure out how to parse '5 + 5' or '3 * 5' - but I fail when I try to correctly chain operations together. (5 + 5) * 3 It's mostly just bugging me that I can't figure it out. If anyone can point me in a direction, I'd really appreciate it.

    Read the article

  • DocumentBuilder.parse() / Parsing Entities

    - by stormin986
    I'm new to parsing XML and am having an issue with entities. (Am doing this on Android, if it makes a difference). Is there a way to have it turn an entity into the character it represents? I have this in the child of an element: "isn&#39;t" (minus quotes). I would prefer it parse it and the end result be a single text node. However, right now this is turned in to TEXT, ENTITY, TEXT. Is there a way to automatically have it parse the entity into text, or a manual way to do it?

    Read the article

  • What the best way to parse and find The specific data

    - by Khemlall Mangal
    Ok i have an issue i want to resolve. I have the following log file, and i want to parse it and find the errors and then compare them to user expected results and if it doesnt match then error or else pass.... the part that i am having trouble with is finding error within the log.... So in this example, within the log starting point is MASTER EXCLUSIONS:[ALL_EXCLUSIONS] errors: Then error can be in two format as show below. what the regular expressssion orcode that i can use to parse this and get pull out these error from count of 1 to end and i will just be able to take the array value for exammple results[1] - compare if == myresults[1] as an exmple.... outputting it in a file is ok too

    Read the article

  • Reading custom values in Ebay RSS feed (XML::RSS module)

    - by munster
    I've spent entirely way too long trying to figure this out. I'm using XML:RSS and Perl to read / parse an Ebay RSS feed. Within the area, I see these entries: 1395 1255 However, I can't figure out how to grab the details during the loop. I wrote a regex to grab them: @current_price = $item =~ m/\(\d+)\<\/rx\:CurrentPrice/g; which works if you place the above 'CurrentPrice' entry into a standalone string, but not while the script is reading through the RSS feed. I can grab most of the information I want out of the item-description area (# bids, auction end time, BIN price, thumbnail image, etc), but it would be nicer if I could grab the info from the feed without me having to deal with grabbing all that information manually. If anybody knows how to grab custom fields from an RSS feed (short of writing regexes to parse the entire feed w/o a module), any help / insight would be appreciated.

    Read the article

  • JavaCC: Please help me understand token ambiguity.

    - by java.is.for.desktop
    Hello, everyone! I had already many problems with understanding, how ambiguous tokens can be handled elegantly (or somehow at all) in JavaCC. Let's take this example: I want to parse XML processing instruction. The format is: "<?" <target> <data> "?>": target is an XML name, data can be anything except ?>, because it's the closing tag. So, lets define this in JavaCC: (I use lexical states, in this case DEFAULT and PROC_INST) TOKEN : <#NAME : (very-long-definition-from-xml-1.1-goes-here) > TOKEN : <WSS : (" " | "\t")+ > // WSS = whitespaces <DEFAULT> TOKEN : {<PI_START : "<?" > : PROC_INST} <PROC_INST> TOKEN : {<PI_TARGET : <NAME> >} <PROC_INST> TOKEN : {<PI_DATA : ~[] >} // accept everything <PROC_INST> TOKEN : {<PI_END : "?>" > : DEFAULT} Now the part which recognizes processing instructions: void PROC_INSTR() : {} { ( <PI_START> (t=<PI_TARGET>){System.out.println("target: " + t.image);} <WSS> (t=<PI_DATA>){System.out.println("data: " + t.image);} <PI_END> ) {} } The problem is (i guess): hence <PI_DATA> recognizes "everything", my definition is wrong. Let's test it with <?mytarget here-goes-some-data?>: The target is recognized: "target: mytarget". But now I get my favorite JavaCC parsing error: !! procinstparser.ParseException: Encountered "" at line 1, column 15. !! Was expecting one of: !! Encountered nothing? Was expecting nothing? Or what? Thank you, JavaCC! I know, that I could use the MORE keyword of JavaCC, but this would give me the whole processing instruction as one token, so I'd had to parse/tokenize it further by myself. Why should I do that? Am I writing a parser that does not parse? What I would need is telling JavaCC to recognize "everything until ?>" as processing instruction data. How can it be done? Thank you.

    Read the article

  • django 'urlize' strings form tect just like twitter

    - by dana
    heyy there i want to parse a text,let's name it 'post', and 'urlize' some strings if they contain a particular character, in a particular position. my 'pseudocode' trial would look like that: def urlize(post) for string in post if string icontains ('#') url=(r'^searchn/$', searchn, name='news_searchn'), then apply url to the string return urlize(post) i want the function to return to me the post with the urlized strings, where necessary (just like twitter does). i don't understand: how can i parse a text, and search for certain strings? is there ok to make a function especially for 'urlizing' some strings? The function should return the entire post, no matter if it has such kind of strings. is there another way Django offers? Thank you

    Read the article

  • Can I use ANTLR for both two-way parsing/generating?

    - by Mike Q
    Hi all, I need to both parse incoming messages and generate outgoing messages in EDIFACT format (basically a structured delimited format). I would like to have a Java model that will be generated by parsing a message. Then I would like to use the same model to create an instance and generate a message. The first half is fine, I've used ANTLR before to go from raw - Java objects. But I've never done the reverse, or if I have it's been custom. Does ANTLR support generating using a grammar or is it really just a parse-only tool?

    Read the article

  • Java - Parsing a Date from a String

    - by Yatendra Goel
    I want to parse a java.util.Date from a String. I tried the following code but got unexpected output: Date getDate() { Date date = null; SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd"); try { date = sdf.parse("Sat May 11"); } catch (ParseException ex) { Logger.getLogger(URLExtractor.class.getName()).log(Level.SEVERE, null, ex); return null; } return date; } When I run the above code, I got the following output: Mon May 11 00:00:00 IST 1970

    Read the article

  • JavaCC: How can one exclude a string from a token? (A.k.a. understanding token ambiguity.)

    - by java.is.for.desktop
    Hello, everyone! I had already many problems with understanding, how ambiguous tokens can be handled elegantly (or somehow at all) in JavaCC. Let's take this example: I want to parse XML processing instruction. The format is: "<?" <target> <data> "?>": target is an XML name, data can be anything except ?>, because it's the closing tag. So, lets define this in JavaCC: (I use lexical states, in this case DEFAULT and PROC_INST) TOKEN : <#NAME : (very-long-definition-from-xml-1.1-goes-here) > TOKEN : <WSS : (" " | "\t")+ > // WSS = whitespaces <DEFAULT> TOKEN : {<PI_START : "<?" > : PROC_INST} <PROC_INST> TOKEN : {<PI_TARGET : <NAME> >} <PROC_INST> TOKEN : {<PI_DATA : ~[] >} // accept everything <PROC_INST> TOKEN : {<PI_END : "?>" > : DEFAULT} Now the part which recognizes processing instructions: void PROC_INSTR() : {} { ( <PI_START> (t=<PI_TARGET>){System.out.println("target: " + t.image);} <WSS> (t=<PI_DATA>){System.out.println("data: " + t.image);} <PI_END> ) {} } Let's test it with <?mytarget here-goes-some-data?>: The target is recognized: "target: mytarget". But now I get my favorite JavaCC parsing error: !! procinstparser.ParseException: Encountered "" at line 1, column 15. !! Was expecting one of: !! Encountered nothing? Was expecting nothing? Or what? Thank you, JavaCC! I know, that I could use the MORE keyword of JavaCC, but this would give me the whole processing instruction as one token, so I'd had to parse/tokenize it further by myself. Why should I do that? Am I writing a parser that does not parse? The problem is (i guess): hence <PI_DATA> recognizes "everything", my definition is wrong. I should tell JavaCC to recognize "everything except ?>" as processing instruction data. But how can it be done? NOTE: I can only exclude single characters using ~["a"|"b"|"c"], I can't exclude strings such as ~["abc"] or ~["?>"]. Another great anti-feature of JavaCC. Thank you.

    Read the article

  • django 'urlize' strings form text just like twitter

    - by dana
    heyy there i want to parse a text,let's name it 'post', and 'urlize' some strings if they contain a particular character, in a particular position. my 'pseudocode' trial would look like that: def urlize(post) for string in post if string icontains ('#') url=(r'^searchn/$', searchn, name='news_searchn'), then apply url to the string return urlize(post) i want the function to return to me the post with the urlized strings, where necessary (just like twitter does). i don't understand: how can i parse a text, and search for certain strings? is there ok to make a function especially for 'urlizing' some strings? The function should return the entire post, no matter if it has such kind of strings. is there another way Django offers? Thank you

    Read the article

  • ANTLR - Embedding Java code, evaluate before or after?

    - by wvd
    Hello all, I'm writing a simple scripting language on top of Java/JVM, where you can also embed Java code using the {} brackets. The problem is, how do I parse this in the grammar? I have two options: 1] Allow everything to be in it, such as: [a-z|a-Z|0-9|_|$], and go on 2] Get an extra java grammar and use that grammar to parse that small code (is it actually possible and efficient?) Since option 2] is basically a double-check since when evaluating java code it's also being checked. Now my last question is -- is way that can dynamically execute java code also with objects which have been created at runtime? Thanks, William van Doorn

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >