Hello,
Can anyone tell me how to parse a local xml file stored in the system using SAX ,with an example code.please also tell me where can i find information on that
"8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9,"
I'm doing a programming challenge where i need to parse this sequence into my sudoku script.
Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8.........
I tried re but without success, help is appreciated, thanks.
Hi I'm trying to run a WordPress plugin and I get the following error:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /nfs/c03/h05/mnt/52704/domains/creathive.net/html/wp-content/plugins/qr-code-tag/lib/qrct/QrctWp.php on line 13
What would be the problem here? Line 13 is the public bit
EDIT: Here is some code:
class QrctWp
{
public $pluginName = 'QR Code Tag';
Hey guys, I have the following HTML structure that I am trying to pull information from:
// Product 1
<div class="productName">
<span id="product-name-1">Product Name 1</span>
</div>
<div class="productDetail">
<span class="warehouse">Warehouse 1, ACT</span>
<span class="quantityInStock">25</span>
</div>
// Product 2
<div class="productName">
<span id="product-name-2">Product Name 2</span>
</div>
<div class="productDetail">
<span class="warehouse">Warehouse 2, ACT</span>
<span class="quantityInStock">25</span>
</div>
…
// Product X
<div class="productName">
<span id="product-name-X">Product Name X</span>
</div>
<div class="productDetail">
<span class="warehouse">Warehouse X, ACT</span>
<span class="quantityInStock">25</span>
</div>
I don't have control of the source html and as you'll see productName and it's accompanying productDetail are not contained within a common element.
Now, I am using the following php code to try and parse the page.
$html = new DOMDocument();
$html->loadHtmlFile('product_test.html');
$xPath = new DOMXPath($html);
$domQuery = '//div[@class="productName"]|//div[@class="productDetail"]';
$entries = $xPath->query($domQuery);
foreach ($entries as $entry) {
echo "Detail: " . $entry->nodeValue) . "<br />\n";
}
Which prints the following:
Detail: Product Name 1
Detail: Warehouse 1, ACT
Detail: 25
Detail: Product Name 2
Detail: Warehouse 2, ACT
Detail: 25
Detail: Product Name X
Detail: Warehouse X, ACT
Detail: 25
Now, this is close to what I want. But I need to do some processing on each Product, Warehouse and Quantity stock and can't figure out how to parse it out into separate product groups. The final output I am after is something like:
Product 1:
Name: Product Name 1
Warehouse: Warehouse 1, ACT
Stock: 25
Product 2:
Name: Product Name 2
Warehouse: Warehouse 2, ACT
Stock: 25
I can't just figure it out, and I can't wrap my head around this DOM stuff as the elements don't quite work the same as a standard array.
If anyone can assist, or point me in the right direction I will be ever appreciative.
Hi,
I want to parse google and yandex search results for my little website analyzer utility.
so i should send hundreds requests per minute. What is good practice for this issue?
Is google search api a good way?
I'd like to programatically determine the "publish location" (the location on the server which contains the installation) of the click-once application I'm running. I know that the appref-ms file contains this information and I could parse this file to find it but the application has no idea as to the location of the appref-ms file and I can't seem to find a way of determining this location.
Does anyone have any ideas how I can easily determine the publish location from within my application?
I'd like my Python script to read some data out of a postgresql dump file. The Python will be running on a system without postgresql, and needs to process the data in a dump file.
It looks fairly straightforward to parse the CREATE TABLE calls to find the column names, then the INSERT INTO rows to build the contents. But I'm sure there would be quite a few gotchas in doing this reliably. Does anyone know of a module which will do this?
I would like to split a string using multiple chars to split upon. For example, consider spin text format:
This is a {long|ugly|example} string
I would want to parse this string and split it on the "{", "|", and "}" chars
myString.Split('|','{','}')
Now I have tokens to play with, but what I would like is to retain the info about which char was used to split each piece of the array that is returned.
Any existing code that can do something like this?
How can I cache an XSD schema (residing on disk) to be reused when parsing XMLs in Xerces (C++)?
I would like to load the XSD schema when starting the process, then, whenever I need to parse an XML, to validate it first using this loaded schema.
I want to convert a string like this:
'10/15/2008 10:06:32 PM'
into the equivalent DATETIME value in Sql Server.
In Oracle, I would say this:
TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM')
This question implies that I must parse the string into one of the standard formats, and then convert using one of those codes. That seems ludicrous for such a mundane operation. Is there an easier way?
Which one would you choose? My important attributes are (not in order)
Support & Future enhancements
Community & general knowledge
base (on the Internet)
Comprehensive (i.e proven to
parse a wide range of *.*ml pages)
Performance
Memory Footprint (runtime, not the code-base)
i am using XML as my backend for the application...
LXML is used to parse the xml.
How can i encrypt this xml file to make sure that the data is protected......
thanks in advance.
How can I do the equivalent of the Ruby snippet below using Java?
require 'net/http'
res = Net::HTTP.get_response(URI.parse("http://somewhere.com/isalive")).body
I need to determind when a file has been uploaded via an ftp account so i can parse the data and insert into a db.
I could do this 2 different ways, either set up a schedule or watch the directory for any change. Either option would be fine.
I'm new to the apache /php space so any keywords that i can search upon would be handy.
Thanks.
I need to read a file and send the text from it to a string so I can parse it. However, the program won't know exactly how long the file is so what would I do if I wanted to use fgets, or is there a better alternative?
Note:
char * fgets ( char * str, int num, FILE * stream );
Hi All,
In my project i using LibXml to parse data, when i select a row in first controller i will take to next conttroller where i will get data using libxml if i click on the back button while loading the page i am getting exception. if i click afetr loading is completed it is working fine ca any one help me.
the exception is showing here
(void)connection:(NSURLConnection *)connection
didReceiveData:(NSData *)data {
// Process the downloaded chunk of data.
xmlParseChunk(_xmlParserContext, (const char *)[data bytes], [data length], 0);
}
Thank You
greeting all
i want to use a mail server
where the users send emails to it
and then i parse this emails then do some action
please suggest me what mail server to be used
and where to start
some links,tutorials,guide is very appreciated .
Hello,
I have an ANTLR grammar that can parse and evaluate simple expressions like 1+2*4, etc.
What I would like to do is to evaluate expressions like 2+$a-$b/4 where the $ variables are dynamic variables, that come from an external source and are continuously updated.
Is there any design pattern on how to do this using ANTLR, best practices, etc?
Shall I "substring" the $a with the updated value ($a - 4.34)
A nicer way to do this?
Thx
Hi, what I want to do is have a PHP script run a program and have it retrieve data somehow from it. For instance the program would parse data from a file and return the data for the PHP script to display.
So far I know to call exec("Program.exe"); but would I have to make it create a file with the data then have the PHP script call fopen and get it that way? Is there a better way to do it? Thanks
Hi,
is there any possibility to send from formtastic form value of :string field like
- semantic_form_for :project do |form|
- form.inputs do
= form.input :task_ids, :as => :string
as Array? Currently value of this field is sending as String and i'd like to no parse this string in controller.
Also, could you give me idea - if task with submitted id is not found - what is best way to catch this situation - validation in controller or what?
the model is :
class someModel(db.Model):
name = db.StringProperty()
def name_is_sss(self):
return self.name=='sss'
the view is :
a=someModel()
a.name='sss'
path = os.path.join(os.path.dirname(__file__), os.path.join('templates', 'blog/a.html'))
self.response.out.write(template.render(path, {'a':a}))
and the html is :
{{ a.name_is_sss }}
the page shows :
True
so i want to make it more useful, and like this:
the model:
class someModel(db.Model):
name = db.StringProperty()
def name_is_x(self,x):
return self.name==x
the html is :
{% a.name_is_x 'www'%}
or
{{ a.name_is_x 'www'}}
but the error is :
TemplateSyntaxError: Invalid block tag: 'a.name_is_x'
or
TemplateSyntaxError: Could not parse the remainder: 'www'
so how to make my method running
thanks
I have this xml model.
link text
So I have to add some node (see the text commented) to this file.
How I can do it?
I have writed this partial code but it doesn't work:
xmldoc=minidom.parse(directory)
child = xmldoc.createElement("map")
for node in xmldoc.getElementsByTagName("Environment"):
node.appendChild(child)
Thanks in advance.
This is my test-string:
<img rel="{objectid:498,newobject:1,fileid:338}" width="80" height="60" align="left" src="../../../../files/jpg1/Desert1.jpg" alt="" />
I want to get each of the JSON formed Elements inbetween the rel attribute.
It's working for the first element (objectid).
Here is my ReqEx, which works fine:
(?<=(rel="\{objectid:))\d+(?=[,|\}])
But i want to do somthing like this, which doesn't work:
(?<=(rel="\{.*objectid:))\d+(?=[,|\}])
So i can parse every element of the search string.
I'm using Java-ReqEx
As per the title, I'm trying to parse an XML file containing an xs:duration data type. I'd like to convert that into a Python timedelta object, which I can then use in further calculations.
Is there any built-in way of doing this? If not, what is the best way to achieve this?
has anybody found a library that works well with large spreadsheets?
I've tried apache's POI but it fails miserably working with large files - both reading and writing. It uses massive amounts of memory leaving you needing a supercomputer to parse or create a 20+mb spreadsheet.
Surely there is a more memory efficient way and someone has written it?!