I'm trying to create a PDF file of a web page using iTextSharp.
In order to parse the HTML, I need to use HTMLWorker or HtmlParser.
But none of them "exists" in the namespaces I'm using.
I'm using the following namespaces:
using iTextSharp.text;
using iTextSharp.text.html;
using iTextSharp.text.pdf;
Am I missing something obvious?
Hi this is my code
var cityList = from country in doc.Element("result").Element("cities").Descendants("city")
select new
{
Name = country.Element("name").Value,
Code = country.Element("code").Value,
CountryCode = int.Parse(country.Element("countrycode").Value)
};
foreach(var citee in cityList)
{
City city = new City();
city.CountryID = from cnt in db.Countries where cnt.DOTWInternalID == citee.CountryCode select cnt.ID;
}
Im getting an error on the second query as the title of this post, i tried converting to int, to nullable int nothing worked? help me guys
Thanks,
Hi
I am using this code for an image for mailto: but when subject line is entered
it is showing a big unable to parse javascript or something in joomla.
mailto:[email protected]?subject=hello
Thanks
Hi chaps,
I'm trying to get started with cometd (http://cometd.org/) and jetty 6 or 7, but I seem to be having problems. I've got an ant script that packages my code up into a war with the cometd 1.1.1 binaries and jetty binaries that are appropriate to the version of jetty I deploy the war to (so 7.1.2.v20100523 binaries when I deploy to jetty 7.1.2.v20100523 and 6.1.24 when I deploy to 6.1.24). I first tried getting a setup with version 7.1.2.v20100523, but when I tried to deploy I got a very long stack trace sample of which is:
2010-05-26 15:32:12.906:WARN::Problem processing jar entry org/eclipse/jetty/util/MultiPartOutputStream.class
java.io.IOException: Invalid resource
at org.eclipse.jetty.util.resource.URLResource.getInputStream(URLResource.java:204)
at org.eclipse.jetty.util.resource.JarResource.getInputStream(JarResource.java:113)
at org.eclipse.jetty.annotations.AnnotationParser$2.processEntry(AnnotationParser.java:575)
at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:152)
at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:82)
at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:64)
at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:75)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:587)
at org.eclipse.jetty.annotations.AbstractConfiguration.parseWebInfLib(AbstractConfiguration.java:107)
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:68)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:992)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:579)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:381)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:182)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:497)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:135)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileChanged(ScanningAppProvider.java:77)
at org.eclipse.jetty.util.Scanner.reportChange(Scanner.java:490)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:355)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:258)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
2010-05-26 15:32:12.907:WARN::Problem processing jar entry org/eclipse/jetty/util/MultiPartWriter.class
java.io.IOException: Invalid resource
at org.eclipse.jetty.util.resource.URLResource.getInputStream(URLResource.java:204)
at org.eclipse.jetty.util.resource.JarResource.getInputStream(JarResource.java:113)
at org.eclipse.jetty.annotations.AnnotationParser$2.processEntry(AnnotationParser.java:575)
at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:152)
at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:82)
at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:64)
at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:75)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:587)
at org.eclipse.jetty.annotations.AbstractConfiguration.parseWebInfLib(AbstractConfiguration.java:107)
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:68)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:992)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:579)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:381)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:182)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:497)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:135)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileChanged(ScanningAppProvider.java:77)
at org.eclipse.jetty.util.Scanner.reportChange(Scanner.java:490)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:355)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:258)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
2010-05-26 15:32:12.907:WARN::Problem processing jar entry org/eclipse/jetty/util/Attributes.class
java.io.IOException: Invalid resource
at org.eclipse.jetty.util.resource.URLResource.getInputStream(URLResource.java:204)
at org.eclipse.jetty.util.resource.JarResource.getInputStream(JarResource.java:113)
at org.eclipse.jetty.annotations.AnnotationParser$2.processEntry(AnnotationParser.java:575)
at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:152)
at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:82)
at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:64)
at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:75)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:587)
at org.eclipse.jetty.annotations.AbstractConfiguration.parseWebInfLib(AbstractConfiguration.java:107)
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:68)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:992)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:579)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:381)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:182)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:497)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:135)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileChanged(ScanningAppProvider.java:77)
at org.eclipse.jetty.util.Scanner.reportChange(Scanner.java:490)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:355)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:258)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Seemed to go through all the jetty binaries and complain about each class file.
When I tried to deploy to 6.1.24 I got
org.mortbay.util.MultiException[java.lang.NoClassDefFoundError: org/eclipse/jetty/util/ajax/JSON$Source, java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/ThreadPool]
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:656)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mortbay.start.Main.invokeMain(Main.java:194)
at org.mortbay.start.Main.start(Main.java:534)
at org.mortbay.start.Main.start(Main.java:441)
at org.mortbay.start.Main.main(Main.java:119)
My web.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>cometd</servlet-name>
<servlet-class>org.cometd.server.continuation.ContinuationCometdServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cometd</servlet-name>
<url-pattern>/cometd/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>initializer</servlet-name>
<servlet-class>uk.co.dubit.nexus.comet.BayeuxInitializer</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- <filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping> -->
</web-app>
note cross origin filter is commented out. The class didn't seem to exist when I tried to run on 6.1.24 (which as far as I understand is the correct behaviour, yes?).
Sorry for the noob question but does anyone know what I'm doing wrong here?
Regards,
Tom
Hi friends,
I have a folder structure in my server.
I receive the folder structure in XML format.
My query is :-
1) Can I create the same folder structure in documents folder of my iPhone app.
2) What would be the best approach whether to create folders at device documents folder or just read the XML and show the folders as we parse it(I mean no folder creation).
Waiting for your reply
Hi ,
I spent lot time figuring out a simple regex to return a group (only 1st group).
So the string can be -
"No purchase required" or "Purchase of $50.00 worth groceries is required."
I am trying to write a regex which can parse "No" or "50" based on the given string.
This is what I have written.
(?:(No) monthly maintenance|Purchase of \$([\d\.]+ worth groceries)
This works fine but I want my output as 1st group/group 1 only.
Hi all,
I need to parse html for a project and looking for a good html parser or an API providing conversion from html to xml.
Waiting for suggestions...
Thanks All...
Hello everyone,
I have some legacy classic ASP code (not ASP.Net, but ASP), and I want to call a WCF service which I developed by using VSTS 2008 + C# + .Net 3.5 and using basic Http Binding.
Any reference samples? I heard the only way is -- we have to manually generate the tricky SOAP message, and parse SOAP response, is that true? :-)
thanks in advance,
George
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.
Is there a way to integrate StyleCop in a NAnt script such that the build fails if there are too many style violations?
There doesn't seem to be a NAnt task for StyleCop, but we've found StyleCopCmd. However this only seems to generate an XML file as output that we'd have to parse. Is there some easier solution?
how can i parse a local xml file in the assets folder using pull parser. cant get pull parser to work, always throws io exception. i think i cant get the path to the file, or connecting to the file
help please!
I need to parse out the values from some data from select boxes.
Example: <option value="1">Apple</option><option value="2">Chicken</option>
Usage: If option = apple then get value.
Any suggestions?
I have a cell in a spreadsheet that is a date object in Excel but becomes a double (something like 39820.0 for 1/7/2009) when it comes out of C1's xls class. I read this is a Julian date format. Can someone tell me how to parse it back into a DateTime in C#?
Update: It looks like I might not have a Julian date, but instead the number of days since Dec 30, 1899.
I'm attempting to use deftype (from the bleeding-edge clojure 1.2 branch) to create a java class that implements the java Servlet interface. I would expect the code below to compile (even though it's not very useful).
(ns foo [:import [javax.servlet Servlet ServletRequest ServletResponse]])
(deftype servlet []
javax.servlet.Servlet
(service [this
#^javax.servlet.ServletRequest request
#^javax.servlet.ServletResponse response]
nil))
But it doesn't compile. The compiler produces the message:
Mismatched return type: service, expected: void, had: java.lang.Object
[Thrown class java.lang.IllegalArgumentException]
Which doesn't make sense to me, because I'm returning nil. So the fact that the return type of the method is void shouldn't be a problem. For instance, for the java.util.Set interface:
(deftype bar [#^Number n] java.util.Set (clear [this] nil))
compiles without issue.
So what am I doing wrong with the Servlet interface?
To be clear:
I know that the typical case is to subclass one of the servlet abstract classes rather than implement this interface directly, but it should still be possible to do this.
Stack Trace:
The stack trace for the (deftype servlet... is:
Mismatched return type: service, expected: void, had: java.lang.Object
[Thrown class java.lang.IllegalArgumentException]
Restarts:
0: [ABORT] Return to SLIME's top level.
Backtrace:
0: clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:6461)
1: clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:6119)
2: clojure.lang.Compiler$NewInstanceExpr$DeftypeParser.parse(Compiler.java:6003)
3: clojure.lang.Compiler.analyzeSeq(Compiler.java:5289)
4: clojure.lang.Compiler.analyze(Compiler.java:5110)
5: clojure.lang.Compiler.analyze(Compiler.java:5071)
6: clojure.lang.Compiler.eval(Compiler.java:5347)
7: clojure.lang.Compiler.eval(Compiler.java:5334)
8: clojure.lang.Compiler.eval(Compiler.java:5311)
9: clojure.core$eval__4350.invoke(core.clj:2364)
10: swank.commands.basic$eval_region__673.invoke(basic.clj:40)
11: swank.commands.basic$eval_region__673.invoke(basic.clj:31)
12: swank.commands.basic$eval__686$listener_eval__687.invoke(basic.clj:54)
13: clojure.lang.Var.invoke(Var.java:365)
14: foo$eval__2285.invoke(NO_SOURCE_FILE)
15: clojure.lang.Compiler.eval(Compiler.java:5343)
16: clojure.lang.Compiler.eval(Compiler.java:5311)
17: clojure.core$eval__4350.invoke(core.clj:2364)
18: swank.core$eval_in_emacs_package__320.invoke(core.clj:59)
19: swank.core$eval_for_emacs__383.invoke(core.clj:128)
20: clojure.lang.Var.invoke(Var.java:373)
21: clojure.lang.AFn.applyToHelper(AFn.java:169)
22: clojure.lang.Var.applyTo(Var.java:482)
23: clojure.core$apply__3776.invoke(core.clj:535)
24: swank.core$eval_from_control__322.invoke(core.clj:66)
25: swank.core$eval_loop__324.invoke(core.clj:71)
26: swank.core$spawn_repl_thread__434$fn__464$fn__465.invoke(core.clj:183)
27: clojure.lang.AFn.applyToHelper(AFn.java:159)
28: clojure.lang.AFn.applyTo(AFn.java:151)
29: clojure.core$apply__3776.invoke(core.clj:535)
30: swank.core$spawn_repl_thread__434$fn__464.doInvoke(core.clj:180)
31: clojure.lang.RestFn.invoke(RestFn.java:398)
32: clojure.lang.AFn.run(AFn.java:24)
33: java.lang.Thread.run(Thread.java:637)
Hi guys, the question is: suppose I have an input function like sin(2-cos(3*A/B)^2.5)+0.756*(C*D+3-B) specified with a BNF, I will parse input using recursive descent algorithm, and then how can I use or change Dijkstra’s algorithm to handle this given function? After parsing this input function, I need to execute it with variable inputs, where Dijkstra’s algorithm should do the work. Thanks in advance.
EDIT: May be I should ask also: What is the best practice or data structure to represent given function?
I'm parsing a string of XML into an XDocument that looks like this (using XDocument.Parse)
<Root>
<Item>Here is "Some text"</Item>
</Root>
Then I manipulate the XML a bit, and I want to send it back out as a string, just like it came in
<Root>
<Item>Here is "Some text"</Item>
<NewItem>Another item</NewItem>
</Root>
However, what I am getting is
<Root>
<Item>Here is \"Some text\"</Item>
<NewItem>Another item</NewItem>
</Root>
Notice how the double quotes are now escaped instead of encoded?
This happens whether I use
ToString(SaveOptions.DisableFormatting);
or
var stringWriter = new System.IO.StringWriter();
xDoc.Save(stringWriter, SaveOptions.DisableFormatting);
var newXml = stringWriter.GetStringBuilder().ToString();
How can I have the double quotes come out as " and not \"?
UPDATE: Maybe this can explain it better:
var origXml = "<Root><Item>Here is \"Some text"</Item></Root>";
Console.WriteLine(origXml);
var xmlDoc = System.Xml.Linq.XDocument.Parse(origXml);
var modifiedXml = xmlDoc.ToString(System.Xml.Linq.SaveOptions.DisableFormatting);
Console.WriteLine(modifiedXml);
the output I get from this is:
<Root><Item>Here is "Some text"</Item></Root>
<Root><Item>Here is "Some text"</Item></Root>
I want the output to be:
<Root><Item>Here is "Some text"</Item></Root>
<Root><Item>Here is "Some text"</Item></Root>
I am trying to parse some data to no success. Can anyone recommend a good introduction with a lot of examples to Recursive Descent Parsing? I haven't been able to find any.
I am using logback/slf4j to do my logging. I want to parse my log file to analyze some data, so instead of parsing a great big file (mostly consisting of debug statements) I want to have two logger instances which each log to a separate file; one for analytics and one for all purpose logging. Does anyone know if this is possible with Logback, or any other logger for that matter?
Hi,
In my java application, I need to parse xml that contains control character 0x2 inside CDATA. I tried few ways but coudnt get through. I want to avoid any sort of encoding. Is there any way in XML1.1?
Thanks,
Shefali
I am parsing feeds using feedparser and I am trying to store updated or updated_parsed attributes of feeds in Django db.
But it shows an error as [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.']
Please tell me how to convert updated and updated_parsed such that it can be stored in the Django db such that I can (convert and reuse) or just reuse the date stored in db while parsing in this way:
feedparser.parse("url", modified = lastupdate)
I'm trying to parse a text file into sentences ending in periods, but names like Mr. Hopkins are throwing false alarms on matching for periods.
What regex indentfy's "." but not "Mr."
For bonus, I'm also using ! to find end of sentences, so my current Regex is /(!/./ and I'd love an answer that incorporates my !'s too.
I have two html select server control on an add data form page.
the user selects a value in the first html select server control and then values are populated into the second html select server control with jquery.
The problem is when a a user clicks the save button and the page posts back, the values are no longer in the drop down list populated by jQuery.
The drop downlist is a html server control, shouldn't it retain the values on post-back?
How can I retain the values and save the selected value to the database?
$(document).ready(function() {
$("#<%=ddlCourseWare.ClientID %>").change(function() {
var courseWareId = this.value;
try {
$.ajax({
type: "POST",
url: "Left_SubCategory.aspx/GetTabData",
data: "{courseWareId:" + courseWareId + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
var result = json_parse(data.d);
$("#<%=ddlTabType.ClientID %>")[0].innerHTML = '';
if (result.length > 0) {
$.each(result, function(key, item) {
$("#<%=ddlTabType.ClientID %>").append($("<option></option>").val(item.id).html(item.TabName));
});
}
else {
$("#<%=ddlTabType.ClientID %>").append($("<option></option>").val('0').html('--Select--'));
}
},
error: function(request, status, error) {
alert(request.responseText);
}
});
}
catch (ex) {
alert(ex);
}
});
});
HTML
<select id="ddlCourseWare" name="ddlCourseWare" runat="server" Width="230px" class="TextBox" Height="18px" >
<select id="ddlTabType" name="ddlTabType" runat="server" Width="230px" class="TextBox" Height="18px" onchange="BindMainCat();">
<option>--Select--</option>
</select>
C#
private void BindCourseWare()
{
ddlCourseWare.DataSource = courseWare.GetCourseWare();
ddlCourseWare.DataTextField = "CourseWareType";
ddlCourseWare.DataValueField = "id";
ddlCourseWare.DataBind();
ddlCourseWare.Items.Insert(0, "----Select Course Ware----");
}
[WebMethod]
public static string GetTabData(int courseWareId)
{
var result = new CourseWare().GetCourseTabByCoursewareId(courseWareId);
JavaScriptSerializer json_tabs = new JavaScriptSerializer();
string jsonArray_tabs = json_tabs.Serialize(result);
return jsonArray_tabs;
}
protected void btnSave_Click(object sender, EventArgs e)
{
int mainCategoryID1 = int.Parse(ddlTabType.Value); // not working
int mainCategoryID2 = int.Parse(Request["ctl00$ContentPlaceHolder1$ddlTabType"]);
// working but always return same value means the upper value (selected index 1)
}
Is it possible to define a ListPreference in Xml and retrieve the value from SharedPreferences using getInt? Here is my Xml:
<ListPreference android:key="@string/prefGestureAccuracyKey"
android:title="@string/prefGestureAccuracyTitle" android:summary="@string/prefGestureAccuracyDesc"
android:entries="@array/prefNumberAccuracyLabels" android:entryValues="@array/prefNumberAccuracyValues"
android:dialogTitle="@string/prefGestureAccuracyDialog"
android:persistent="true" android:defaultValue="2"
android:shouldDisableView="false" />
And I want to get the value with something like: int val = sharedPrefs.getInt(key, defaultValue).
At the moment I have to use getString and parse the result.