parsing

best java Xml parser to manipulate/edit an existing xml document

TASK : I have an existing xml document (UTF-8) which uses xml namespaces and xml schema. I need to parse to a particular element, append content (that also needs to use xml namespace prefixes) to this element and then write out the Document again. which is the best XML parser library that I should be using for this TASK ? I've see...

How to use C# to parse a glossary into database?

This should be a simple one, but I'm a beginner with C#. Given a glossary list in the following format: aptitude ability, skill, gift, talent aqueous watery arguably maybe, perhaps, possibly, could be How can I parse this, and insert into a database table in the format: TABLE: Term_Glossary ==================================...

How to write the Visitor Pattern for Abstract Syntax Tree in Python?

My collegue suggested me to write a visitor pattern to navigate the AST. Can anyone tell me more how would I start writing it? As far as I understand, each Node in AST would have visit() method (?) that would somehow get called (from where?). That about concludes my understanding. To simplify everything, suppose I have nodes Root, Expr...

I need to Split a string based on a complex delimiter

In C# I need to split a string (a log4j log file) into array elements based on a particular sequence of characters, namely "nnnn-nn-nn nn:nn:nn INFO". I'm currently splitting this log file up by newlines, which is fine except when the log statements themselves contain newlines. I don't control the input (the log file) so escaping them ...

Constructing human readable sentences based on a survey

The following is a survey given to course attendees to assess an instructor at the end of the course. Communication Skills 1. The instructor communicated course material clearly and accurately. Yes No 2. The instructor explained course objectives and learning outcomes. Yes No 3. In the event of not understanding course materials the ins...

Is there an easy way to read an XML file in Java?

I'm fairly new to Java and am writing an app that needs an XML config file. The problem I have is that there doesn't seem to be any easy way to do this, which seems a bit strange. I've looked SAX and DOM and both seem quite complicated. Are there any other good API's out there? What's the best way to do this in Java? Thanks... ...

Using PHP's XMLReader, how do I get the line number of the current node?

Using the XMLReader XML parser in PHP 5.3, I need to get the line number of the current node. A column number or total offset from the beginning of the file would be nice, too. Hopefully I don't have to use some hack like parsing every raw node string for newlines (with readOuterXML()), but I don't see a getLineNo() property like in th...

Are there any PHP DocBlock parser tools available?

I would like to build some smaller scale but hightly customized documentation sites for a few projects. PhpDocumentor is pretty great but it is very heavy. I thought about trying to tweak the templates for that but after spending only a couple of minutes looking into it I decided that it would be too much work. Ideally I'd like to see s...

Why does this JSON.parse code not work?

I am trying to pass json encoded values from a php script to a, GnuBookTest.js, javascript file that initiates a Bookreader object and use the values i have passed in via the variable i named "result". The php script is sending the values like: <div id="bookreader"> <div id="BookReader" style="left:10px; right:10px; top:30px; bottom:3...

Parsing XML with jQuery... problem retrieving elements

An XML snippet: <results> <review> <api_detail_url>http://api.giantbomb.com/review/1/&lt;/api_detail_url&gt; <game> <api_detail_url>http://api.giantbomb.com/game/20462/&lt;/api_detail_url&gt; <id>20462</id> <name>SingStar</name> </game> <score>4</score> </review> </results> And ...

How to parse out MS Word formatting?

I have a rich html textbox on my asp.net mvc application. The rich html textbox is some jquery plugin that I use and has basic stuff like bold,underline and etc. Now I am anticipating that people will maybe write something in word and then copy and paste it into my textbox. However I limit the number of characters a person can have. Th...

Core Data Error "Fetch Request must have an entity"

Hi, I've attempted to add the TopSongs parser and Core Data files into my application, and it now builds succesfully, with no errors or warning messages. However, as soon as the app loads, it crashes, giving the following reason: UPDATE: I've got it all working, but my TableView doesn't show any data, and the app doesn't respond to th...

why jQuery.parseJSON is not a function?

I use the following jquery statements and i am getting the error, jQuery.parseJSON is not a function my function is, function Iteratejsondata() {var HfJsonValue = { "Table": [{ "Emp_Id": "3", "Identity_No": "", "Emp_Name": "Jerome", "Address": "Madurai", "Date_Of_Birth": "", "Desig_Name": "Supervisior", "Desig_Description": "Supervisi...

Can anyone provide sample source code for xml parsing using photoshop javascript?

Here is a sample of a simple xml file I want to parse using photoshop javascript: <Pgen> <renderSettings> <imageWidth>1000</imageWidth> <imageHeight>600</imageHeight> <SAA>16</SAA> <bgColor>E1E1E1</bgColor> <filePrefix></filePrefix> <suffix>.jpg</suffix> </renderSettings> <coverPage> <template>//TEMPLATE/Product.psd</template> <title>20...

What is contacts.edb structure?

Windows Live Messenger creates a number of files like C:\Users\USERNAME\AppData\Local\Microsoft\Windows Live Contacts{ae86acef-5a45-4447-bc32-521fc9289e1a}\DBStore\contacts.edb and stores contacts within. When looking on such files, it is obviouos that they have strict structure. However, I failed to find the description of contacts.ed...

Lexer antlr3 token problem

Can I construct a token ENDPLUS: '+' (options (greedy = false;):.) * '+' ; being considered by the lexer only if it is preceded by a token PREwithout including in ENDPLUS? PRE: '<<' ; Thanks. ...

.Net CultureInfo.InvariantCulture in Java

In .Net when handling numbers with unspecified locale I use: return double.Parse(myStr, CultureInfo.InvariantCulture.NumberFormat); Whats the equivalent in Java? java.util.Locale doesnt seem to include such a thing. ...

Checking if date parsing is correct

Hello, I have this code for checking whether the Date is OK or not, but it's not ckecking all the cases. For example when text="03/13/2009" as this date doesn't exist in the format "dd/MM/yyyy" it parses the date as 03/01/2010. Is there any way to change this behaviour and getting an exception when I try to parse a Date which is not cor...

: in node causing Keyerror in xmlparsing using ElementTree

Hi I'm using ElementTree to parse out an xml feed from Kuler. I'm only beginning in python but am stuck here. The parsing works fine until I attempt to retrieve any nodes containing ':' e.g kuler:swatchHexColor Below is a cut down version of the full feed but same structure: <rss xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:kuler=...

Python - CSV: Large file with rows of different lengths

In short, I have a 20,000,000 line csv file that has different row lengths. This is due to archaic data loggers and proprietary formats. We get the end result as a csv file in the following format. MY goal is to insert this file into a postgres database. How Can I do the following: Keep the first 8 columns and my last 2 columns, to hav...