Search Results

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

Page 146/1032 | < Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >

  • Using a string inside the DocumentBuilder parse method (need it for parsing XML using XPath)

    - by dierre
    Hi guys! I'm trying to create a RESTful webservice using a Java Servlet. The problem is I have to pass via POST method to a webserver a request. The content of this request is not a parameter but the body itself. So I basically send from ruby something like this: url = URI.parse(@host) req = Net::HTTP::Post.new('/WebService/WebServiceServlet') req['Content-Type'] = "text/xml" # req.basic_auth 'account', 'password' req.body = data response = Net::HTTP.start(url.host, url.port){ |http| puts http.request(req).body } Then I have to retrieve the body of this request in my servlet. I use the classic readline, so I have a string. The problem is when I have to parse it as XML: private void useXML( final String soft, final PrintWriter out) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException, FileNotFoundException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); // never forget this! DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(soft); XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("//software/text()"); Object result = expr.evaluate(doc, XPathConstants.NODESET); NodeList nodes = (NodeList) result; for (int i = 0; i < nodes.getLength(); i++) { out.println(nodes.item(i).getNodeValue()); } } The problem is that builder.parse() accepts: parse(File f), parse(InputSource is), parse(InputStream is). Is there any way I can transform my xml string in an InputSource or something like that? I know it could be a dummy question but Java is not my thing, I'm forced to use it and I'm not very skilled.

    Read the article

  • Android Alert Dialog Extract User Choice Radio Button?

    - by kel196
    Apologies for any coding ignorance, I am a beginner and am still learning! I am creating a quiz app which reads questions off a SQL database and plots them as points on a google map. As the user clicks each point, an alert dialog appears with radio buttons to answer some question. My radiobuttons are in CustomItemizedOverlay file and when I click submit, I want to be able to send the user choice back to the database, save it and return to the user if their answer is correct. My question is this, how do I pass the user choice out once the submit button has been clicked? I tried making a global variable to read what was selected to no avail. Any suggestions would be appreciated! If I need to post any other code, please ask and I will do so ASAP! package uk.ac.ucl.cege.cegeg077.uceskkw; import java.util.ArrayList; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.graphics.drawable.Drawable; import android.widget.Toast; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.OverlayItem; public class CustomItemizedOverlay2 extends ItemizedOverlay<OverlayItem> { private ArrayList<OverlayItem> mapOverlays = new ArrayList<OverlayItem>(); private Context context; public CustomItemizedOverlay2(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); } public CustomItemizedOverlay2(Drawable defaultMarker, Context context) { this(defaultMarker); this.context = context; } @Override protected OverlayItem createItem(int i) { return mapOverlays.get(i); } @Override public int size() { return mapOverlays.size(); } @Override protected boolean onTap(int index) { OverlayItem item = mapOverlays.get(index); // gets the snippet from ParseKMLAndDisplayOnMap and splits it back into // a string. final CharSequence allanswers[] = item.getSnippet().split("::"); AlertDialog.Builder dialog = new AlertDialog.Builder(context); dialog.setIcon(R.drawable.easterbunnyegg); dialog.setTitle(item.getTitle()); dialog.setSingleChoiceItems(allanswers, -1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Toast.makeText(context, "You have selected " + allanswers[whichButton], Toast.LENGTH_SHORT).show(); } }); dialog.setPositiveButton(R.string.button_submit, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); // int selectedPosition = ((AlertDialog) // dialog).getListView().getCheckedItemPosition(); Toast.makeText(context, "hi!", Toast.LENGTH_SHORT) .show(); } }); dialog.setNegativeButton(R.string.button_close, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); // on cancel button action } }); AlertDialog question = dialog.create(); question.show(); return true; } public void addOverlay(OverlayItem overlay) { mapOverlays.add(overlay); this.populate(); } }

    Read the article

  • get user selection and convert it to a String [Android]

    - by Kira
    Hello, I just got a Droid, and after having used it for a while, I felt like I wanted to make a program for it. The program that I am trying to make calculates the actual storage capacity of secondary storage mediums. The user select from a list of units that ranges from KB to YB and the size the entered gets put into a formula depending on the chosen unit. However, there is a bit of a problem with the program. From my testing, I have narrowed it down to the fact that the user's selection is not really being obtained from the spinner. Everything I look up seems to point me to a method quite similar to how it works in J2SE, but it does nothing. How am I actually supposed to get that data? Here is the Java source code for the app: package com.Actual.android; import android.app.Activity; import android.os.Bundle; import android.widget.*; import android.view.*; public class ActualStorageActivity extends Activity { Spinner selection; /* declare variable, in order to control spinner (ComboBox) */ ArrayAdapter adapter; /* declare an array adapter object, in order for spinner to work */ EditText size; /* declare variable to control textfield */ EditText result; /* declare variable to control textfield */ Button calculate; /* declare variable to control button */ Storage capacity = new Storage(); /* import custom class for formulas */ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // load content from XML selection = (Spinner)findViewById(R.id.spinner); adapter = ArrayAdapter.createFromResource(this, R.array.choices_array, android.R.layout.simple_spinner_dropdown_item); size = (EditText)findViewById(R.id.size); result = (EditText)findViewById(R.id.result); calculate = (Button)findViewById(R.id.submit); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); /* set resource for dropdown */ selection.setAdapter(adapter); // attach adapter to spinner result.setEnabled(false); // make read-only result.setText("usable storage"); } public void calcAction(View view) { String initial = size.getText().toString(); String unit = selection.getSelectedItem().toString(); String end = "Nothing"; double convert = Double.parseDouble(initial); capacity.setStorage(convert); if (unit == "KB") { end = Double.toString(capacity.getKB()); } else if (unit == "MB") { end = Double.toString(capacity.getMB()); } else if (unit == "GB") { end = Double.toString(capacity.getGB()); } else if (unit == "TB") { end = Double.toString(capacity.getTB()); } else if (unit == "PB") { end = Double.toString(capacity.getPB()); } else if (unit == "EB") { end = Double.toString(capacity.getEB()); } else if (unit == "ZB") { end = Double.toString(capacity.getZB()); } else if (unit == "YB") { end = Double.toString(capacity.getYB()); } else; result.setText(end); } }

    Read the article

  • Using Android Test Framework

    - by Bharat Pawar
    Android provides various packages for testing like AndroidTestCase ApplicationTestCase InstrumentationTestCase ActivityInstrumentationTestCase2 ActivityTestCase I need to know how to decide which package is best suitable for testing my app. Some info is provided in this link http://developer.android.com/reference/android/test/package-summary.html But I need more clarity on this...

    Read the article

  • Android: Text primary key with different name

    - by Echilon
    I have an existing Windows app for which I'm writing an Android port. The app uses a unique string as the primary key, but the SQLite methods in Android all seem to work with integers and a column names _id, whereas my ID column isn't called this. Is there a way to let Android know I have a key with a different column name?

    Read the article

  • Iterate through every node in a XML

    - by Rachel
    Hi I am trying to iterate through every node in a xml, be it the element node, text node or comment. With the below XSL in the very first statement prints the complete xml. How do i copy the very first node in $nodes and call the template process-nodes again removing teh first node in my next iteration? <?xml version='1.0'?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:call-template name="process-nodes"> <xsl:with-param name="nodes" select="//node()" as="node()*"/> </xsl:call-template> </xsl:template> <xsl:template name="process-nodes"> <xsl:param name="nodes" as="node()*" /> <xsl:copy-of select="$nodes[1]"/> <xsl:if test="$nodes"> <xsl:call-template name="process-nodes"> <xsl:with-param name="nodes" select="remove($nodes, 1)" /> </xsl:call-template> </xsl:if> </xsl:template> </xsl:stylesheet> Note: I am looking for fixing the issue in this kind of implementation rather than changing the template match to <xsl:template match="@* | node()"> as I need to have some processing which requires this approach. Thanks.

    Read the article

  • Google Analytics for Android tracking Market keywords?

    - by Andrea Baccega
    Hello there, I do want to implement the Google Analytics for mobile on my android application using the sdk provided on this page http://code.google.com/intl/it-IT/mobile/analytics/docs/android/ Does someone knows, before i start to integrate it, if it tracks the keywords people used on the android market in order to arrive and install my application ? If it does not, which would be the purpose of using this ?

    Read the article

  • Stop CDATA tags from being output-escaped when writing to XML in C#

    - by Smallgods
    We're creating a system outputting some data to an XML schema. Some of the fields in this schema need their formatting preserved, as it will be parsed by the end system into potentially a Word doc layout. To do this we're using <![CDATA[Some formatted text]]> tags inside of the App.Config file, then putting that into an appropriate property field in a xsd.exe generated class from our schema. Ideally the formatting wouldn't be out problem, but unfortunately thats just how the system is going. The App.Config section looks as follows: <header> <![CDATA[Some sample formatted data]]> </header> The data assignment looks as follows: HeaderSection header = ConfigurationManager.GetSection("header") as HeaderSection; report.header = "<[CDATA[" + header.Header + "]]>"; Finally, the Xml output is handled as follows: xs = new XmlSerializer(typeof(report)); fs = new FileStream (reportLocation, FileMode.Create); xs.Serialize(fs, report); fs.Flush(); fs.Close(); This should in theory produce in the final Xml a section that has information with CDATA tags around it. However, the angled brackets are being converted into &lt; and &gt; I've looked at ways of disabling Outout Escaping, but so far can only find references to XSLT sheets. I've also tried @"<[CDATA[" with the strings, but again no luck. Any help would be appreciated!

    Read the article

  • Android emulator doesn't take keyboard input from my desktop keyboard - SDK tools rev 20

    - by qhdwangnan
    After updating SDK tools rev to 20, Android emulator doesn't take keyboard input from my desktop keyboard. When press a key of the desktop keyboard, the emulator will dead and I have to kill its process. Android emulator also didn't take keyboard input from emulator own keyboard. But I have fixed this by following the steps in Android emulator doesn't take keyboard input - SDK tools rev 20. Does anyone have some suggestions?

    Read the article

  • Load images into separate movie clips from a XML, Flash, Actionscript 3.0

    - by James Dunay
    I have an xml image bank, pretty standard, and I have a loader, along with movie clips that I want the images loaded into, the problem that I am running into is I want the images to load into separate movie clips, so I’m using a case statement to specify where they go. However, I can only get them to load into a single movie clip, I assume they are loading ontop of each other and I don’t know how to get them to separate out. I’ll post my code. It doesn’t make any sense to me but if you have any suggestions that would be real great. I can make separate loaders and then just do 1 image per loader, but that just doesn’t sound right to me. var counterNumber:Number = 0; function callThumbs():void{ for (var i:Number = 0; i <3; i++){ thumbLoaded(); counterNumber++; } } function thumbLoaded(){ var photoLoader = new Loader(); switch (counterNumber){ case 1: photoLoader.load(new URLRequest(MovieClip(this.parent).xml.photos.imageOne.image.@url[0])); whole.boxOne.pictureLoader.addChild(photoLoader); trace("1Done"); break; case 2: photoLoader.load(new URLRequest(MovieClip(this.parent).xml.photos.imageTwo.image.@url[0])); whole.boxTwo.pictureLoader.addChild(photoLoader); trace("2Done"); break; } }

    Read the article

  • How can I add more Android home screens?

    - by LKM
    It seems my HTC Magic running Android 1.5 (Cupcake) has three home screens I can switch between. I can't find any kind of option to add additional home screens (the "home screen" menu only lets me add Widgets, Shortcuts and Folders or change the Wallpaper). Is there any way I can add more?

    Read the article

  • can't read XML via PHP

    - by jasmine
    I can't find the reason, only see the following error message. Input is not proper UTF-8, indicate encoding ! Bytes: 0x00 0x5D 0x5D 0x3E the followings are my php code $reader2 = new XMLReader(); $reader2->XML($xmlstring); $user_data=""; while ($reader2->read()) { if ($reader2->name == "user_id" && $reader2->nodeType == XMLReader::ELEMENT) { $reader2->read(); $user_data .=$reader2->value; } } $reader2->close(); The followings are XML data <?xml version="1.0" encoding="UTF-8" ?> <SOAP:Envelope xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope" > <SOAP:Body > <user_id>1234567890</user_id> <greeting_name><![CDATA[ABCDEF ..yl/?]]></greeting_name> </SOAP:Body> </SOAP:Envelope> I try a lot of ways,but still can't find the solution. the greeting tag value may be chinese or English words.

    Read the article

  • Image compatibility in iphone and android

    - by damodar
    I developed UI for iphone apps and now want to use the same UI in Android apps. I read that Android use dip for image resolution and i also read that 1 dip=1.5 pixel.I simply multiply the image size by 1.5px. Now the problem is that the image is blur and not as clear as in iphone apps.So will some body suggest me how should i make a design so that it could be used in iphone and android.

    Read the article

  • how to display bitmaps in listview?

    - by mary
    hi i want to show images downloaded in listview.images downloaded with function DownloadImage and are as bitmap.how to show in listview . name photoes with book_id in tabel book are aqual.i want each book has its own image. i can show in listview book_name and book_price just the problem with image book please help me class: package bookstore.category; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.http.NameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import bookstore.pack.JSONParser; import bookstore.pack.R; import android.app.Activity; import android.app.ProgressDialog; public class Computer extends Activity { Bitmap bm = null; // progress dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jParser = new JSONParser(); ArrayList<HashMap<String, String>> computerBookList; private static String url_books = "http://10.0.2.2/project/computer.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_BOOK = "book"; private static final String TAG_BOOK_NAME = "book_name"; private static final String TAG_BOOK_PRICE = "book_price"; private static final String TAG_BOOK_ID = "book_id"; private static final String TAG_MESSAGE = "massage"; // category JSONArray JSONArray book = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.category); Typeface font1 = Typeface.createFromAsset(getAssets(), "font/bnazanin.TTF"); // Hashmap for ListView computerBookList = new ArrayList<HashMap<String, String>>(); new LoadBook().execute(); } class LoadBook extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(Computer.this); pDialog.setMessage("Please wait..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } protected String doInBackground(String... args) { // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); // getting JSON string from URL JSONObject json = jParser.makeHttpRequest(url_books, "GET", params); // Check your log cat for JSON reponse Log.d("book:", json.toString()); try { // Checking for SUCCESS TAG int success = json.getInt(TAG_SUCCESS); if (success == 1) { DownloadImage("10.0.2.2/project/images/100.png"); DownloadImage("10.0.2.2/project/images/101.png"); DownloadImage("10.0.2.2/project/images/102.png"); DownloadImage("10.0.2.2/project/images/103.png"); DownloadImage("10.0.2.2/project/images/104.png"); DownloadImage("10.0.2.2/project/images/105.png"); DownloadImage("10.0.2.2/project/images/106.png"); DownloadImage("10.0.2.2/project/images/107.png"); DownloadImage("10.0.2.2/project/images/108.png"); DownloadImage("10.0.2.2/project/images/109.png"); DownloadImage("10.0.2.2/project/images/110.png"); // books found book = json.getJSONArray(TAG_BOOK); for (int i = 0; i < book.length(); i++) { JSONObject c = book.getJSONObject(i); // Storing each json item in variable String book_name = c.getString(TAG_BOOK_NAME); String book_price = c.getString(TAG_BOOK_PRICE); String book_id = c.getString(TAG_BOOK_ID); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_BOOK_NAME, book_name); map.put(TAG_BOOK_PRICE, book_price); // map.put(TAG_AUTHOR_NAME, author_name); // adding HashList to ArrayList computerBookList.add(map); } return json.getString(TAG_MESSAGE); } else { System.out.println("no book found"); } } catch (JSONException e) { e.printStackTrace(); } return null; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { pDialog.dismiss(); // updating UI from Background Thread runOnUiThread(new Runnable() { ListView view1 = (ListView) findViewById(R.id.list_view); public void run() { ImageView iv = (ImageView) findViewById(R.id.list_image); // bm=BitmapFactory.decodeResource(getResources(), resId); //bm=BitmapFactory.decodeResource(null,R.id.list_image); // iv.setImageBitmap(bm); /* * */ /** * Updating parsed JSON data into ListView * */ ListAdapter adapter = new SimpleAdapter(Computer.this, computerBookList, R.layout.search_item, new String[] { TAG_BOOK_NAME, TAG_BOOK_PRICE }, new int[] { R.id.book_name, R.id.book_price }); view1.setAdapter(adapter); } }); } } private Bitmap DownloadImage(String URL) { Bitmap bitmap = null; InputStream in = null; try { in = OpenHttpConnection(URL); bitmap = BitmapFactory.decodeStream(in); in.close(); } catch (IOException e1) { e1.printStackTrace(); } return bitmap; } private InputStream OpenHttpConnection(String urlString) throws IOException { InputStream in = null; int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); if (!(conn instanceof HttpURLConnection)) throw new IOException("Not an HTTP connection"); try { HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET"); httpConn.connect(); response = httpConn.getResponseCode(); if (response == HttpURLConnection.HTTP_OK) { in = httpConn.getInputStream(); } } catch (Exception ex) { throw new IOException("Error connecting"); } return in; } }

    Read the article

  • Fastest XML parser for small, simple documents in Java

    - by Varkhan
    I have to objectify very simple and small XML documents (less than 1k, and it's almost SGML: no namespaces, plain UTF-8, you name it...), read from a stream, in Java. I am using JAXP to process the data from my stream into a Document object. I have tried Xerces, it's way too big and slow... I am using Dom4j, but I am still spending way too much time in org.dom4j.io.SAXReader. Does anybody out there have any suggestion on a faster, more efficient implementation, keeping in mind I have very tough CPU and memory constraints? [Edit 1] Keep in mind that my documents are very small, so the overhead of staring the parser can be important. For instance I am spending as much time in org.xml.sax.helpers.XMLReaderFactory.createXMLReader as in org.dom4j.io.SAXReader.read [Edit 2] The result has to be in Dom format, as I pass the document to decision tools that do arbitrary processing on it, like switching code based on the value of arbitrary XPaths, but also extracting lists of values packed as children of a predefined node. [Edit 3] In any case I eventually need to load/parse the complete document, since all the information it contains is going to be used at some point. (This question is related to, but different from, http://stackoverflow.com/questions/373833/best-xml-parser-for-java )

    Read the article

  • Preferred Options for Webservice to Android

    - by Tim Almond
    I need to get an Android app to interface with an XML webservice (it's really just a request which returns XML), but as the data is large and includes some things I don't need (like a huge description block), I was thinking of transforming it via a server into a format that would be good for Android, and also to be reduced considering it will be used in a low bandwidth area. Does anyone have any suggestions for a good lightweight protocol? I'm especially thinking about libraries for Android that already exist for say REST or even delimited data.

    Read the article

  • Cannot connect Nexus One Phone to Android adb

    - by appbee
    I am running Android SDK 2.2 and am trying to get the adb to connect to the Google Nexus One phone. Its a new phone, shipped straight from Google - haven't installed any apps on it yet. (I have Windows XP) Here is what I have done so far: Followed the instructions on setting up the device for development as given on the Android Developer's site: http://developer.android.com/guide/developing/device.html added android:debuggable="true" to my application manifest USB debuggable is checked on the phone downloaded the Device Drivers For Windows Revision 3 (this supports Nexus One phones) Went through the Hardware Installation wizard to install the device - the device shows up as "Android Composite ADB Interface". When I run adb devices on the shell, the device appears for a moment, then disappears. On the Eclipse console, I get the following message: [2010-11-13 11:54:42 - DeviceMonitor]Failed to start monitoring I have rebooted the pc several times, uninstalled and reinstalled the drivers several times, but I get the same error each time. As I was researching this problem, someone had recommended rebooting the phone. I am a bit confused by that - is that a soft or hard reboot? Do I just power the phone off/on and is there something more complex involved? Do I have to hard reboot it to reset to factory version - even though its brand new? Has anyone run into a similar problem? Any help on this would be great. I can't test my application on the device if the adb cannot view the device. Thanks so much in advance.

    Read the article

  • JQuery can't return xml value

    - by Mistergreen
    I have this simple xml <?xml version="1.0"?> <library> <item name="box_shelf"> <imageback src="images/box_shelf_color.png"/> <outline src="images/box_shelf_outline.png"/> <sku> <wh sku="4696424171" /> <ch sku="4696424179" /> <choc sku="4696425863" /> <ma sku="4696424175" /> </sku> </item> </library> Loading the xml is fine. I then have a function to parse certain nodes. function parseImageXml(mainNode,targetNode) { $(libraryXML).find('item').each(function() { if($(this).attr('name') == mainNode) { var $temp = $(this).find(targetNode).attr('src'); console.log("******"+$temp); return $temp; } }); } The console log is fine with ******images/box_shelf_outline.png ******images/box_shelf_color.png But when I try to return the value into variables, I get undefined. var image_outline = ''+parseImageXml("box_shelf","outline"); var image_back = parseImageXml("box_shelf","imageback"); console.log(image_outline+":"+image_back); undefined:undefined Any insight would be great, thanks

    Read the article

  • Which of these two Android books, and why?

    - by mawg
    Both get five star customer reviews on Android. I suspect that there will be an 80%+ overlap in contents, so can anyone say which to buy and why? Professional Android 2 Application Development (Wrox Programmer to Programmer) Pro Android 2 If any one has read either, or both, I am particularly interested in developing wifi applications.

    Read the article

  • How to get values of xml elements?

    - by user187580
    Hi, I have some xml data and I am trying to access some elements. The structure of data is as below (using print_r($data)). I can get $data->{'parent'}->title, it works but if I try to get value of href using $data->{'parent'}->link[0]->{'@attributes'}->href .. it doesnt work .. any ideas? Thanks SimpleXMLElement Object ( [@attributes] => Array ( [children] => 29 [modules] => 0 ) [title] => Test title [link] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => data.php?id=2322 [rel] => self [type] => application/xml ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => data.php?id=2342 [rel] => alternate [type] => text/html ) ) ) [parent] => SimpleXMLElement Object ( [@attributes] => Array ( [children] => 6 [modules] => 0 ) [title] => Top [link] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => /data.php?id=5763 [rel] => self [type] => application/xml ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [href] => /data.php?id=2342 [rel] => alternate [type] => text/html ) ) ) ) )

    Read the article

  • How to send XML and other post parameters via cURL in PHP

    - by tomaszs
    Hello. I've used code below to send XML to my REST API. $xml_string_data contains proper XML, and it is passed well to mypi.php: //set POST variables $url = 'http://www.server.cu/mypi.php'; $fields = array( 'data'=>urlencode($xml_string_data) ); //url-ify the data for the POST $fields_string = ""; foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); echo $fields_string; //open connection $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); curl_setopt($ch,CURLOPT_HTTPHEADER,array ( "Expect: " )); //execute post $result = @curl_exec($ch); But when I've added other field: $fields = array( 'method' => "methodGoPay", 'data'=>urlencode($xml_string_data) ); It stopped to work. On the mypi.php I don't recieve any more POST parameters at all! Could you you please tell me what to do to send XML and other post parameters in one cURL request? Please don't suggest using any libraries, I wan't to acomplish it in plain PHP.

    Read the article

  • ignoring elements order in xml validation against xsd

    - by segolas
    Hi, Ia processing an email and saving some header inside a xml document. I also need to validate the document against a xml schema. As the subject suggest, I need to validate ignoring the elements order but, as far as I read this seems to be impossible. Am I correct? If I put the headers in a<xsd:sequence>, the order obviously matter. If I us the order is ignored but for some strange reason this imply that the elements must occur at least once. My xml is something like this: <headers> <subject>bla bla bla</subject> <recipient>[email protected]</recipient> <recipient>rcp02domain.com</recipient> <recipient>[email protected]</recipient> </headers> but I think the final document is valid even if subject and recipient elements are swapped. There is really nothing to do?

    Read the article

  • Android SDK not recognizing debug-able device.

    - by kal.zekdor
    I'm new to Android development, and am attempting to run a test application on my actual device. I followed the instructions at http://developer.android.com/guide/developing/device.html (and related links), but the Android Debug Bridge (adb) doesn't recognize my connected device. Some quick background info, I'm running WinXP, developing with Eclipse, with a Motorola Droid running Android 2.1 as my physical device. An overview of the steps I've taken: Installed the Android SDK, downloading all necessary packages. Enabled USB Debugging on my device. Connected Device via USB, installing the driver from the SDK folder. I'll stop here (though I continued to setup my application to be debug-able in Eclipse), because I at this point I noticed a problem. Running "sdk\tools\adb devices" at this point (at least, by my understanding), should list my device as connected. However, running this yields only: List of devices attached My device recognizes that it's connected to a computer in debug mode, and my computer recognizes the device. However, I can't seem to get the sdk to recognize it. I'll leave out the steps I used to setup Eclipse for debugging on a device, as it doesn't seem relevant to the problem. I'll include them if requested. If anyone has any ideas, I'd greatly appreciate some assistance. Thanks in advance for your time.

    Read the article

  • Creating subtree from tree which is represented in xml - python

    - by Jay
    Hi I have an XML (in the form of tree), I require to create sub-tree out of it. For ex: <a> <b> <c>Hello</c> <d> <e>Hi</e> </a> Subtree would be <root> <a> <b> <c>Hello</c> </b> </a> <a> <d> <e>Hi</e> </d> </a> </root> What is the best XML library in python to do it? Any algorithm that already does this would also be helpful. Note: the XML doc won't be that big, it will easily fit in memory.

    Read the article

< Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >