i am block on a problem and i need your expertise.
I downloaded the BasicSyncAdapter of Android , on here
and i succeeded to use it on my android projet, BUT it's work with FeedParser in XML...
And i would like to work with JSON data, so with parser JSON.I found many library like Jackson, Gson..
But i'm afraid to blow all.
So can you help me about this parser..?
Simply use your JSON parser using Android JSON parser to parse your data. You can edit BasicSyncAdapter source code and instead of FeedParser use your own JSON data parser, also make sure you include license information.
Related
is there any solution other than Moshi, Gson, KotlinX-Serialization to serialize json in Android? We should not add anything to build.gradle while using technology. We should not download a library from here.
Is there a method on Android just like Codable on iOS? Also, I think how we should do this part is important since Converter will be passed when using it with Retrofit.
Does anyone have experience and advice on this subject?
You can use JSONObject for that.
val json = JSONObject("""{"some":"json"}""")
However, easiest is to use one of the third party frameworks you mentioned to do this.
I need to parse and modify the XML in android ..Can any one suggest which XML parser is better to parse and modify the XML in android ..?
Currently I'm using XMLpullparser but using this i'm not able to modify the XML...
Xpath is available for Android developers I believe. I use that all the time for any XML parsing really.
If the XML has a simple structure then you can deserialize the file into an object. You modify some properties of that object and serialize it to XML afterwards.
XStream is a simple library to serialize objects to XML and back again. It can be found here.
I think this is a clean way, but it isn't the easiest way if the XML file is very complex (because you have to map its structure to a Java class).
XMLPullParser isn't really designed for complex tasks AFAIK. SAX Parser is much better for advanced tasks, but it's also not as easy to use.
For manipulating XMLs, you could use SAX Filters. Look at this tutorial (IBM tutorials are great!): http://www.ibm.com/developerworks/xml/library/x-tipsaxfilter/
I'm developing an application where I've requested data from an external institution's website. They have informed me that the data will be provided by OAI-PMH.
Could someone show me some sample code in Java how data is extracted from a OAI-PMH ?
I wonder how different it is from reading and parsing XML data.
Thank you.
Warmest wishes,
Shoubhik
For a Java implementation, for example, you could use some already existent library, like XOAI with an easy to use API. There are some provided samples.
To extract metadata from each Record you could use a XML Parser or a XML bind approach (JAXB). For other languages, like PHP and Perl there are also other alternatives.
I receive a java-script encoded page when I am doing the GET request for a search in Google api.
Now I need to extract the value of "unescapedUrl" and "titleNoFormatting" out of this.
Normally in C++ I would use search by word and then use pointers to get the next coming characters, but I have no idea what to do in java.
I receive a java-script encoded page when i am doing the GET request for a search in Google api.
This appears to be mostly JSON.
normally in c++ i would use search by word and then use pointers to get the next coming characters
If so, and if this is JSON output, then a C++ developer should use a JSON parsing library.
but i have no idea what to do in java.
Similarly, a Java developer should use a JSON parsing library. Android has the org.json parsing classes built in, and there is a separate JSONReader (based on GSON) in Android 3.x.
I would just like to have an Android XML UI file in Java. I have the XML file and I believe I need a parser that would actually generate the Java UI class file. Any ideas how to go about approaching this ?
EDIT: Well, let me explain this a little better. I am trying to track Google finance data for which I use gdata client library. However its authentication does not work in the Android environment, and so I am switching to Java SE. However, is there any library or something by which I can have the Android UI, without having to write my own parser. Need not necessarily be XML based.
You need to write your own parser and instantiate the Swing classes that are synonymous with the controls described in the XML.