Android Studio - XML Serialization and XML Validation against .xsd schema - android

I'm working with a Android App and XML.
By using Jaxb, I had java xml classes from a .xsd file.
I want to generate a xml file from these xml classes then validate against the .xsd file.
I found here an example:
http://www.mkyong.com/java/jaxb-hello-world-example/
But I cannot use javax.xml.bind.Marshaller:
Error:(76, 27) error: cannot access XMLEventWriter
class file for javax.xml.stream.XMLEventWriter not found
Then I add javax.xml.stream lib:
java.exe finished with non-zero exit value 1
I also posted a question about xml validation against xsd but till now I have not get any suggestion yet:
Android XML validation using XSD ( both xerces and SchemaFactory) error
Any suggestion for me?
Thanks,

Short answer:
XML Validation: xerces for android: https://code.google.com/p/xerces-for-android/source/checkout
XML Serialization: http://simple.sourceforge.net/
.xsd to java objects: Jaxb or Jibx
Is there a need in JAXB implementation for Android?

Related

Error binding JNA to Xamarin.Android Binding library

I am trying to bind JNA-3.0.9 jar to binding library as EmbeddedReferenceJar as it is required by one of the other JARs i am using.
I am facing the error binding a jna-3.0.9 jar file. The error message is :
Error CS0121 The call is ambiguous between the following methods or properties: 'IFromNativeConverter.NativeType()' and 'IToNativeConverter.NativeType()' EDCBinding1 ****\obj\Debug\generated\src\Com.Sun.Jna.ITypeConverter.cs 108 Active
Is it really required to bind JNA jar seperately? or is it already part of Microsoft OpenJDK?
Any help is much appreciated.

Any library to read mdict *.MDX files in android?

I have a .mdx file that infact is a dictionary database (some android apps like bluedict can read its data).
I have used Daemon.tools but it could not open it.
I was looking for any library or sources which helps me to read MDX dictionary files in Java, I have found some resources already such as KnIfER/mdict-java but it does not work in Android Studio (it has errors on accumulation_blockId_tree.xxing(new myCpr(position,1)).getKey().value line and it is connot resolve symbol 'value'). Does any one knows a good source about these files and possible libraries which could be used for it?.
Well, actually this is my java project.
the error mentioned is just a problem of jdk version. you can add <> parentheses after myCpr and convert return of xxing to type myCpr<Integer,Integer> .
But now, I have very much reduced usage of rbtree and use more binary list searching.have a look there.

Qt- Adding custom XML from Android resource

I'm developing application with Qt Creator. I just want use layout for specific Dialog.I created XML, but how to add this XML to project?
I added this xml on main_activity's directory (myApplication\android-source\res\layout)
but when I try to compile, I get this error after creating this:
BUILD FAILED
D:\1ADDDT\android-sdk2\android-sdk2\tools\ant\build.xml:716: The following error occurred while executing this line:
D:\1ADDDT\android-sdk2\android-sdk2\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
And I Should I add this XML to resource (.qrc) or what?
Here is my build.xml:
Use tools:context as one of attribute and set it to .MainActivity .

First Android Project Errors

I'v just started building my first Android project with eclipse, according to Lynda's course Up and Running with PhoneGap.
When i try to run the project (like the demonstration on Lynda), i get the following error message:
"your project contains error(s), please fix them befor running your application."
Description Resource Path Location Type
error: Error: No resource found that matches the given name (at 'label' with value
'#string/app_name'). AndroidManifest.xml /android_project line 49
Android AAPT Problem error: Error: No resource found that matches the given name (at 'label'
with value '#string/app_name'). AndroidManifest.xml /android_project line 52 Android
AAPT Problem
The import org.apache.cordova cannot be resolved android_project.java
/android_project/src/com/example/android line 23 Java Problem
DroidGap cannot be resolved to a type android_project.java
/android_project/src/com/example/android line 25 Java Problem
The method onCreate(Bundle) of type android_project must override or implement a supertype
method android_project.java /android_project/src/com/example/android line 28 Java
Problem DroidGap cannot be resolved to a type android_project.java
android_project/src/com/example/android line 30 Java Problem
Config cannot be resolved android_project.java /android_project/src/com/example/android
line 32 Java Problem
Attached the error screenshot
I can guess what some of the error messages means, but i don't know how to solve them.
Any suggestion?
I'm using windows 8.
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
Thanks,
Liron
Check your strings.xml inside your project>res>values and add the string values you are going to use in your project.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="app_name">AppName</string>
</resources>
Plus, I think you need to update your .jar file of cordova.
You can download it from the phonegap github repo.
You can find the lib in the lib/android/ folder.
To create a new project, you can use the lilb/andoird/bin/create.bat file.
Don't forget to clean the project.
Hope this helps you.
I think You forgot to set the string values. I haven´t read that tutorial, but there are some strings missin. Check the tutorial, You have to set some strings inside strings.xml in Your res/values folder
EDIT
go to folder inside Your project "res/values" and open strings.xml. Then begin a new line and put
<string name="example_string">This is an example!</string>
The first part "example_string" is the name of the string. This is to refer to this for example inside an xml layout. imagine You have a button in any xml layout:
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/example_button"
android:text="#string/example_string"/> <-- here you refer to that string inside strings.xml
The second part "This is an example" is what will be appear on that button.
But I think it would be better if You learn the basics instead of starting with PhoneGap.
http://developer.android.com/training/basics/firstapp/index.html

Add language resources in android apk application

Well I have a single language android application that I translated strings in res/values/strings.xml to make it multi language application. I made for instance values-fr/strings.xml, values-es/strings.xml ...
When compiling my application, I get this error
mayapp/res/values-fr/strings.xml:1: error: Error parsing XML: XML declaration not well-formed
mayapp/res/values-es/strings.xml:1: error: Error parsing XML: XML declaration not well-formed
How to solve this problem.
I need your help since I'am new in android development.
use numerical code for special character:
<string name="app_name">Répondeur</string>

Categories

Resources