Skip to main content

Posts

Showing posts with the label xml

Send SOAP XML via curl, PHP

This has been bugging me for days, i'm trying to send a SOAP post via curl but i just keep getting a 'couldn't connect to host' error but i really cant see how. I have an asp version which works fine with the same url and data, i think it's just a php/curl thing...? I currently have the following code (the CURLOPT_POSTFIELDS data is a valid soap envelope string) $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, "https://xxx.yyy.com:517/zzz.asmx" ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 10); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true ); curl_setopt($soap_do, CURLOPT_POSTFIELDS, '<soap:Envelope>...</soap:Envelope>'); curl_setopt($soap_d

Convert String to XML Document in JavaScript

Saw this example on the jQuery examples page for Ajax: var xmlDocument = [create xml document]; $.ajax({ url: "page.php", processData: false, data: xmlDocument, success: someFunction }); How do I take a string like: var t = '<foo><bar>something</bar></foo>'; And convert that to a XML DOM object? cross-browser? UPDATE : Please see comments to karim79's answer. Source: Tips4all

Sending encoded XML to a server from iPhone

I'm communicating between an iPhone app and a server using XML. To get around the problem of the user entering any character that might break the XML before I send it to the server i'm using the NSString method: [string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; But I noticed when doing a log of the string that the & symbol is not escaped? I thought that it should be? spaces, quotation marks and hash symbols which I've tested for all encode fine but not the ampersands? What is the most common methods used for encoding/decoding XML sent to/received from a server? Thanks.

Android button with image background and text and stateful functionality

I want to create "button" in XML layout (if possible) which has background image based on state (this image is NOT 9-patched) and with text. Which component to use? My button_states.xml looks like: <?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/my_pressed" /> <item android:drawable="@drawable/my_normal" /> </selector> my_pressed and my_normal are NON 9-patched images. Now if I use regular button <Button android:id="@+id/my_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/button_states" android:text="@string/my_text" /> button it is rendered without background image. How to do "button" with text a

How can i convert from String token fron edit text to integer in android

how can I get the data from edit text (the input type of the edit text is integer), I tried this code but it shows RunTime Error: CaseAge=(EditText) findViewById(R.id.editText2); String age =CaseAge.getText().toString(); case1.setAge(Integer.parseInt((age)); actually the problem with this line: case1.setAge(Integer.parseInt((age)); thank you so much,

How do i write objects that i have no control over in jaxb?

I am trying to find a way to marshall classes that i have no access to. I am trying to achieve something like this: @XmlRootElement(name="bar") class Bar { @XmlAttribute private Foo foo; @XmlAttribute private String baz; } which should result in a xml file like this: <bar baz="stuff" foo="otherstuff"/> Is this possible? I tried to fiddle with @XmlJavaTypeAdapter with no sucess.

Making a dynamic sequence(in Java)

Hey guys im having a problem trying to program out a set of logic. I want to make a Go(the board game) problem. What i want my program to do is read in an xml file that represents a series of steps a person can make to complete the puzzle, or a even a dead end. So in the xml it would look something like <Step x="4" y="5"> <Response x="4" y="6" /> <Step x="3" y="6" victory="true"> </Step> </Step> <!-- This is a dead end --> <Step x="4" y="4"> <Response x="4" y="5" /> <Step x="5" y="5" defeat="true"></Step> <Step x="6" y="4" defeat="true"></Step> </Step> My thought is to make a link list of sorts where my xml handler(im using SAX) uses the step class to store a step inside a step, but i cant conceptualize how i would

In a test I can find a xml, in another I can"t

I have an interesting problem, I have two web services defined in a spring-conf.xml file and I have two test classes that live in the same package and every class has its own link to this spring-conf.xml file to call their particular webservice. I am able to get beans from one of my test classes but from the other one I can't and the code is equal in both classes. In one I have this import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class WSFirstTest { private ApplicationContext context = new ClassPathXmlApplicationContext( "WEB-INF/spring-conf.xml"); private WSFirst ws = (WSFirst) context .getBean("serviceFirstDefault"); in the other one I have this import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class WSSecondTest { private ApplicationContext context2 = new ClassPath

Why do JAXB generated classes have protected members and how can I change this?

I have been searching the internet for a reason why JAXB generated classes have protected members (all of them, regardless of inheritance). I would like the members to be private instead. My search has come up empty. I have normal xsd files which are converted into java classes using maven and jaxb. Ideally the generated members should be private but I cannot find a way to achieve this. Is there a way to modify this default behaviour? Thanks. [edited first sentence]

Creating xml based on html using xslt in java

Please help me i am doing project of file conversion that is converting xml to html using xsl in java and also i need to convert html to xml using the xsl. my first process is got over.but i structed in second part of conversion.. Is there is any possibility to do that conversion.I will tell you the exact flow of the first process... This is my sample xml file: tabl.xml: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xml" href="testxsl.xsl"?> <mainpara> <epigraph> <para>Though successful research demands a deep <emphasis role="italic">trained</emphasis> <emphasis role="italic">taught</emphasis> to regard. </para> <para>Kuhn (1976, p. 66)</para> </epigraph> <blockquote role="extract"> <para>Though successful research demands a deep commitment to the status quo. <emphasis role="italic">train

Populating a select list based on an index from another select list using jQuery and xml

I've been trying to fix a problem i've been having all afternoon and was hoping someone might be kind enough to help me spot my error.I've only started learning jQuery this morning and was trying to get this function working but its proving a bit of a pain in the proverbial... I'm trying to populate a model select list based on a value from a make select list My jQuery function looks like this: $(document).ready(function() { $('#make').change(function(){ alert('Changing'); $('#model option').remove(); $('#model').attr('disabled',true); $.ajax( { type: "GET", url: "../xmlsource/models/model-"+$('#make option:selected').val()+".xml", dataType: "xml", success: function(xml) { alert('XML'); $(xml).find('model').each(function() {

xml parsing in android - recursive tags

I have little confusion regarding the xml parsing in android, Lemme explain the scenario. Lets say I have a tag namely <item> </item> , this tag can hold another tag with the same description into it <item> <item> </item> </item> after inserting the data appropriately how could i possibly able to know if there is a child item in an item or not, and if yes then how could i parse it. MGD