I am programming in android and I am getting some xml data through SOAP which I am placing in a string object. Now I want to get all the id's from and put them in an array. How do I do that ??????
From the code below, i want to get the values 1101, 1103 in an array..... please help
<getAvailableSpotResult>
<garage id=1 name='South Garage' address='100 acme dr' city='san jose' state='ca' zip='95052'>
<floor number='1'>
<spot id='1101' status='available'/>
<spot id='1103' status='available'/>
</floor>
</garage>
</getAvailableSpotResult>
You need to parse the xml to get the required data. If you google, "How to parse xml in java android", you'll get lots of results.
First try and read the official documentation on Parsing XML Data and see the examples.
You can check out other similar questions How to read XML file in android and Read XML file in android. You can also try this tutorial.
Please try to atleast google or see previous answers before asking a question. If there is any specific problem you are facing, everyone would be happy to help.
Related
I am desperatly searching on how to add a new attribute to the custom dimensions collection in the request table of the log analytics in the context of a Java function.
I know in C# you can do it using Activity and ITelementryInitializer but for Java I can not get it to work.
Any hints are appreciated. ;)
Azure Function (Java) add attribute to CustomDimensions
In Java, we have the Span attributes concept for adding the optional (extra) fields to the App Insights Schema that populates with the customDimensions in the form of various tables such as traces, exceptions, dependencies.
For that, one of the dependencies is required which is opentelemetry-api-1.jar.
AttributeKey newAttributeKey= AttributeKey.stringKey("resourcecustomDimension"); Span.current().setAttribute(newAttributeKey, "customDimValue");
This brings us the custom attributes for the custom dimensions that will be added to the Telemetry data.
Refer to this MS Doc for more information on adding the attributes to the customDimensions and found the GitHub issue 13310 regarding the user seeking for the Java Code on ITelemetryInitializer where the sample code on it provided by #dhaval24 user.
I am using FME to get output from the following: https://coronavirus.data.gov.uk/developers-guide
I am just a beginner and is first time I want to write this up. To generate an Output URL from this with the relevant columns, can anyone explain what I need to get the request URL. I am using GET as the HTTP method
An example of a url i get some data out of is - https://soa.smext.faa.gov/asws/api/airport/status/SFO
But when i try with the links below which i tested does not get any output https://api.coronavirus.data.gov.uk/v1/data?filters=areaType=nation;areaName=england&structure=%7B%22name%22:%22areaName%22%7D
https://api.coronavirus.data.gov.uk//v1/data?filters=areaType=nation;areaName=england&structure={"date":"date","areaName":"areaName","areaCode":"areaCode","newCasesByPublishDate":"2020-07-07","cumCasesByPublishDate":"2020-08-08","newDeathsByDeathDate":"2020-02-06","cumDeathsByDeathDate":"2020-06-09"}
This is a better link for you to try out.
https://api.coronavirus.data.gov.uk/v1/data?filters=areaType=nation;areaName=england&structure={%22date%22:%22date%22,%22areaName%22:%22areaName%22,%22areaCode%22:%22areaCode%22,%22newCasesByPublishDate%22:%22newCasesByPublishDate%22,%22cumCasesByPublishDate%22:%22cumCasesByPublishDate%22,%22newDeaths28DaysByDeathDate%22:%22newDeaths28DaysByDeathDate%22}
Took me a while to suss it out.
I am newbie for cloudant and trying to learn full text search on cloudant through tutorial video. I am successful in searching on the cloudant.com through http request ,Now I want that code to be in java as i am working on GWT framework with java. Till now , I am just able to create connection with cloudant.com by studying the particular github project GITHUBLINK
There its given for search like this
Search search = db.search("views101/animals");
SearchResult<Animal> rslt = search
.limit(10)
.includeDocs(true)
.counts(new String[] {"class","diet"})
.querySearchResult("l*", Animal.class);
My Questions:
1. what exactly is this Animal.class refer to?
2. If this not the way what are the steps for full text search on cloudant.
I have created the view and the search index manually on cloudant.com under a designdoc of a database.
Animal.class refers to the class that the documents found will be deserialised into, if you do not have a class to deserialise the data into, you should be able to a HashMap or similar class to access the data returned.
You can find the example source code for the Animal class in this location: https://github.com/cloudant/java-cloudant/blob/88202a1bd7b9b04d96c4b7b8498a1b8f7f99c9e5/src/test/java/com/cloudant/tests/Animal.java.
Like the previous answer indicated, you could also have the results returned as a generic JsonObject that provides access to the properties and values.
I am new to Android and Windows Azure. I have successfully inserted data from Android application but how do I retrieve single data and post that data on a TextView?
The read function after the gettable class is also not working. What is the exact function use for it? I have followed these instructions but they did not work for me, also I do not understand the documentation.
Currently, I just can provide some tutorials about how to use query data from azure database. I recommend you can refer to this official document about how to use Azure Client Library using Java: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-android-how-to-use-client-library . You can focus on two part: “how to query data from a mobile service” and “how to bind data to the UI”.
At the same time, you can view this video from Channel 9: https://channel9.msdn.com/Series/Windows-Azure-Mobile-Services/Android-Getting-Started-With-Data-Connecting-your-app-to-Windows-Azure-Mobile-Services.
The sample code project of this tutorial, please go to the GitHub link https://github.com/Azure/mobile-services-samples/tree/master/GettingStartedWithData .
For the ‘getTable(Class )’ function is not working, please double check whether the class name is same as table name. If they are same, you can use it like below:
MobileServiceTable<ToDoItem> mToDoTable = mClient.getTable(ToDoItem.class);
If not, you can write you code like this:
MobileServiceTable<ToDoItem> mToDoTable = mClient.getTable("ToDoItemBackup", ToDoItem.class);
For further better support, please share more detail about your code snippet .
I am trying to pull a page of user documents on a specific user. I have tried to reach out to Google support to troubleshoot the issue but they did not help in the issue. When I pull this particular user's file list I receive the error :
java.lang.IllegalArgumentException: number field formatted as a JSON string must use the #JsonString annotation [key aperture, field private java.lang.Float com.google.api.services.drive.model.File$ImageMediaMetadata.aperture]
at com.google.api.client.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:119)
at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:69)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:789)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:438)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:745)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:438)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:745)
at com.google.api.client.json.JsonParser.parseArray(JsonParser.java:610)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:708)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:438)
at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:745)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:358)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:331)
at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:87)
at com.google.api.client.json.JsonObjectParser.parseAndClose(JsonObjectParser.java:81)
at com.google.api.client.http.HttpResponse.parseAs(HttpResponse.java:459)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
To me this looks like a Java Client Library parsing issue but I would like to bring it to the attention of someone in the Drive team to have them look at it.
The code to produce this error is as following :
Files.List request = service.files().list();
FileList files = request.execute();