parsing

parse json array wich contains sql array

Hello, I am still searching for an answer but I haven't come up with a solution yet My question: How can I parse the json array I send it like this $data= mysql_fetch_array($r); header('Content-type: application/json'); ?> { "check": "<?php echo $check?>", "productcode": "<?php echo $code?>", "values": [<?php ech...

What is best approach for Storing data into MySQL after Parsing XML file using SAX Parser ?

Hi, I have student.xml file and am parsing this file using SAX Parser and now I need to store data into MySQL Database and so what approach is recommended. Code: package sax; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXExceptio...

jQuery parsing RSS and namespaced element like <content:encoded>

I am using jQuery to parse an RSS feed. Within each <item> is a namespaced element like <content:encoded> I want to select. How do I select it in jQuery? $(xml).find('item') works but $(xml).find('item content') does not. ...

parser/crawler algorithm question

Hi. In the process of high level design for a targeted crawler/parser. The app will be used to extract data from specific websites. Furhtermore, the app is being designed to run in a master/slave process, where the master/server side processes the packets to be parsed, and then allows the child nodes (client servers) in the system to fe...

Parse an integer from a string with trailing garbage.

I need to parse a decimal integer that appears at the start of a string. There may be trailing garbage following the decimal number. This needs to be ignored (even if it contains other numbers.) e.g. "1" => 1 " 42 " => 42 " 3 -.X.-" => 3 " 2 3 4 5" => 2 Is there a built-in method in the .NET framework to do this? int.TryParse() is...

Format ParseException with JavaCC

I was wondering how could it be possible to format in a human-readable format a ParseException thrown by JavaCC: in fact it includes fields such asbeginLine, beginColumn, endColumn, endLine in the token reference of the exception, but not the reference to the source parsed. Thanks! :) ...

hi all, i am writing an xml to store data, can anyone tell about default type of attribute?

<xs:element name ="ID"> <xs:complexType> <xs:simpleContent> <xs:attribute name="OFFSET" type="U8" fixed="00"/> </xs:complexType> </xs:simpleContent> However i want to make OFFSET greater than 1024 .in that case i get error 1024 invalid value for atomiv'U8' i tried defining OFFSET in following manner <x...

Get first lines of Wikipedia Article

I got a Wikipedia-Article and I want to fetch the first z lines (or the first x chars, or the first y words, doesn't matter) from the article. The problem: I can get either the source Wiki-Text (via API) or the parsed HTML (via direct HTTP-Request, eventually on the print-version) but how can I find the first lines displayed? Normaly t...

What is the fastest way to parse this string.

I have a string, that is in the following format: [Season] [Year] [Vendor] [Geography] so an example might be: Spring 2009 Nielsen MSA I need to be able to parse out Season and Year in the fastest way possible. I don't care about prettiness or cleverness. Just raw speed. The language is C# using VS2008, but the assembly is being bu...

Evaluating parsed expression in Haskell

This is my first question on SO :) My Haskell knowledge is pretty limited, so i need a bit of help to get me started. I have this BNF grammar: num ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 int ::= num | num int var ::= A | B | C | ... | Z expr ::= var | int | - expr | +(expr , expr) | *(expr , expr) | let var be expr in...

Can an XSLT parse a string of text?

This is my first time using XSLT. I'm trying to create a file that will convert an XML data file exported from a program I use to an HTML report. One of the element's value is path to an image file, but the path generated is an absolute path such as C:\Documents and Settings\me\Desktop\xml export\cd000402.jpg but I want a relative pa...

How do I parse HTML using regular expressions in C#?

How do I parse HTML using regular expressions in C#? For example, given HTML code <s2> t1 </s2> <img src='1.gif' /> <span> span1 <span/> I am trying to obtain 1. <s2> 2. t1 3. </s2> 4. <img src='1.gif' /> 5. <span> 6. span1 7. <span/> How do I do this using regular expressions in C#? In my case, the HTML input is not well-for...

problem in parsing

i have a page,say abc.html, that is having a small form with some fields. <form name="form" method="post" action="abc.html">.......................</form> when we submit the form it again comes back to abc.html with some data posted and shows the resulted names on the page which came after processing the posted data. in the whole pro...

xpath find specific link in page

I'm trying to get the email to a friend link from this page using xpath. http://www.guardian.co.uk/education/2009/oct/14/30000-miss-university-place The link itself is wrapped up in tags like this <li><a class="rollover sendlink" href="http://www.guardian.co.uk/email/354237257" title="Opens an email form" name="&lid={pageToolbo...

Internet Explorer XML Ajax reply value iteration

Hi there, folks. I've already asked here a question about this issue. The thing is that I would really appreciate to get your help on this, as I can't seem to detect and solve the problem I'm having with an AJAX functionality on a site that I'm currently developing. I have a webform that makes an asynchronous call to a handler (.ashx) ...

XML Schema: "use='required'" with default value

In an XML Schema, is it possible to have an element which has use='required' and a default value (e.g. <xs:attribute name="Version" type="U8" use="required" default="02"/>)? ...

Parser How To in .NET

I'd like to understand how to construct a parser in .NET to process source files. For example, maybe I could begin by learning how to parse SQL or HTML or CSS and then act on the results to be able to format them for readability or something similar. Where can I learn how to do this? Are there specific books I can refer to? Do I need to...

Facebook FBJS UTC

I am pulling in data from a JSON file using FBJS AJAX. On of the values in the json file is a date. The date has a UTC format, Date(1255535021000-0600). However, I am getting an "invalid date" or "NaN" error whatever I do. I have tried the following: new Date(1255535021000-0600), new Date(1255535021000), Date.parse(1255535021000-0600),...

Javascript parsing an integer from a string

What I want to do is determine if a string is numeric. I would like to know what people think about the two solutions I am trying to decide between (OR if there is a better solution that I have not found yet). The parseInt function is not suitable because it will return an integer value for a parameter like "40 years old". The two soluti...

Process 40M of documents (and index) as fast as possible

Hi everibody, Have a good day. So my problem is basically this, I need to process 37.800.000 files. Each "file" is really more than that, what I have is: 37.800.000 XML documents. More than 120.000.000 of Tiff images. Each of the XML documents reference one or more Tiff images and provides a set of common keywords for the images it...