xml to java objects using jibx - java

I have a huge xml file. I need to convert the xml into java objects and persist the data in Database. It will be around 200k records. Planning to use jibx. Is it a right approach? If so can someone provide the steps to convert xml file to java objects and persist in database

I just finish a project to convert a huge Xml file. I use trang ( http://www.thaiopensource.com/download/ ) to generate an XSD file from the XML File. Then i use xjc on the xsd file to generate POJO objects then I use JAXB to load the xml file into memory then Hibernate to create the database and store the POJOs.

Related

Create Java stub from Hibernate ORM file

Is there any jar which which will help me to create Java files from an existing hibernate orm-xml file?
Like we have an avro utility to convert (avsc) to .java files.
We have orm files and want to move toward Entity classes with annotations rather than using the orm files.
I tried converting xml- xsd and then using jaxb over it but failed.
JPA has no generator, there is no way of doing this.
It is never a good idea to mix data transfer objects (DTOs) together.
Your SOAP XML generated classes should only be used for the external API (SOAP DTOs).
Your application model should manage the persistence separately (JPA DTOs).
Doing it this way allows you to later change the API and the application model independently of each other.
It also allows you to easily add another API, e.g. REST and use REST DTOs for that (typically JSON).

Is there any way to insert xml file data into cassandra?

IS there any way to insert xml file data into cassandra ?
say XML file having lot of data , file size- 5MB.
Is there already available utility or Do i have to write some kind JAVA parser?
FYI, I am using cassandra 2.1.
what are option i have got ?
Either you can use COPY...FROM Command Simple data importing and exporting with Cassandra
or use Cassandra Bulk Loader Using the Cassandra Bulk Loader
.
For second one you need to do some like JAVA parser.
For large data file, I suggest you to go with Cassandra bulk loader.

XML to database with Hibernate

I have given a XML file. I want to store a subset of the content of this file in a relational database.
I could use a framework like JAXB to convert the content of the xml file into Java POJOs and write them to database (e.g. with Hibernate).
But is there a built-in opportunity in Hibernate to do this without using a additional framework like JAXB?
Thanks for your help!!
As far as I remember, there was an XML mapping feature in Hibernate 3:
https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/xml.html
However this feature was noted as "experimental". And I don't see it in Hibernate 4 or 5:
https://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/
http://docs.jboss.org/hibernate/orm/5.0/userGuide/en-US/html_single/

How to insert data from xml document to postgresql?

I have a table in PosgreSQL.
I have an xml schema.
I want to create an xml document with this schema and data from Postgre.
What should I read to work with xsd in java? And what are the best tools to use?
UPDATE
More specific question. Can i create data base in PostgreSql using xml schema?
UPDATE 2
Okey. I create data base from .xsd using XMLSpy.
Now i need load xml document in this data base. What i gonna do?
UPDATE 3
Okay. I generate java classes using JiBX.
Now i want to read xml file and write data from this to data base. What i gonna do?
Probably best to generate java classes for the XML from the XSD, you can read about it here:
Generate Java classes from .XSD files...?
I dont know anything about the postgreSql, but i will suggest you to generate java classes from your Xsd using jaxb and use those classes as domain for your db.
yes, the best way to accomplish the above task would be to generate java class and populate your respective beans.
From there on you can insert your values of beans to the respective tables in posgresql

Validate XML Schema in Android

I need to validate some xml files in the resources of an Android application against an XML Schema. Although there is an available API to create instances of SchemaFactory, there seems to be no implementation for XML Schema, as stated by the answers to these questions: 1, 2 and 3.
Are there any good and lightweight libraries to provide that functionality in the Android platform?
Try Lycia. Its around 270 kb. Here is nice step by step example for schema validation. It creates a schema, a small XML referring to schema (via schemaLocation) and then an example to parse the xml with schema validation

Categories

Resources