parsing

How to extract the url+parameters out of a bbcode url tag?

The following code outputs: http://www.google.com http://www.google.com&lang What is the simplest way to change the code so it outputs: http://www.google.com http://www.google.com&lang=en&param2=this&param3=that CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace...

Is there a multiple character version of strchr() in the standard C libraries?

In c if I wanted to search a string for a particular character I can just do the following char *p; p = (char *)strchr(buffer,'('); if(p){ .... but what if I want to search for more than one character (or a character range) for example "any digit". I know I could do something like char *p=0; char *i; for(i=buffer;*i!='\0';i++){ ...

extracting the first line out of a text paragraph in delphi

I have text being passed to a function. That text can contain anything, from a single character all the way to a full book. I need to extract the first like and use it as a "title" so I can name a file where I am saving that text as a backup. I am using the following: function GetTitle(var Text:string):string; var title: string; p...

XML Parser Error: What is the matter with this code?

UPDATE: Hi, I've narrowed down the problem(s) and it appears to be in this part of the code: <script type="text/javascript"> oxm_ad = {"website":"cca5e4b8-7ed2-848b-ffea-037efaac851a", "size":"468x60", "floor":"0.1", "beacon":"<div id='beacon_f936906f11' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'><img src='h...

Split a string containing command-line parameters into a String[] in Java

Similar to this thread for C#, I need to split a string containing the command line arguments to my program so I can allow users to easily run multiple commands. For example, I might have the following string: -p /path -d "here's my description" --verbose other args Given the above, Java would normally pass the following in to main:...

Android: Parsing URL into web service without space character

Hi, All I want to do is to send a URL String into my RESTFUL web service with some kind of code like this URL someURL= new URL("http://myWebService:port/service/"+CharSequence.getText()); Its all going well until I found error with space character in my URL. I found some solution about replacing the space character with %20 which is I...

In R, how can I parse csv data from a character vector to extract a data frame?

The read.table and read.csv functions in R are used to parse a file or URL containing delimited data and produce an R data frame. However, I already have a character vector that contains the CSV delimited data (using comma and \n as column and record delimiters), so I don't need to read it from a file or URL. How can I pass this charac...

Parsing XML response of bit.ly

I was trying out the bit.ly api for shorterning and got it to work. It returns to my script an xml document. I wanted to extract out the tag but cant seem to parse it properly. askfor = urllib2.Request(full_url) response = urllib2.urlopen(askfor) the_page = response.read() So the_page contains the xml document. I tried: from xml.dom...

can feedparser parse geo-rss.

the geo-rss.xml is : <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"&gt; <channel> <link>http://maps.google.com&lt;/link&gt; <title>beijing 1</title> <description><![CDATA[dsad]]></description> <item> <guid isPermaLink="false">00048b...

xml parsing in j2me

Hi frnds I wann develop J2ME application .. in this application i've to use XML parsing .. so plz tell me how i can do this... currently i'm using ECLIPSE IDE.... on Internet I got lots of source code but...there is conman problem "java.lang.NoClassDefFoundError: org/kxml/parser/XmlParser" .. so I'm not able to solve this problem....../...

Perl Treebuilder HTML Parsing, can't seem to parse to DIV, getting error "Use of uninitialized value in pattern match "

I'm new to using the Perl treebuilder module for HTML parsing and can't figure out what the issue is with this.. I have spent a few hours trying to get this to work and looked at a few tutorials but am still getting this error: "Use of uninitialized value in pattern match ", referring to this line in my code: sub{ $_[0]-> tag() eq 'div'...

How to parse a XSD file.

I am writing a code generation tool that will take in a XSD file generated from Visual Studio's Data Set Generator and create a custom class for each column in each table. I already understand how to implement a IVsSingleFileGenerator to do the code generation and how to turn that single file generator in to a multi-file generator. Howev...

Simulate php array language construct or parse with regexp?

From an external source I'm getting strings like array(1,2,3) but also a larger arrays like array("a", "b", "c", array("1", "2", array("A", "B")), array("3", "4"), "d") I need them to be an actual array in php. I know I could use eval but since it are untrusted sources I'd rather not do that. I also have no control of the external...

Simple XML parsing on PHP

Guys i have a xml file who contain this info: <?xml version="1.0" encoding="utf-8"?> <ES> <clima code="0" value="Tornado" /> <clima code="1" value="Tormenta tropical" /> <clima code="2" value="Huracan" /> <clima code="3" value="Tormentas severas" /> <clima code="4" value="Tormentas eléctricas" /> <clima code="5" ...

firefox aint dispaying parse error

Hi,all of you, i am currently using ubuntu10.04 i were trying to run php script but every time i suffered through one common problem that when i did some error in php script it doesn,t display a error or any warning message on firefox(which i am using as browser) rather than showing a blank screen .My php.ini file configuration is as fo...

Leave allowed html-tags and remove all others in text using Python

I want to add to my site ability to use some html-tags in text editor. So when user posts some text I need clean up this text - remove html-tags which are not allowed and leave allowed tags. For example, on StackOverflow: http://meta.stackoverflow.com/questions/1777/what-html-tags-are-allowed So I need some parser which has list of al...

bbcode unparser regex help

Hi, I have this function to parse bbcode -> html: $this->text = preg_replace(array( '/\[b\](.*?)\[\/b\]/ms', '/\[i\](.*?)\[\/i\]/ms', '/\[u\](.*?)\[\/u\]/ms', '/\[img\](.*?)\[\/img\]/ms', '/\[email\](.*?)\[\/email\]/ms', '/\[url\="?(.*?)"?\](.*?)\[\/url\]/ms', '/\[size\="?(.*?)"?\](.*?)\[\/size\]/ms', ...

How to get numbers out of string?

Hello I'm using a Java StreamTokenizer to extract the various words and numbers of a String but have run into a problem where numbers which include commas are concerned, e.g. 10,567 is being read as 10.0 and ,567. I also need to remove all non-numeric characters from numbers where they might occur, e.g. $678.00 should be 678.00 or -87 ...

Looking for html string jquery parser ( parse <a> links and <img>images)

Hi, I am Looking for html string jquery parser ( parse <a> links and <img> images) or for code that will parse all links and images from html string (Html string can be very big). Example: input: sdsds<div>sdd<a href='http://google.com/image1.gif'image1&lt;/a&gt; sd</div> sdsdsdssssssssssssssssssssssssssssssssssss <p> sdsdsdsds <...

Parsing problem with hpricot

I have an XML that looks like this: <data> <image src="http://www.someweb.com/something.png"/&gt; </data> What is the correct way to use hpricot to extact just 'http://www.someweb.com/something.png'? The closest I can get is this... >>(doc/"image").first => {emptyelem <image src="http://www.someweb.com/something.png"&gt;} I've re...