Search Results

Search found 25798 results on 1032 pages for 'android xml'.

Page 90/1032 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • Parsing XML via jQuery, nested loops

    - by Coughlin
    I am using jQuery to parse XML on my page using $.ajax(). My code block is below and I can get this working to display say each result on the XML file, but I am having trouble because each section can have MORE THAN ONE and im trying to print ALL grades that belong to ONE STUDENT. Here is an example of the XML. <student num="505"> <name gender="male">Al Einstein</name> <course cid="1">60</course> <course cid="2">60</course> <course cid="3">40</course> <course cid="4">55</course> <comments>Lucky if he makes it to lab, hopeless.</comments> </student> Where you see the I am trying to get the results to print the grades for EACH student in each course. Any ideas on what I would do? Thanks, Ryan $.ajax({ type: "GET", url: "final_exam.xml", dataType: "xml", success: function(xml) { var student_list = $('#student-list'); $(xml).find('student').each(function(){ $(xml).find('course').each(function(){ gradeArray = $(this).text(); console.log(gradeArray); }); var name = $(this).find("name").text(); var grade = $(this).find("course").text(); var cid = $(this).find("course").attr("cid"); //console.log(cid); student_list.append("<tr><td>"+name+"</td><td>"+cid+"</td><td>"+grade+"</td></tr>"); }); } });

    Read the article

  • XML::LibXML::XPathContext - Question

    - by sid_com
    This script works with and without XPathContext. Why should I use it with XPathContext? #!/usr/bin/env perl use warnings; use strict; use XML::LibXML; use 5.012; my $parser = XML::LibXML->new; my $doc = $parser->parse_string(<<EOT); <?xml version="1.0"?> <xml> Text im Dokument <element id="myID" name="myname" style="old" /> <object objid="001" objname="Object1" /> <element id="002" name="myname" /> </xml> EOT #/ # without XPathContext my $nodes = $doc->findnodes( '/xml/element[@id=002]' ); # with XPathContext #my $root = $doc->documentElement; #my $xc = XML::LibXML::XPathContext->new( $root ); #my $nodes = $xc->findnodes( '/xml/element[@id=002]' ); for my $node ( $nodes->get_nodelist ) { say "Node: ", $node->nodeName; print "Attribute: "; print $_->getName, '=', $_->getValue, ' ' for $node->attributes; say ""; }

    Read the article

  • Update element values using xml.dom.minidom

    - by amnesia-55
    Hello, I have an XML structure which looks similar to: <Store> <foo> <book> <isbn>123456</isbn> </book> <title>XYZ</title> <checkout>no</checkout> </foo> <bar> <book> <isbn>7890</isbn> </book> <title>XYZ2</title> <checkout>yes</checkout> </bar> </Store> Using xml.dom.minidom only (restrictions) i would like to 1)traverse through the XML file 2)Search/Get for particular element, depending on its parent Example: checkout element for author1, isbn for author2 3)Change/Set that element's value 4)Write the new XML structure to a file Can anyone help here? Thank you! UPDATE: This is what i have done till now import xml.dom.minidom checkout = "yes" def getLoneChild(node, tagname): assert ((node is not None) and (tagname is not None)) elem = node.getElementsByTagName(tagname) if ((elem is None) or (len(elem) != 1)): return None return elem def getLoneLeaf(node, tagname): assert ((node is not None) and (tagname is not None)) elem = node.getElementsByTagName(tagname) if ((elem is None) or (len(elem) != 1)): return None leaf = elem[0].firstChild if (leaf is None): return None return leaf.data def setcheckout(node, tagname): assert ((node is not None) and (tagname is not None)) child = getLoneChild(node, 'foo') Check = getLoneLeaf(child[0],'checkout') Check = tagname return Check doc = xml.dom.minidom.parse('test.xml') root = doc.getElementsByTagName('Store')[0] output = setcheckout(root, checkout) tmp_config = '/tmp/tmp_config.xml' fw = open(tmp_config, 'w') fw.write(doc.toxml()) fw.close()

    Read the article

  • Problem with XML encoding of database contents with Latin characters

    - by user89691
    I have an ASP Access database that contains strings in various European languages. The database was populated prior by agents in the respective countries. It contains entries with accented etc characters as you would expect. If I open the database with MS Access these characters show up fine. For example the the German equivalent of "Open" shows as "Öffnen" (hopefully you can see an "O" with 2 dots above it!). I have ASP code that reads the database and returns records in XML. The text is passed to XMLEncode to construct the XML, but that only seems to deal with the 5 specials like "<", "&", etc. If I dump the XML the accented characters are unchanged. <English>Open</English> <German>Öffnen</German> If I look at the raw packets with Wireshark I see that the "Ö" byte is hex D6, which appears to be it's decimal Unicode and ISO 8859-1 value. The problem starts when I try to parse the XML in client-side JS. I get: "An invalid character was found in text content" from IE. FF and Chrome happily accept the XML without hiccup but the browser shows the "Ö" character as a diamond with a question mark inside. http://www.validome.org/xml/validate/ reports "encoding error." http://www.w3schools.com/dom/dom_validate.asp thinks it is fine. The XML is UTF-8 encoded. What do I need to do to have IE accept my XML without complaint? What do I need to do to have browsers display the stuff correctly?

    Read the article

  • NullPointerException when trying to connect to web service using kSoap method Android

    - by benjamin schultz
    My web service should be returning an integer, but every time i run the code i get the NullPointerException error. Any ideas or help would be very appreciated Here's my code: public class CGCountTest extends Activity { TextView testTV; private static final String NAMESPACE = "http://passport-america.com/webservices/"; private static final String URL = "http://localhost:11746/Service1.asmx"; private static final String SOAP_ACTION = "http://www.passport-america.com/webservices/getCGCount"; private static final String METHOD_NAME = "getCGCount"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.soap_test); SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); java.lang.Integer result = (Integer)envelope.getResponse(); TextView testTV = (TextView)findViewById(R.id.testTV); result.toString(); testTV.setText(result); } catch(Exception e) { testTV.setText(e.getMessage()); } } here's the logcat 06-02 15:13:36.557: WARN/dalvikvm(326): threadid=3: thread exiting with uncaught exception (group=0x4001aa28) 06-02 15:13:36.557: ERROR/AndroidRuntime(326): Uncaught handler: thread main exiting due to uncaught exception 06-02 15:13:36.876: ERROR/AndroidRuntime(326): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pa.passammain/com.pa.passammain.CGCountTest}: java.lang.NullPointerException 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.os.Handler.dispatchMessage(Handler.java:99) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.os.Looper.loop(Looper.java:123) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.app.ActivityThread.main(ActivityThread.java:4203) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at java.lang.reflect.Method.invokeNative(Native Method) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at java.lang.reflect.Method.invoke(Method.java:521) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at dalvik.system.NativeStart.main(Native Method) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): Caused by: java.lang.NullPointerException 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at com.pa.passammain.CGCountTest.onCreate(CGCountTest.java:46) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) 06-02 15:13:36.876: ERROR/AndroidRuntime(326): ... 11 more i think my url string may be the problem, but i've tried using my ip with no luck

    Read the article

  • Writing Russian in XML

    - by zavié
    Hi, I am writing a Xml Tag Renamer class with Java which reads in a XML, renames the tags and write them back into another XML file using DocumentBuilderFactory and TransformerFactory (text nodes are preserved). It worked fine before with German and English texts, until today, when I tried to rename a XML file with russian text. Instead of the source texts I got ????? in the newly created XML file. I've tried setting Encoding Any idea how to correct this? Thanks! PS. Strings were correct before entering TransformerFactory, as I checked in the debugger. I've tried setting OutputKeys.ENCODING to UTF-8 and ISO-8859-5. None of them helped. The Transformer part: // Output the XML // Set up a transformer TransformerFactory transFactory = TransformerFactory.newInstance(); Transformer transformer = transFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); // Fix to a bug about indent in transformer transformer.setOutputProperty ("{http://xml.apache.org/xslt}indent-amount", "4"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); // TODO encoding parameter transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); // Create string from xml tree StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); DOMSource source = new DOMSource(doc); transformer.transform(source, result); String xmlString = sw.toString(); xmlString.replaceAll("\n", System.getProperty("line.separator")); // Write to file BufferedWriter output = new BufferedWriter(new FileWriter(outputPath)); output.write(xmlString); output.close();

    Read the article

  • Flash AS3 load file xml

    - by Elias
    Hello, I'm just trying to load an xml file witch can be anywere in the hdd, this is what I have done to browse it, but later when I'm trying to load the file it would only look in the same path of the swf file here is the code package { import flash.display.Sprite; import flash.events.; import flash.net.; public class cargadorXML extends Sprite { public var cuadro:Sprite = new Sprite(); public var file:FileReference; public var req:URLRequest; public var xml:XML; public var xmlLoader:URLLoader = new URLLoader(); public function cargadorXML() { cuadro.graphics.beginFill(0xFF0000); cuadro.graphics.drawRoundRect(0,0,100,100,10); cuadro.graphics.endFill(); cuadro.addEventListener(MouseEvent.CLICK,browser); addChild(cuadro); } public function browser(e:Event) { file = new FileReference(); file.addEventListener(Event.SELECT,bien); file.browse(); } public function bien(e:Event) { xmlLoader.addEventListener(Event.COMPLETE, loadXML); req=new URLRequest(file.name); xmlLoader.load(req); } public function loadXML(e:Event) { xml=new XML(e.target.data); //xml.name=file.name; trace(xml); } } } when I open a xml file that isnt it the same directory as the swf, it gives me an unfound file error. is there anything I can do? cause for example for mp3 there is an especial class for loading the file, see http://www.flexiblefactory.co.uk/flexible/?p=46 thanks

    Read the article

  • Flex through Flash Builder 4; Connecting to a dynamic XML feed: "The response is not a valid XML or

    - by jtromans
    I am learning how to use Flex with Adobe Flash Builder 4 standalone. I am working my through the Adobe Flash Build 4 Bible by David Gassner. This has led me to create my own micro problems to try and solve. I am trying to connect to a dynamix XML feed created by the following aspx page: generate_xml.aspx When I create the data connection through the Data/Service panel, I can pick between XML and HTTP. I figured because the generate_xml.aspx has to generate the XML file first, I should use the HTTP service as opposed to the XML. The HTTP service offers GET, which seems to be the kinda thing I want. However, I am really struggling to do this. I keep getting: "The response is not a valid XML or a JSON string" The actual STATIC generated XML file that is created by this page works perfectly when I save it and manually connect with the XML service. Therefore I know my XML code is properly formatted and contains no other HTML of JavaScript. I figure my problem occurs because the page itself is .aspx, but I cannot work out how to successfully ask Flex to request the output of this page, rather than the page itself.

    Read the article

  • faster way to change xml to array(grails to flex)

    - by Anthony Umpad
    I have a large xml passed from grails to flex. When flex receives the xml, it converts the xml into an associative array object. Given the large xml file, it takes too long to complete the loop, is there any way in flex to make conversion faster? Below is my sample code. <xml> <car> <model>Vios</model> <type>Sedan</type> <color>Blue</color> </car> <car> <model>Camry</model> <type>Luxury</type> <color>Black</color> </car> </xml> *converted to the flex associative array below.* [Vios].type = Sedan .color = Blue [Camry].type = Luxury .color = Black *Below is a code I used in flex to convert the xml to the associative array object* var tempXML=xml.children() var tempArray:Array= new Array() for(var i:int=0;i<tempXML.length();i++) { tempArray[tempXML[i].@model]= new Object(); tempArray[tempXML[i].@model].color = tempXML[i][email protected](); tempArray[tempXML[i].@model].type = tempXML[i][email protected](); }

    Read the article

  • PHP4: Send XML over HTTPS/POST via cURL?

    - by starmonkey
    I wrote a class/function to send xml over https via PHP4/cURL, just wondering if this is the correct approach, or if there's a better one. Note that PHP5 is not an option at present. /** * Send XML via http(s) post * * curl --header "Content-Type: text/xml" --data "<?xml version="1.0"?>...." http://www.foo.com/ * */ function sendXmlOverPost($url, $xml) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // For xml, change the content-type. curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // ask for results to be returned if(CurlHelper::checkHttpsURL($url)) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); } // Send to remote and return data to caller. $result = curl_exec($ch); curl_close($ch); return $result; } cheers!

    Read the article

  • Why Bluetooth needs DBUS way of communication in android?

    - by Rajesh SO
    I am newbie to Android DBUS, recently I was informed that I need to use DBUS to implement Bluetooth in Android, from DBUS documentation I see DBUS is used for communication medium between two applications. In Android apps -apps communication is through intents, if so why do we need DBUS for Bluetooth ? Is that DBUS serves as communication medium for networking (IP) between two apps since it is built over sockets? Please correct me if my understanding is wrong, any more information on DBUS along with Bluetooth implementation in Android is appreciated. Thanks.

    Read the article

  • Save a form in an XML file using Ajax and JSP

    - by novellino
    Hello, I want to create a simple form with a name and an email and save these data in an XML file. So far I found that using Ajax with jQuery is quite easy. So I used the usual code: //dataString have the values taken from the form var dataString = 'name='+ name + '&email=' + email; $.ajax({ type: "POST", url: "users.xml", data: dataString, dataType: "xml", success: function() { .... } }); If I understood well, in the url I should add the name of the XML file that will be created. When the user clicks a button I call the function with the Ajax request, and then I should call somewhere a function for generating the xml. I am using also two beans. One is for setting the elements of the user and the other is for saving the data in the XML. I am using the XStream library for the xml although I don't know if is the best solution. The problem now it that I can not connect all these together in order to save the data in the XML. Does anyone know what should I do? Thanks a lot!

    Read the article

  • How do i close the alert dialog that displays custom view

    - by Asdfg
    I have an activity named MainActivity which has a button. On click of that button i am displaying an AlertDialog which contains a custom view named ChildWindow.xml. That custom view has multiple textboxes and a OK button. On click of the OK button, i am calling a method of MainActivity. I am able to access the ChildWindow here as view.getRootView().findViewById(R.id.txtFirstName); Once the user clicks on the OK button, i have to close the alert dialog which i am able to do as view.getRootView().setVisibility(View.GONE); My problem is even though i have closed the the ChildWindow in the above statement, i am able to get reference to the textbox in the next line which means AlertDialog is closed but child window is still there. This is how the OK button click looks like: This works as expected: EditText tb = (EditText) view.getRootView().findViewById(R.id.txtFirstName); Toast toast = Toast.makeText(getApplicationContext(), tb.getText(), Toast.LENGTH_LONG); toast.show(); view.getRootView().setVisibility(View.GONE); This should not work as i am closing the alert dialog and then getting the reference of the textbox but this works too. view.getRootView().setVisibility(View.GONE); EditText tb = (EditText) view.getRootView().findViewById(R.id.txtFirstName); Toast toast = Toast.makeText(getApplicationContext(), tb.getText(), Toast.LENGTH_LONG); toast.show(); I think i am closing the alert dialog but i am not destroying it from the memory. Can someone point me out what am i missing here?

    Read the article

  • LINQ to XML contents of child records.

    - by Fossaw
    I have this LINQ to XML enquiry... var Records = from Item in XDoc.Root.Elements("Item") where (string)Item.Element("ItemNumber") == item.ID.ToString select Item; ... where ItemNumber is a reference number used in the XML, (originally written by this program but manually edited by "others"), and item.ID is the database version of the same thing. The query executes, and I can test for the number of entries in the result fine... if (Records.Count() < 1) ... you get the idea. I have established that there is only one record. Each Item has several child fields. I want to test the values of the child fields are reasonable before passing them on to the database update sub-system. The XML is produced by the program, but edited by users, so I need to really check what is coming back. So I tried... if (DB_English.ToString() != Records.Elements("English").ToString()) ... DB_English is from the database, but the XML in Records, does not contain the contents of that field, it contains... System.Xml.Linq.Extensions+<GetElements>d__29`1[System.Xml.Linq.XElement] ... so, how do I get the value of this element in the XML file? I need to check the field in the XML has not been altered, (the manual editors of this data file are not potentially 100% reliable).

    Read the article

  • How to find/extract data from xml with jQuery

    - by darryl
    I'm trying to extract the StateLongName and StateShortName values from the xml below. I know there has to be a simple elegant way to do this with jQuery. <NewDataSet> <Table> <StateLongName>Alabama</StateLongName> <StateShortName>AL</StateShortName> </Table> <Table> <StateLongName>Alaska</StateLongName> <StateShortName>AK</StateShortName> </Table> ...elments removed for brevity </NewDataSet> Here's what I've tried. Load the xml from above into a Javascript variable name xml. Try #1 $(xml).find("TABLE").each(function() { var stateName = $(this).find("StateLongName").innerText; var stateCode = $(this).find("StateShortName").innerText; }); Try #1 doesn't find anything and never goes inside to load the stateName and stateCode variables. Try #2 $(xml).find("StateLongName").each(function() { var stateName = $(this).find("StateLongName").innerText; var stateCode = $(this).find("StateShortName").innerText; }); Try #2 does find matches, however the stateName and stateCode are left undefined. Try #3 $(xml).find("StateLongName").each(function() { var stateName = $($(xml).find('StateLongName').parent()[0].innerHTML)[1].data; var stateCode = $($(xml).find('StateLongName').parent()[0].innerHTML)[5].data; }); Try #3 works but there has to be a better way. Please enlighten me. Thanks for you time!

    Read the article

  • Idiomatic way to build a custom structure from XML zipper in Clojure

    - by Checkers
    Say, I'm parsing an RSS feed and want to extract a subset of information from it. (def feed (-> "http://..." clojure.zip/xml-zip clojure.xml/parse)) I can get links and titles separately: (xml-> feed :channel :item :link text) (xml-> feed :channel :item :title text) However I can't figure out the way to extract them at the same time without traversing the zipper more than once, e.g. (let [feed (-> "http://..." clojure.zip/xml-zip clojure.xml/parse)] (zipmap (xml-> feed :channel :item :link text) (xml-> feed :channel :item :title text))) ...or a variation of thereof, involving mapping multiple sequences to a function that incrementally builds a map with, say, assoc. Not only I have to traverse the sequence multiple times, the sequences also have separate states, so elements must be "aligned", so to speak. That is, in a more complex case than RSS, a sub-element may be missing in particular element, making one of sequences shorter by one (there are no gaps). So the result may actually be incorrect. Is there a better way or is it, in fact, the way you do it in Clojure?

    Read the article

  • Transform RSS-Feed into another "standard" XML-Format with PHP

    - by ChrisBenyamin
    Hey friends, quick question: I need to transform a default RSS Structure into another XML-format. The RSS File is like.... Name des RSS Feed Feed Beschreibung de http://xml-rss.de Sat, 1 Jan 2000 00:00:00 GMT Titel der Nachricht Die Nachricht an sich http://xml-rss.de/link-zur-nachricht.htm Sat, 1. Jan 2000 00:00:00 GMT 01012000-000000 Titel der Nachricht Die Nachricht an sich http://xml-rss.de/link-zur-nachricht.htm Sat, 1. Jan 2000 00:00:00 GMT 01012000-000000 Titel der Nachricht Die Nachricht an sich http://xml-rss.de/link-zur-nachricht.htm Sat, 1. Jan 2000 00:00:00 GMT 01012000-000000 ...and I want to extract only the item-elements (with childs and attributes) XML like: <?xml version="1.0" encoding="ISO-8859-1"?> <item> <title>Titel der Nachricht</title> <description>Die Nachricht an sich</description> <link>http://xml-rss.de/link-zur-nachricht.htm</link> <pubDate>Sat, 1. Jan 2000 00:00:00 GMT</pubDate> <guid>01012000-000000</guid> </item> ... It hasn't to be stored into a file. I need just the output. I tried different approaches with DOMNode, SimpleXML, XPath, ... but without success. Thanks chris

    Read the article

  • ajax html vs xml/json responses - perfomance or other reasons

    - by pedalpete
    I've got a fairly ajax heavy site and some 3k html formatted pages are inserted into the DOM from ajax requests. What I have been doing is taking the html responses and just inserting the whole thing using jQuery. My other option is to output in xml (or possibly json) and then parse the document and insert it into the page. I've noticed it seems that most larger site do things the json/xml way. Google Mail returns xml rather than formatted html. Is this due to performance? or is there another reason to use xml/json vs just retrieving html? From a javascript standpoint, it would seem injecting direct html is simplest. In jQuery I just do this jQuery.ajax({ type: "POST", url: "getpage.php", data: requestData, success: function(response){ jQuery('div#putItHear').html(response); } with an xml/json response I would have to do jQuery.ajax({ type: "POST", url: "getpage.php", data: requestData, success: function(xml){ $("message",xml).each(function(id) { message = $("message",xml).get(id); $("#messagewindow").prepend(""+$("author",message).text()+ ": "+$("text",message).text()+ ""); }); } }); clearly not as efficient from a code standpoint, and I can't expect that it is better browser performance, so why do things the second way?

    Read the article

  • Android OS 2.2 Permissions: I have absolutely no idea why this simple piece of code doesn't work. Wh

    - by Kevin
    I'm just playing around with some code. I create an Activity and simply do something like this: long lo = currentTimeMillis(); System.out.println(lo); lo *= 3; System.out.println(lo); SystemClock.setCurrentTimeMillis(lo); System.out.println( currentTimeMillis() ); Yes, in my AndroidManifest.xml, I've added: <uses-permission android:name="android.permission.SET_TIME"></uses-permission> <uses-permission android:name="android.permission.SET_TIME_ZONE"></uses-permission> Nothing changes. The SystemClock is never reset...it just keeps on ticking. The error that I'm getting just says that the permission "SET_TIME" was not granted to the program. Protection level 3. The permissions are there...and in the API for 2.2 it says that this feature is supported now. I have no idea what I'm doing wrong. If android.content.Intent; comes into play, please explain. I don't really understand what the idea behind intents! Thanks for any help!

    Read the article

  • android error NoSuchElementException

    - by Alexander
    I have returned a cursor string but it contains a delimiter. The delimiter is . I have the string quest.setText(String.valueOf(c.getString(1)));I want to turn the into a new line. What is the best method to achieve this task in android. I understand there is a way to get the delimeter. I want this to achieved for each record. I can itterate through record like so. Cursor c = db.getContact(2); I tried using a string tokenizer but it doesnt seem to work. Here is the code for the tokenizer. I tested it in just plain java and it works without errors. String question = c.getString(1); // quest.setText(String.valueOf(c.getString(1))); //quest.setText(String.valueOf(question)); StringTokenizer st = new StringTokenizer(question,"<ENTER>"); //DisplayContact(c); // StringTokenizer st = new StringTokenizer(question, "=<ENTER>"); while(st.hasMoreTokens()) { String key = st.nextToken(); String val = st.nextToken(); System.out.println(key + "\n" + val); } I then tried running it in android. Here is the error log 06-06 22:31:55.251: E/AndroidRuntime(537): FATAL EXCEPTION: main 06-06 22:31:55.251: E/AndroidRuntime(537): java.util.NoSuchElementException 06-06 22:31:55.251: E/AndroidRuntime(537): at java.util.StringTokenizer.nextToken(StringTokenizer.java:208) 06-06 22:31:55.251: E/AndroidRuntime(537): at alex.android.test.database.quiz.TestdatabasequizActivity$1.onClick(TestdatabasequizActivity.java:95) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.view.View.performClick(View.java:3511) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.view.View$PerformClick.run(View.java:14105) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.os.Handler.handleCallback(Handler.java:605) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.os.Handler.dispatchMessage(Handler.java:92) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.os.Looper.loop(Looper.java:137) 06-06 22:31:55.251: E/AndroidRuntime(537): at android.app.ActivityThread.main(ActivityThread.java:4424) 06-06 22:31:55.251: E/AndroidRuntime(537): at java.lang.reflect.Method.invokeNative(Native Method) 06-06 22:31:55.251: E/AndroidRuntime(537): at java.lang.reflect.Method.invoke(Method.java:511) 06-06 22:31:55.251: E/AndroidRuntime(537): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-06 22:31:55.251: E/AndroidRuntime(537): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-06 22:31:55.251: E/AndroidRuntime(537): at dalvik.system.NativeStart.main(Native Method) This is the database query public Cursor getContact(long rowId) throws SQLException { Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] {KEY_ROWID, question, possibleAnsOne,possibleAnsTwo, possibleAnsThree,realQuestion,UR}, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); }

    Read the article

  • C# XML export for Excel table using XmlDocument

    - by Mark
    I am trying to write the following into an XML document: <head> <xml> <x:ExcelWorkbook> <x:ExcelWorksheets> <x:ExcelWorksheet> other code here </x:ExcelWorksheet> </x:ExcelWorksheets> </x:ExcelWorkbook> </xml> </head> However, if I use the following code, it strips out the 'x:'. System.Xml.XmlDocument document = new System.Xml.XmlDocument(); System.Xml.XmlElement htmlNode = document.CreateElement("html"); htmlNode.SetAttribute("xmlns:o", "urn:schemas-microsoft-com:office:office"); htmlNode.SetAttribute("xmlns:x", "urn:schemas-microsoft-com:office:excel"); htmlNode.SetAttribute("xmlns", "http://www.w3.org/TR/REC-html40"); document.AppendChild(htmlNode); System.Xml.XmlElement headNode = document.CreateElement("head"); htmlNode.AppendChild(headNode); headNode.AppendChild( document.CreateElement("xml")).AppendChild( document.CreateElement("x:ExcelWorkbook"))).AppendChild( document.CreateElement("x:ExcelWorksheets")).AppendChild( document.CreateElement("x:ExcelWorksheet")).InnerText="other code here"; How can I stop this from happening? Thanks!

    Read the article

  • How to check if a node's value in one XML is present in another XML with a specific attribute?

    - by Manish
    The question seems to be little confusing. So let me describe my situation through an example: Suppose I have an XML: A.xml <Cakes> <Cake>Egg</Cake> <Cake>Banana</Cake> </Cakes> Another XML: B.xml <Cakes> <Cake show="true">Egg</Cake> <Cake show="true">Strawberry</Cake> <Cake show="false">Banana</Cake> </Cakes> Now I want to show some text say "TRUE" if all the Cake in A.xml have show="true" in B.xml else "FALSE". In the above case, it will print FALSE. I need to develop an XSL for that. I can loop through all the Cake in A.xml and check if that cake has show="true" in B.xml but I don't know how to break in between (and set a variable) if a show="false" is found. Is it possible? Any help/comments appreciated.

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >