FAQ Database Discussion Community


Parsing html using Selenium - class name contains spaces

python,html,parsing,selenium,text
I'm trying to parse some html using Selenium. The problem is that it raises error in case the class name contains spaces. Here is the tag I'm searching for: <p class="p0 ng-binding">text</p> I've tried these two options: result.find_element_by_class_name('departure').find_element_by_css_selector('p.p0 ng-binding').text result.find_element_by_class_name('departure').find_element_by_class_name('p0 ng-binding').text >>> selenium.common.exceptions.InvalidSelectorException: Message: The given selector p0 ng-binding is...

parse string of array in php

php,arrays,string,parsing
How do I parse string of array so i can get the value of variable sample string $str = 'prices[holiday:waterpark][person:1_person]'; sample variable $prices['holiday:waterpark']['person:1_person'] = 100; I have tried using variables.variable way in php like this $prices['holiday:waterpark']['person:1_person'] = 100; $str = "prices\['holiday:waterpark'\]\['person:1_person'\]"; $str = str_replace('\\', '', $str); echo $$str; but thats...

How to extract derivation rules from a bracketed parse tree?

java,parsing,recursion,nlp,pseudocode
I have a lot of parse trees like this: ( S ( NP-SBJ ( PRP I ) ) ( [email protected] ( VP ( VBP have ) ( NP ( DT a ) ( [email protected] ( NN savings ) ( NN account ) ) ) ) ( . . ) )...

Stanford Parser - Factored model and PCFG

parsing,nlp,stanford-nlp,sentiment-analysis,text-analysis
What is the difference between the factored and PCFG models of stanford parser? (In terms of theoretical working and mathematical perspective)

How to set up XPath query for HTML parsing?

python,xml,parsing,xpath,lxml
Here is some HTML code from http://chem.sis.nlm.nih.gov/chemidplus/rn/75-07-0 in Google Chrome that I want to parse the website for some project. <div id="names"> <h2>Names and Synonyms</h2> <div class="ds"><button class="toggle1Col"title="Toggle display between 1 column of wider results and multiple columns.">&#8596;</button> <h3 id="yui_3_18_1_3_1434394159641_407">Name of Substance</h3> <ul> <li id="ds2"> `` <div>Acetaldehyde</div> </li> </ul>...

Android - Saving Objects to List of Object

android,parsing
I am learning how to retrieve data stored in Parse.I am able to retrieve data from parse and bind it to simple ListView. Now I am trying to mock a simple chat app. I have two column in my parse class to store senders name and Chat message. I have...

How to get a sub parameter of JSON

c#,json,parsing
Sorry for the ambiguous title but I don't know how to explain better. Anyway, I made a code for parse a Json in c#, this structure: { "_links": { "self": { "href": "http://api.football-data.org/alpha/soccerseasons/354" }, "teams": { "href": "http://api.football-data.org/alpha/soccerseasons/teams" }, "fixtures": { "href": "http://api.football-data.org/alpha/soccerseasons/fixtures" }, "leagueTable": { "href": "http://api.football-data.org/alpha/soccerseasons/leagueTable" } },...

How do I load data from a txt file into variables in my C program?

c,arrays,parsing,file-io,struct
I have a program that has a struct of channels: struct channel { char title[40]; float gain; float offset; }; int main (int argc, char **argv) { struct channel channels[8]; } And a text file called configurationSettings.txt that holds the information needed to fill up 8 channels: Title1 20 30...

pandas parse dates from csv

parsing,datetime,pandas
I am trying to read a csv file which includes dates. The csv looks like this: h1,h2,h3,h4,h5 A,B,C,D,E,20150420 A,B,C,D,E,20150420 A,B,C,D,E,20150420 For reading the csv I use this code: df = pd.read_csv(filen, index_col=None, header=0, parse_dates=[5], date_parser=lambda t:parse(t)) The parse function looks like this: def parse(t): string_ = str(t) try: return datetime.date(int(string_[:4]),...

ElementTree errors, html files will not parse using Python/Sublime

python,html,parsing,sublimetext2
I am trying to parse a few thousand html files and dump the variables into a csv file (excel spreadsheet). I've come up against several roadblocks, but the first one is this: I can not get it to properly parse the file. Below is a brief explanation, the python code...

shift/reduce and reduce/reduce errors in F# using fsyacc and fslex

parsing,f#,dsl,lexer,fsyacc
I'm creating my own external DSL, which I intend to be pretty small and include some basic functionality. When I compile my project, it builds successfully but it shows a lot of shift/reduce and reduce/reduce errors. And most of them are around my binary operators. Here is part of my...

Generic csv parser in java

java,parsing,csv
I have a csv file with headers in order fname,mname,lname and a csv parser to parse this. I am reading the file line by line and splitting by delimitter (",") and according to index i'll get the values 0=fname, 1=mname, 2=lname. Now again if a csv comes with headers in...

fatal error: Array index out of range with Parse.com

ios,xcode,swift,parsing,uisearchcontroller
I have an application with Swift 2 and Parse.com. I added the UISearchController, and when I use it, the application is crash. And it shows an error "fatal error: Array index out of range". There is an error in the string "if var pfFiltered = dataForSearchController?[indexPath.row]" is EXC_BAD_INSTRUCTION when I...

parse complex xml with php [maybe 2 foreach loops]?

php,xml,parsing
<Lineups date="2015-06-11"> <Game start_time="2015-06-11 09:10:00" number="901" revised="false"> <Team number="901" name="San Diego"> <Player name="Wil Myers" position="CF"/> <Player name="Will Venable" position="LF"/> <Player name="Matt Kemp" position="RF"/> <Player name="Yonder Alonso" position="1B"/> <Player name="Derek Norris" position="C"/> <Player name="Cory Spangenberg" position="2B"/> <Player name="Will Middlebrooks" position="3B"/> <Player name="Alexi Amarista"...

Parse “div” which have no name or id , only class atrribute , with htmlClener in android

android,parsing,htmlcleaner
I am trying to parse the HTML webpage which have the div elements with the only class attribute. I need to extract information from it. It is multiple div element with so i need to traverse through DOM. But I can't identify the div element.

How to reformat an int when parsing a csv (Java)

java,parsing,csv
Trying to parse a column for seat capacity. In the csv file i edited the numbers to be in the form 30000 instead of 30,000. When parsing the file I still get the output as being 30, 000. How can i get rid of the space and the comma between...

Golang - using/iterating through JSON parsed map

json,parsing,go
With PHP and Javascript (and Node) parsing JSON is a very trivial operation. From the looks of it Go is rather more complicated. Consider the example below package main import ("encoding/json";"fmt") type fileData struct{ tn string size int } type jMapA map[string] string type jMapB map[string] fileData func parseMapA(){ var...

Node.js - Browserify: Error on parsing tar file

javascript,node.js,parsing,tar,browserify
I'm trying to download a tar file (non-compressed) over HTTP and piping it's response to the tar-stream parser for further processing. This works perfect when executed on the terminal without any errors. For the same thing to be utilized on browser, a bundle.js file is generated using browserify and is...

Jsoup Login aspx Digikey

java,parsing,post,login,jsoup
I have a problem with connect to Digikey.it with jsoup. I need login with my account and use cookies, but when i execute post, do not login. This is my code: String UrlLogin="https://www.digikey.it/classic/RegisteredUser/Login.aspx?ReturnUrl=%2fclassic%2fregistereduser%2fmydigikey.aspx%3fsite%3dit%26lang%3dit&site=it&lang=it"; Connection.Response response = Jsoup.connect(UrlLogin) .method(Connection.Method.GET) .execute(); Document loginPage = response.parse(); response = Jsoup.connect(UrlLogin)...

How to instantiate lexical.Scanner in a JavaTokenParsers class?

scala,parsing,lexical-scanner
I am writing a parser which inherits from JavaTokenParsers in that I have a function as follow: import scala.util.parsing.combinator.lexical._ import scala.util.parsing._ import scala.util.parsing.combinator.RegexParsers; import scala.util.parsing.combinator.syntactical.StdTokenParsers import scala.util.parsing.combinator.token.StdTokens import scala.util.parsing.combinator.lexical.StdLexical import scala.util.parsing.combinator.lexical.Scanners import scala.util.parsing.combinator.lexical.Lexical import...

How do we get text from a file (word-by-word) into a 2D array in PHP?

php,arrays,parsing,file-handling
I have a text file with some stuff that I would like to put into a 2D array. That text file comprises of sentences of equal length. How do I put each word into an array? Example of text file is - This is stackoverflow I am user This file...

parsing jade forms with node.js

javascript,node.js,forms,parsing,jade
I'm not sure how to go about getting a user selected item from a dropdown list. My jade code is pretty short: extends layout block content p This is the CSV page p <select> <option value="domain">Domain</option> <option value="test">Test</option> <option value="random">Random</option> <option value="databases">Databases</option> </select> form(action="/csvuploader", method="post", enctype="multipart/form-data") label(for="payload") Select a file...

jquery get elements by class name

html,arrays,parsing,getelementsbyclassname
I'm using Jquery to get a list of elements having a class "x". html: <p class="x">Some content</p> <p class="x">Some content#2</p> If we use Jquery to get both these html elements and do something with it- we use something like: $(".x").text("changed text"); This will change the text of both the paragraphs....

Find element by class name

python,parsing,selenium,selenium-webdriver,css-selectors
I'm trying to find one tag using we.find_element_by_css_selector('p.p1.transfer strong.ng-binding').text The problem is that there is sometimes a 'strong' tag before the tag I'm searching for which is very similar but it's class is: class="ng-binding ng-hide" instead of class="ng-binding". But when I try to find it it finds the first tag....

Reading JSON file from dropbox iOS

ios,json,parsing,dropbox
I have a scenario where app reads file from server (dropbox) and checks version. If new version is available then download the app. I'm trying to read file from link but getting null after JSON parsing. NSError *error; NSString *strFileContent = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://www.dropbox.com/s/22mm417fxdqdn8c/FileStructure.txt?dl=0"] encoding:NSUTF8StringEncoding error:&error]; if(!error) { //Handle error...

JSON parse will not execute with JavaScript

javascript,json,list,parsing
This is my current code, any help would be greatly appreciated. I need to call my listApp.json file and parse it. I want to display my list which currently has one link. I'm new to this. <script type = "text/javascript"> // If the .js files are linked correctly, we should...

improve the exception handling vb.net

vb.net,parsing,error-handling
Sooo... guys, I have a small trouble with the performance of the exception handling. I'm building... aaaaa... soooo...hmmm...a graph db? yeah something like this... with vb.net. I'm building the parser, for handling the basic functions of the db(?) What happen? The user makes a research, the program tab them, and...

Converting a Distance string into a Number

javascript,parsing
When using the Google API for calculating the distance between two location, it returns me the distance in string format. For example: 1,585 KM, 54 KM etc. I want it to be converted to a number. What is the best way to convert a string like 1,525 KM into a...

Exception Value: list indices must be integers, not str

python,json,parsing
I'm trying to work on a JSON file that I get from an API. But when I try to access it's info once I converted it with json.loads(). I get the following error: Exception Value: list indices must be integers, not str the python code : response = requests.get(url, params=params)...

How to hide API keys in GitHub for iOS (SWIFT) projects?

ios,swift,api,parsing,apple-watch
Hello I'm trying to publish a iOS (SWIFT) personal project in GitHub but I'm afraid of sharing my private API keys and secrets with everybody. I'm using parse so I have in my AppDelegate something like this: let applicationId = "mySecretApplicationId" let clientKey = "mySecretClientKey" Parse.setApplicationId(applicationId!, clientKey: clientKey!) I would...

how to parse this in android with json

java,android,json,parsing
I want to parse this json in android. Can you help me how to parse, if i need to start from head to parse or from results for this I don't know. Can you help me { "head": { "link": [], "vars": ["city", "country"] }, "results": { "distinct": false, "ordered":...

Python - Deleting the first 2 lines of a string

python,string,file,parsing,lines
I've searched many threads here on removing the first two lines of a string but I can't seem to get it to work with every solution I've tried. Here is what my string looks like: version 1.00 6992 [-4.32063, -9.1198, -106.59][0.00064, 0.99993, -0.01210][etc...] I want to remove the first two...

So I'm tring to get a date as a string at the command line and convert it into milliseconds but it keeps adding five hours. Any ideas why?

java,parsing,date,simpledateformat
This code works but when it converts the input into milliseconds it adds five hours. Is there a fix for this? ArrayList<String> timeList = new ArrayList<String>(); Scanner in = new Scanner(System.in); System.out.println("Please enter time you arrived (HH:mm:ss): "); timeList.add(in.next()); SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); String arriveTime = timeList.get(0); try{ Date...

passing value down the pipe in Scala parser combinator

scala,parsing
I have the following rules (many others obmitted for clarity): def bindRg: Parser[Cmd] = "bind-roaming-group" ~> name ~ bindRgBody(????) <~ exit ^^ { case name~body => new BindRoamingGroupCmd(name, body)} def bindRgBody(name: String) = // ... def name: Parser[String] = """\S+""".r I want to pass the string value of "name" into...

How to get xml attribute and values using JAXB

xml,parsing,jaxb
I am new in Jaxb i have one xml file which contain many attribute so i want the attribute with value My XMl <message_mapping> <message Rtype="DIAGNOSTIC" direction="2" name="Diagnostic" mode=""> <field tag="USERNAME" source="I" tranData="username" required="false" dataType="string" defaultValue="" /> <field tag="PASSWORD" source="I" tranData="password" required="true" dataType="string" defaultValue="" /> <field tag="LOCALDATETIME" source="E" tranData="trxDateTime" required="true"...

Algorithm to add implied parentheses in boolean expression

string,algorithm,parsing
I have a string such as "A and B or not C and D". The atoms are all simple uppercase letters A,B,C... and the operators are only { and, or, not }. I would like to devise an algorithm that can add parentheses that are implied by the usual rules...

How to write a Scala parser for paths?

scala,parsing,path
I am a beginner in scala writing a scala parser in which I need to parse a path like this (suppose x is an integer): /hfds://xxx.xxx.xx.xxx:xxxx/path1/path2/filename1.jpg I tried the following not sure if I am on the right track: def pathIdent: Parser[String] = ("/hdfs""+"""(\d+~\.\d*)"""+ ~("""(u[a-zA-Z0-9])*+"""+"\.[\\'"jpg]"").r I know it has errors!...

How to Parse LaTex file

python,regex,parsing,python-3.x,latex
I just finished to write the summary for calculus in Latex. The main problem now is that the files contains many things I don't really need now. The .tex files contains many definitions and theorems that i need to study by heart. The definitions have their own definition in the...

Faster bash writing to file

bash,parsing,read-write
I'm reading a file in bash, taking the values out and saving them to another file. The file has ~100k lines in it, and it takes around 25minutes to read and rewrite them all. Is there maybe some faster way to write to a file, because now I'm just iterating...

How to separate text from twitter streaming JSON responses and run analysis on text with python?

json,parsing,tweepy,sentiment-analysis,twitter-streaming-api
I am trying to use the twitter API to run sentiment analysis on the text. I am running into the issue that I am not understanding the way to separate the text from each tweet and running the sentiment polarity analysis provided in the TextBlob library. Further more I would...

Need to parse live json file using Socket io

json,node.js,parsing,socket.io
First a Heads Up! I am very new to the world of node.js and socket.io I have a json file which contains following data for example:- { "football": { "id": 1, "home": "Liverpool", "away": "Chelsea", "score": "1-0", "last scorer":"Gerrard" } } This file is updated live on few seconds basis....

How to make xml to csv parsing/conversion faster?

c#,xml,parsing,csv
I'm currently using the snippet below to convert xml data(not well formed) to .CSV format after doing some processing in between. It only converts those elements in the xml data that contain a integer from the list testList (List<int> testList). It only converts and writes to the file once that...

get element by id and get element by Value xpath in php

php,xml,parsing,domxpath,xpathquery
XML file <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ew-language id="en"> <global> <phrase id="actiondeleted" value="Deleted"> <child_phrase_1 id="1234" value="numbers"> <child id="test_id" value="test_value"/> <child id="test_id" value="test_value_2"/> </child_phrase_1> </phrase> </global> </ew-language> how to get element by ID and by value so the element is unique.I tried these $parent = ($xpath->query("//*[@id='$previous_tag_id']")&&...

what's wrong with my php syntax? [closed]

php,html,arrays,parsing
I'm trying to display products on my page I was hoping to store products and their attributes in a 2d array then include them on the page and display them. This way I could add products just by editing the 2d array. here's my catalog.php <?php $varProduct = array (...

parsing JSON files in python to get specific values

python,json,parsing,data
I'm trying to simply grab information from a json file using python. I've seen many threads that briefly cover this, however there are some questions that I have that I have not seen answered on here. Let's say I have the following json file: { "href" : "http://www.google.com", "Hosts" :...

Parse text from a .txt file using csv module

python,python-2.7,parsing,csv
I have an email that comes in everyday and the format of the email is always the same except some of the data is different. I wrote a VBA Macro that exports the email to a text file. Now that it is a text file I want to parse the...

How to parse user search string for Postgresql query?

php,postgresql,parsing,full-text-search,logical-operators
i created a search engine on my site using full text search in Postegresql. i added a searchbox in my PHP page in which users can write strings like these: word1 +word2 word1+word2 word1 -word2 word1-word2 word1 word2 word1 word2 how to convert them to the following strings? word1&word2 word1&word2...

Whats the simplest way when writing & reading a 2D-boolean-Array to a CSV File?

java,arrays,parsing,csv
I'd like to write a 2-Dimensional boolean-Array to a CSV file. Im using Apache Commons' CSVParser. The Problem is that I couldnt find a built-in way to turn the Array into something that can be written into an CSV-File and then later converted back. So is there a way apart...

How can I split a string containing multiple js statements into an array of strings each string containing one statement?

javascript,parsing
I have a string containing a number of JavaScript statements separated by ";". I need to split this into an array of strings with each string containing an individual command. I cannot simply use the string splitting function with ";" as the delimiter because ";" also exist in the other...

FParsec parses only first half

parsing,f#,dsl,fparsec
In my AST, I have something like this: type Program = Declaration list and Declaration = | TypedefDeclaration of TypedefDeclaration and TypedefDeclaration = | Typedef1 of Name * TypeName | Typedef2 of Name * Name For parsing both of the statements, I have used something like this: let tdefpartial =...

Parsing CSV in Python 101

python,parsing,csv
I'm trying to understand/visualise the process of parsing a raw csv data file in Python from dataquest.io's training course. I understand that rows = data.split('\n') splits the long string of csv file into rows based on where the line break is. ie: day1, sunny, \n day2, rain \n becomes day1,...

PHP: How to update values of variables in a string? (inline variable parsing updates)

php,string,parsing
Is there a simple way to update the values of variables that are already present in strings (without using eval or replace functions) with the {$var} syntax? In this example: $id_a=1; $id_b = 2; echo $str = "The id {$id_a} is related to id {$id_b}\n"; // operations go in here...

Parse RSS with groovy

parsing,groovy,rss,xmlslurper
I am trying to parse RSS feeds with groovy. I just wanted to extract the title and description tags' value. I used following code snippet to achieve this: rss = new XmlSlurper().parse(url) rss.channel.item.each { titleList.add(it.title) descriptionList.add(it.description) } After this, I am accessing these values in my JSP page. What is...

JSON parsing not working javascript [closed]

javascript,json,parsing,sanity-check
I'm getting insane with some issue, and i do not know how to fix it. I'm trying to parse a simple json string and to update contents from my site with it. var json = [{"OID:":"1b383180186940dc0cc2a781fcf013ce", "NUMBER":"029348203984","SETTINGS":"Default","LATEST":"09-06-2015"}]; var obj=json[0]; console.log(obj['OID']); console.log(obj['NUMBER']); This results in: Undifined 029348203984 So reading out the...

No module named ijson [closed]

python,json,parsing,tweets
I have a big json file of tweets(around 5GB). I am having memory error. So, I decided to parse the data. I found ijson package. I am having such an error: import ijson parser = ijson.parse(tweets_data_path ) tweets_data = [] f = open(tweets_data_path, "r") objects = ijson.items(f, 'other_config.item') for line...

Parsing XML in PHP with SimpleXML

php,xml,parsing
I am trying to parse the below XML , i have tryed loads of different solutions, i have provided an example of what i have tryed. I have read the SimpleXML documents and i still cant get this right. In the Example below all im trying to do is Echo...

String parsing with batch scripting

windows,string,parsing,batch-file,xml-parsing
I have a file called pictures.xml and it contains some pictures information like: <ResourcePicture Name="a.jpg"> <GeneratedPicture Name="b.jpg"/> <GeneratedPicture Name="c.jpg"/> </ResourcePicture> <ResourcePicture Name="z1.jpg"> <GeneratedPicture Name="z2.jpg"/> <GeneratedPicture Name="z3.jpg"/> <GeneratedPicture Name="z4.jpg"/> </ResourcePicture> What I want do do is to get each line in for loop and print the names of the pictures. Sample...

parsing into std::vector with Spirit Qi, getting segfaults or assert failures

c++,parsing,boost,boost-spirit,boost-spirit-qi
I am using Spirit Qi as my parser, to parse mathematical expressions into an expression tree. I keep track of such things as the types of the symbols which are encountered as I parse, and which must be declared in the text I am parsing. Namely, I am parsing Bertini...

How can stop rss parser after fixed numbers of items?

ios,objective-c,parsing,rss
I have one rss parser and i want stop him after a fixed number of items, like 5 or 10. I can put a condition for didn't add more objects in arrat, but parser still continues working and taking memory. Can someone help me? Thank you! - (void)parseXMLFileAtURL:(NSString *)URL {...

Custom Converter for Retrofit

android,json,parsing,gson,retrofit
I am trying to use a custom converter for Retrofit RestAdapter.Builder builder = new RestAdapter.Builder() .setEndpoint(BuildConfig.BASE_SERVER_ENDPOINT) .setClient(new OkClient(client)).setConverter(new CitationResponseConverter()) .setLogLevel(RestAdapter.LogLevel.FULL); below is my custom converter public class CitationResponseConverter implements Converter { @Override public Object fromBody(TypedInput typedInput, Type type) throws ConversionException { try { InputStream in = typedInput.in(); // convert the...

Python parse string with regex for constitute a dictionary

python,regex,parsing
I need extract the following string in Python to constitute a dictionary: 2014:02:02-12:24:17 NAMETEST ulogd[4834]: id="xxxx" severity="xxxx" sys="xxxx" sub="xxxx" name="xxxx aaaa" action="xxxx" fwrule="xxxx" outitf="xxxx" srcmac="xxxx" srcip="xxxx" dstip="xxxx" proto="x" length="xxxx" tos="xxxx" prec="xxxx" ttl="xx" srcport="xxxx" dstport="xxxx" tcpflags="xxxx" I do not use split(' ') with space, because for example, the field name="xxxx aaaa"...

DateTime.Parse ignoring my IFormatProvider?

c#,.net,parsing,datetime
It looks to me like .NET is ignoring the TwoDigitYearMax property of the CultureInfo (IFormatProvider) I pass for parsing? Specifically, I cannot explain why the last line of this says 1930, and not 2030. Can anyone reproduce or explain it? Windows 7, .NET 4.0, en-US system settings. using System; using...

how to use Query.limit and Query.skip?

ios,swift,uitableview,parsing,tableview
I've spent about 13hrs/day for the past week but I can't seem to figure it out. I've scrolled to the ends of the web but I can't seem to implement 'query.skip' and 'query.limit' to my table correctly. The 'user' is following people and each person has a lot of posts....

Parsing two different formats of dates in data frame

python,parsing,datetime,pandas,dataframes
I have a column having 2 different formats of the date which I'm trying to convert to datetime using to_datetime of pandas Here's the code import pandas as pa pa.to_datetime(data["servertime"], format="%a %b %d %H:%M:%S %Y") e.g - servertime Tue Nov 4 12:01:15 2014 But few rows have data in following...

Get youtube title from videoid in PHP using API v3

php,parsing,youtube,youtube-api,youtube-data-api
Here is the url to to get the video info where you have to put VIDEO-ID and API-KEY: https://www.googleapis.com/youtube/v3/videos?part=snippet&id=VIDEO-ID-HERE&key=YOUR-API-KEY-HERE How to get the title from it and save it as a variable in PHP?...

Extracting strings from HTML with Python wont work with regex or BeautifulSoup

python,regex,parsing,beautifulsoup,python-requests
Im using Python 2.7, BeautifulSoup4, regex, and requests on windows 7. I've scraped some code from a website and I am having problems parsing and extracting the bits I want and storing them in a dictionary. What I'm after is text that is presented as follows in the code: @CAD_DTA\">I...

Parsing Json into a dynamic c# object with a dynamic key

c#,json,parsing,google-calendar
I'm trying to parse this Google calendar response I'm getting from their Rest API using c#, but I seem to keep getting stuck. [edited] Update, the @ symbol isn't preventing the drill down, I verified by replacing the @ with _at_. See the screenshot of the Quick watch: I'm sure...

Removing line breaks from XML data before converting to CSV

c#,xml,wpf,parsing,csv
So I'm currently using the following snippet in a C# WPF application to convert some XML data to CSV. string text = File.ReadAllText(file); text = "<Root>" + text + "</Root>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(text); StreamWriter write = new StreamWriter(FILENAME1); XmlNodeList rows = doc.GetElementsByTagName("XML"); foreach (XmlNode row in rows)...

XML file parsing - Get data from a child of a child

python,xml,parsing,python-3.x
I know how to get data from a child tag but I would like to get data from a child tag of a child tag of the "root" tag. We can use this database for example : <DB> <Entry> <Name></Name> <DisplayName>Assembly.iam</DisplayName> <Scalar> <Name>d0</Name> <DisplayName>d0 (value = 0 mm)</DisplayName> <Value>0</Value> </Scalar>...

Issues parsing a 1GB json file using JSON.NET

json,parsing,stream,json.net,large-object-heap
I have gotten an application where the input has been scaled up from 50K location records to 1.1 Million location records. This has caused serious issues as the entire file was previously de-serialized into a single object. The size of the object is ~1GB for a production like file with...

How to parse table of numbers in C++

c++,parsing,table,numbers
I need to parse a table of numbers formatted as ascii text. There are 36 space delimited signed integers per line of text and about 3000 lines in the file. The input file is generated by me in Matlab so I could modify the format. On the other hand, I...

PHP - Parse Facebook Post JSON

php,json,parsing,facebook-graph-api
I am really struggling with parsing JSON data from Facebook's Graph API. I am using file_get_contents and json_decode to decode the object $json = file_get_contents($facebook_url); $obj = json_decode($json, true); Here is some sample JSON: { "data": [ { "place": { "id": "134972803193847", "name": "University of Southern California", "location": { "city":...

Regular Expression to remove everything but characters and numbers between Square brackets

java,regex,parsing
I used value.replaceAll("[^\\w](?=[^\\[]*\\])", ""); if works fine if in the following case [a+b+c1 &$&$/]+(1+b&+c&) produces: [abc1]+(1+b&+c&) but in case of following string it only removes the square brackets within square brackets in the first run [a+b+c1 &$&$/[]]+(1+b&+c&) produces: [a+b+c1 &$&$/]+(1+b&+c&) ...

save parsed JSON as obj

javascript,jquery,json,parsing
first question ever, I'm trying to parse a JSON file stored within the same file directory on my webhost as my html file that runs the javascript to parse it, I've added a console.log to debug and confrim that the file is being caught by the 'get' to ensure that...

Parse JSON on PHP and extract the particular value(s)

php,mysql,json,parsing,logic
Objective: To parse following json string and get mentioned values separately, later those separated values are going to be inserted to mysql database. I have checked my json string on JsonLint user_name, selected_date, selected_project, tasks , 4.1.task_name, 4.2 work_hours { "user_name": "USER", "selected_date": "2015-06-08", "selected_project": "Project1", "tasks": [ { "task_name":...

Problems in parsing

bash,parsing
I dont know much about bash. I want to do command line parsing. The following is for ex a ping result. I just want to parse some part from the statistcs. lets say just just rtt min. How to do that? If some one can give me a link to...

Fetch url-data attribute using simple html dom

php,html,arrays,parsing,dom
My concern is to extract links from a div using php html dom library. code exemple : include("simple_html_dom.php"); $html=' <div id="base" url-data="http://www.domaine.com/page?user=username"></div> <div id="base" url-data="http://www.domaine.info/page?user=username"></div> <div id="base" url-data="http://www.domaine.org/page?user=username"></div> <div id="base" url-data="http://www.domaine.net/page?user=username"></div> <div id="base"...

Selenium - get all children divs but not grandchildren

python,html,parsing,selenium,selenium-webdriver
I'm trying to parse a html file. There are many nested divs in this html. I want to get all child divs, but not grandchildren etc. Here is a pattern: <div class='main_div'> <div class='child_1'> <div class='grandchild_1'></div> </div> <div class='child_2'> ... ... </div> So the command I'm looking for would return...

How to parse output of external command in Julia?

parsing,julia-lang
Let us say that I have an external command called "Busca01.x" which returns three integers separated by tabs, like this: [email protected]: Busca01.x 192 891 9029 So, I can call this from julia and store the result as a string using either readall or readchomp. I need the data as an...

Use DateTime format in a class but restrict time tokens

c#,parsing,datetime,formatting
I have a peculiar problem I want to solve. I have written a MonthYear class which essentially maintains a DateTime object behind the scenes and only allows methods/properties for month and year portion of the DateTime. Everything is working fine. Now I have another requirement. I want to allow anyone...

Validate double number in current culture

c#,parsing,double,cultureinfo,currentculture
There is a way to validate a double number in the current culture? I have tried this: var number ="10,10"; double value = double.Parse(number, NumberStyles.Float, CultureInfo.CurrentCulture); If I try this with "es-ES" (where decimal separator is ",") then the parsing works perfect, I got an double 10.10, but if I...

How to write an Scala parser for arithmetic operations including string?

scala,parsing,arithmetic-expressions
I am trying to use Scala Combinator-Parsing to parse and arithmetic operation in which at least one of the variables is string. I am a beginner in scala and I like this feature of it! For instance I wanna parse: (number + 2) * 4 It has a good example...

find common string in two text files using batch script

string,parsing,batch-file,search,replace
I'm trying to find common string in two text files. For example, first text file contains following 1.txt //documents #5 ##text //documents/A #6 //documents/B #7 second text file contains following: 2.txt //documents/A #3 output.txt //documents/A #6 If common string found, expected output last number taken from 1.txt file. try.cmd @echo...

How to translate parts of source program to library calls without writing a full parser?

c,parsing,translation
To give an example: Say I have a very simple library that allows C code to be called from another language L. In order to use your C code from L you need to change certain constructs in your C code such as changing function types to void, replacing function...

How to parse Selenium driver elements?

python,parsing,selenium,selenium-webdriver,web-scraping
I'm new in Selenium with Python. I'm trying to scrape some data but I can't figure out how to parse outputs from commands like this: driver.find_elements_by_css_selector("div.flightbox") I was trying to google some tutorial but I've found nothing for Python. Could you give me a hint?...

Parsing with MPC library in C returns only first number

c,parsing,rpn
I'm attempting to write a Reverse Polish Notation parser with the MPC (Micro Parser Combinator) library for C. However, either a problem with the grammar I'm using or another problem elsewhere means that it only outputs the first number rather than the full AST. The grammar: mpc_parser_t* Number = mpc_new("number");...

Getting error in JSON parsing with array in iOS

ios,json,parsing,nsjsonserialization
I am newly to iPhone, basically in my application I am parsing below JSON model and need to save it in my custom Entity class. JSON model : { "Products": [ { "Pcs": [ { "product_id": 2, "product_name": "MyProduct", "category": { "Clamshells": [ { "product_category_id": 11, "product_category_name": "MyProductCategory", "Sub_category": [...

Parse.Cloud.httpRequest not returning response

parsing,parse.com,cloud-code
I am trying to make a Parse.Cloud.httpRequest call, the job executes successfully but i am not getting any response. If i run the request on a RestClient it executes fine but for some reason it's not working in Parse Cloud Code. What am i doing wrong? Parse.Cloud.job("Loader", function(request, status) {...

JSON parsing using .NET deserialize() with nested “list”

javascript,c#,json,parsing,serialization
EDIT: Simplified the classes { "name": "Final Five", "bio": null, "noPlayers": "0", "roster": { "players0": { "playerId": "3516", "name": "Gate", "role": "Mid Lane", "isStarter": 1 }, "players1": { "playerId": "3826", "name": "Veritas", "role": "AD Carry", "isStarter": 1 }, "players2": { "playerId": "4054", "name": "Novel", "role": "Support", "isStarter": 1 }, "players3":...

printing invalid input from string in Java

java,string,parsing
I am trying to print the invalid number, number which is not of type int or double but not getting desired output, please help me pointing out my mistake and another thing is it is possible to to find out invalid number using some other way? public class Test {...

Python import XML intro SQLITE (xmltodict)

python,xml,sqlite,parsing,xmltodict
I'm trying to parse an XML file and import it into an SQLITE database. the XML looks like this: <resultset> <row> <column name="pct_lucru">unit name</column> <column name="cod_comercial">00032749</column> <column name="denumire_med">stuff name</column> <column name="producator">fabri</column> <column name="tip_produs">koops</column> <column name="tva">24.000000</column> <column name="umc">1</column> <column name="furnizor">FURNIZORI...

How to merge two different paths in a XML file?

python,xml,parsing,xml-parsing,lxml
This is my xml file: <File> <Paths> <Path> <Node> <NodeName>Initial_Node</NodeName> <InnerNode> <Signal>Test_sig</Signal> <InnerNode> <Signal>Test_sig_1</Signal> <NodeRef>Ref0</NodeRef> </InnerNode> </InnerNode> </Node> </Path> <Path> <Node> <NodeName>Name1</NodeName> <InnerNode> <Signal>Test_sig_0</Signal> <InnerNode> <Signal>Test_sig_2</Signal>...

Jackson CSV missing columns

java,parsing,csv,jackson
I'm using Jackson CSV to parse a CSV file into POJOs. My issue is that if a row in the CSV has too few columns, the parser doesn't complain and just sets the rest of the fields to null. Parsing code: CsvMapper csvMapper = new CsvMapper(); csvMapper.addMixInAnnotations(Person.class, PersonCsvMixin.class); CsvSchema schema...

Add new property based on a different objects property

arrays,regex,parsing,powershell
I'm trying to search through one column in each row of the table. I would then like to add another value to the row based on the number being search. This code produces the table: $LUNSSummary = ($NY_LUNS) -split '\s+(?=LOGICAL UNIT NUMBER)' | foreach { $Stringdata = $_.replace(':','=') New-Object PSObject...

Lazy parsing with Stanford CoreNLP to get sentiment only of specific sentences

java,performance,parsing,stanford-nlp,sentiment-analysis
I am looking for ways to optimize the performance of my Stanford CoreNLP sentiment pipeline. As a result, a want to get sentiment of sentences but only those which contain specific keywords given as an input. I have tried two approaches: Approach 1: StanfordCoreNLP pipeline annotating entire text with sentiment...

Create XSD based on root element

java,xml,parsing,xsd
I have a XSD as shown below , i need to extract all the root Elements in the XSD and create a separate XSD for each root element pragmatically in java, is there some framework of java library that can aid me in achieving this. <?xml version='1.0' encoding='windows-1252'?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"...

How to define a Regex in StandardTokenParsers to identify path?

regex,scala,parsing,lexical-analysis
I am writing a parser in which I want to parse arithmetic expressions like: /hdfs://xxx.xx.xx.x:xxxx/path1/file1.jpg+1 I want to parse it change the infix to postfix and do the calculation. I used helps from a part of code in another discussion as well. class InfixToPostfix extends StandardTokenParsers { import lexical._ def...

Text File Reading and Structuring data

python,parsing
Text File • I.D.: AN000015544 DESCRIPTION: 6 1/2 DIGIT DIGITAL MULTIMETER MANUFACTURER: HEWLETT-PACKARDMODEL NUM.: 34401A CALIBRATION - DUE DATE:6/1/2016 SERIAL NUMBER: MY45027398 • I.D.: AN000016955 DESCRIPTION: TEMPERATURE CALIBRATOR MANUFACTURER: FLUKE MODEL NUM.: 724 CALIBRATION - DUE DATE:6/1/2016 SERIAL NUMBER: 1189063 • I.D.: AN000017259 DESCRIPTION: TRUE RMS MULTIMETER MANUFACTURER: AGILENT MODEL...

Parsing android resources from xml

java,android,xml,parsing,xml-parsing
I am facing some problems with parsing a XML-file for my Android App. I need some layout ids and color ids from my XML file. I have no problems in reading string values but I dont know how to convert the XML layout reference to a layout id? Thanks for...

Grammar: Precedence of grammar alternatives

parsing,antlr,grammar,context-free-grammar
This is a very basic question about grammar alternatives. If you have the following alternative: Myalternative: 'a' | .; Myalternative2: 'a' | 'b'; Would 'a' have higher priority over the '.' and over 'b'? I understand that this may also depend on the behaviour of the parser generated by this...