Javascript, schema and objects

Hi all,

I am building some AJAX components and I was wondering if it is possible using a tool to generate objects in Java from the XML and the schema. I can use the MSXML but then it will be only available on windows. Please if you have any suggestions or websites with relevant info please post them.

Thank you all

Adam

[345 byte] By [d_dallis_gra] at [2007-10-3 3:57:06]
# 1

i think what you are looking for is JAXB

you use it to create class files of the schemas and when passing an xml message to it can validate the message at the object level. Jaxb allow you to create objects from the xml you pass or to create an xml from the object that you set the values.

read more here:

http://java.sun.com/webservices/jaxb/

https://jaxb.dev.java.net/

http://www.xml.com/pub/a/2003/01/08/jaxb-api.html

I hope this helps

discussjava.com_a at 2007-7-14 21:55:26 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Thank you for taking time to answer my question.JAXB is good but I am looking something on client side and not on server side.BEst regards Adam
d_dallis_gra at 2007-7-14 21:55:26 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Adam,What kind of client you app have?You can use JAXB on Java Clients !Message was edited by: Rulas
Rulasa at 2007-7-14 21:55:26 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
I will be using AJAX. So HTML and javascript are my basic clients.
d_dallis_gra at 2007-7-14 21:55:26 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

On my Javascript I get a DOM XML Document in a portable way:

function createXmlDOM(xml) {

var xmlDoc;

if (window.ActiveXObject) {

xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

xmlDoc.async = false;

// IE uses the loadXML method when the source document is NOT XML

xmlDoc.loadXML(vHttpRequest.responseText);

}

else if (document.implementation.createDocument) {

// Firefox requires a parser object to read the text

var parser = new DOMParser();

xmlDoc = parser.parseFromString(xml, "text/xml");

}

else {

window.alert("Objecto XML DOM no pudo ser creado.");

}

return xmlDoc;

};

Rulasa at 2007-7-14 21:55:26 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6

On my Javascript I get a DOM XML Document in a portable way:

function createXmlDOM(xml) {

var xmlDoc;

if (window.ActiveXObject) {

xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

xmlDoc.async = false;

// IE uses the loadXML method when the source document is NOT XML

xmlDoc.loadXML(vHttpRequest.responseText);

}

else if (document.implementation.createDocument) {

// Firefox requires a parser object to read the text

var parser = new DOMParser();

xmlDoc = parser.parseFromString(xml, "text/xml");

}

else {

window.alert("Objecto XML DOM no pudo ser creado.");

}

return xmlDoc;

};

Rulasa at 2007-7-14 21:55:26 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...