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
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
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 >

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 >
