You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by SK...@datacom-usa.com on 2004/10/06 16:18:22 UTC

how to bind the xml with java classes

hi,

    i am new to the xml beans. 
    Today i created one schema file(Xsd file name is a.xsd)
    i used the following command ::::          scomb -src work a.xsd
    it created one jar file  xmltypes.jar(executable jar file) and created 
lot of java files
    which i have given as a (-src work) source.

now i would like to bind the xml to these classes
i mean to load the xml into these classes...
and i want to load these objects into the database..........

how can i proceed...could you explain how i can do this?

thanks,
suresh.

Re: how to bind the xml with java classes

Posted by Rashmi Banthia <rj...@gmail.com>.
This article should help you to start with -
http://www.onjava.com/pub/a/onjava/2004/07/28/XMLBeans.html

also others at http://xmlbeans.apache.org/resources/index.html


-Rashmi


On Wed, 6 Oct 2004 10:18:22 -0400, skumar@datacom-usa.com
<sk...@datacom-usa.com> wrote:
>  
> hi, 
>  
>     i am new to the xml beans. 
>     Today i created one schema file(Xsd file name is a.xsd) 
>     i used the following command ::::          scomb -src work a.xsd 
>     it created one jar file  xmltypes.jar(executable jar file) and created
> lot of java files 
>     which i have given as a (-src work) source. 
>  
> now i would like to bind the xml to these classes 
> i mean to load the xml into these classes... 
> and i want to load these objects into the database.......... 
>  
> how can i proceed...could you explain how i can do this? 
>  
> thanks, 
> suresh. 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: how to bind the xml with java classes

Posted by Philip DONAGHY <Ph...@thales-is.com>.
Hi Suresh,

I've been doing this for months, only my database has a specific schema
that implements temporality and traceablitity. Two very big words that
mean versioning every table in the database so that a history can be
acquired at any moment in time.

If you have a simple schema you can do what you want by using Ojb.

Launch the tool reversedb.

- Start the Ojb Reverse DB tool using the main class
org.apache.ojb.tools.mapping.reversedb.Main which requires the following
jars
	* lib/db-ojb-1.0.0-tools.jar
	* lib/jakarta-regexp-1.3.jar
	* lib/ojdbc14.jar
	* Click on "Connect to Database" and enter the following parameters
		- Set "JDBC Driver Class" to "oracle.jdbc.driver.OracleDriver"
		- Set "JDBC URL" to
"jdbc:oracle:thin:aip/aip@142.3.22.156:1529:finaixm" or
"jdbc:oracle:thin:@142.3.22.156:1526:AIP"
		- Set "Username" to "aip" or "aiptest"
		- Set "Password" to "aip" or "aiptest"
		- Or another variant of the above
	* Click on "Read"
		- Enter nothing in the first dialog and click "OK" (a regular
expresion defining all catalogs to be read)
		- Enter "AIP" or "AIPTEST" in the second dialog and click "OK" (a
regular expresion defining all schemas to be read)
		- Wait for the results (2-3 minutes depending on client machine and
database size, performance)
	* Click on "Enter package"
		- Enter "db.finaixm"
	* Click on "Save XML"
		- Save file to etc-generator/finaixm-db.xml
	* Click on "Generate Java"
		- Generate Java in src-generated/finaixm-db
	* Generate finaixm-db.jar
		- Generate the Jar using the command "ant finaixm-db-jar"

I took this from some documentation I had for another project so you may
have to change some names and use your JDBC jar.

After the last step is to recurively copy the XMLBeans to your Ojb
Generated beans using a tool like commons-jexl, commons-beanutils, XSLT.

It helps alot if your xml names are the same as your database names.

Phil

SKumar@datacom-usa.com a écrit :
> 
> hi,
> 
>     i am new to the xml beans.
>     Today i created one schema file(Xsd file name is a.xsd)
>     i used the following command ::::          scomb -src work a.xsd
>     it created one jar file  xmltypes.jar(executable jar file) and
> created lot of java files
>     which i have given as a (-src work) source.
> 
> now i would like to bind the xml to these classes
> i mean to load the xml into these classes...
> and i want to load these objects into the database..........
> 
> how can i proceed...could you explain how i can do this?
> 
> thanks,
> suresh.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org