Xsd to java code?

Hi all, just wondering if anybody knew any code generating frameworks that generated java code to help in parsing an xml file with a given xsd validation file. Much the same way jakarta turbine does for sql?
thanks,
Jon

try {
     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     dbf.setNamespaceAware(true);
     dbf.setValidating(true);
     dbf.setAttribute(
          "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
          "http://www.w3.org/2001/XMLSchema");
     dbf.setAttribute(
          "http://java.sun.com/xml/jaxp/properties/schemaSource",
          YourSchemaFile.xsd);
     DocumentBuilder db = dbf.newDocumentBuilder();
     Document doc = db.parse("http://www.wombats.com/foo.xml");
} catch(DOMException de) {
     de.printStackTrace();

Similar Messages

  • How to modify an existing xml file from java code.

    Hi
    I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
    For example if xml file(studlist.xml) is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    Now suppose i have set name to victor using student.setName,
    and set age to 20 using setAge from javacode,
    the new xml file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    <Student>
              <Name>victor</Name>
              <Age>20</Age>
         </Student>
    As observed this is not a valid xml file.But how can i modify without any errors?

    I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
    Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
    What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
    // gets the root element of the specified file (code not shown)
    Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
    // write a new student element
    Element student = document.createElement("Student");  // creates the new student
    rootElement.appendChild(student); // ***appends it to the root element***
    Element name = document.createElement("Name"); // creates the name element
    name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
    student.appendChild(name); // appends the name to the student
    Element age= document.createElement("Age"); // creates the age element
    age.appendChild(document.createTextNode("26")); // adds the age text to the age element
    student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
    Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM

  • Unable to transform XML with XSL in java code

    Hi,
    Could somebody please tell me what's wrong with my code, why it isn't transform the XML with XSL to the output that I want. If I use the command line to transform the XML, it output perfectly:
    java org.apache.xalan.xslt.Process -in marc.xml -xsl MARC21slim2MODS.xsl -out out.xml
    Here is the code of my program to transform the XML with XSL, I am using xalan-j_2_2-bin:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import org.w3c.dom.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.dom.*;
    import java.math.BigInteger;
    String xslDoc = "MODS.xsl";
    String xmlResult = "out.xml";
    DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
    dfactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
    Document xmlDoc = docBuilder.newDocument();
    Element root = xmlDoc.createElement("collection");
    root.setAttribute("xmlns", "http://www.loc.gov/MARC21/slim");
    xmlDoc.appendChild(root);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(new StreamSource(xslDoc));
    FileWriter fw = new FileWriter(new File(xmlResult));
    StreamResult output = new StreamResult(fw);
    transformer.transform(new DOMSource(xmlDoc), output);
    fw.flush();
    fw.close();
    ========================
    marc.xml -- source XML file
    ========================
    <?xml version="1.0" encoding="UTF-8"?>
    <collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01488cam 2200337 a 4500</leader><controlfield tag="001">2502929</controlfield><controlfield tag="005">19930521155141.9</controlfield><controlfield tag="008">920219s1993 caua j 000 0 eng </controlfield><datafield ind1=" " ind2=" " tag="035"><subfield code="9">(DLC) 92005291</subfield></datafield><datafield ind1=" " ind2=" " tag="906"><subfield code="a">7</subfield><subfield code="b">cbc</subfield><subfield code="c">orignew</subfield><subfield code="d">1</subfield><subfield code="e">ocip</subfield><subfield code="f">19</subfield><subfield code="g">y-gencatlg</subfield></datafield>
    </record></collection>
    ========================
    out.xml -- result using command line
    ========================
    <?xml version="1.0" encoding="UTF-8"?>
    <collection xmlns="http://www.loc.gov/mods/" xmlns:xlink="http://www.w3.org/TR/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/ http://www.loc.gov/standards/marcxml/schema/mods.xsd">
    <mods>
    <titleInfo>
    <title>Arithmetic</title>
    </titleInfo>
    <name type="personal">
    <namePart>Sandburg, Carl</namePart>
    <namePart type="date">1878-1967</namePart>
    <role>creator</role>
    </name>
    </mods>
    </collection>
    ========================
    out.xml -- result using my java program
    ========================
    <?xml version="1.0" encoding="UTF-8"?>
    <collection xmlns="http://www.loc.gov/mods/" xmlns:xlink="http://www.w3.org/TR/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/ http://www.loc.gov/standards/marcxml/schema/mods.xsd">01488cam 2200337 a 4500250292919930521155141.9920219s1993 caua j 000 0 eng (DLC) 920052917cbcorignew1ocip19y-gencatlgpc16 to br00 02-19-92; br02 to SCD 02-21-92; fd11 02-24-92 (PS3537.A618 A...); fa00 02-26-92; fa05 03-02-92; fm31 03-06-92; CIP ver. pv08 04-16-93; pv01 to CLT 04-20-93; lb10 05-21-93
    </collection>

    I am using the same XSL file. My Java program use the same XSL file I used in the command line.
    It is possible that my Java code is using a different parser, but I developed a seperate program to parse the XML using the same parser that my Java code is using. It output the result I expected. Here is the code for the program:
    import java.io.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    public class Convertor {
    public static void main(String[] args) throws Exception {
    String xslDoc = "MARC21slim2MODS.xsl";
    String xmlResult = "out.xml";
    String xmlDoc = marc.xml";
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(new StreamSource(xslDoc));
    StreamSource xmlSource = new StreamSource(xmlDoc);
    FileWriter fw = new FileWriter(new File(xmlResult));
    StreamResult output = new StreamResult(fw);
    transformer.transform(xmlSource, output);
    }

  • Hi I need this asap... "Java code to generate XML File from XML Schema"

    Hi all....
    I need this asap... "Java code to generate XML File from XML Schema i.e XML Schema Definition, XSD file".
    Thankz in advance...
    PS: I already posted in the afternoon... this is the second posting.

    take look at :
    http://sourceforge.net/projects/jaxme/
    this might help...

  • Java code to generate XML File from XML Schema

    Hi I need this asap... "Java code to generate XML File from XML Schema i.e XML Schema Definition, XSD file".
    Thankz in advance...

    JAXB has been available as an early release download for some time. There are also XML Binding packages available from Borland (JBuilder) and Castor. These tools create Java classes from a source document, xml,dtd etc. You can use these classes to marshal-unmarshal XML documents.
    Dave

  • Specifying Schema Location in XML file and not in the Java code

    I have a repository of schema xsd files. When I receive my xml file, I need to validate it against the specified schema. The xml file would declare the schema location, using the following syntax:
    <CERD:CERD xsi:schemaLocation = "..\CERD.xsd" xmlns:CERD = "CERD.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
    Is it really necessary to define the schema location again in the JAVA code? Why set the schemaLocation in the xml file at all then?
    Does anybody have any examples where the schema location is not set in the JAVA code? I am using Java 1.6, and at this point in time I only need to validate. Any help would be appreciated.

    Thank you very much for your quick reply. I have made some progress but I am still stumped.
    In my code I am doing this:
    SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema = factory.newSchema();
    Validator validator = schema.newValidator();
    validator.validate(XML_SOURCE);
    I find this works if my schema does not have a target namespace. I have downloaded the following simple example from the internet that uses a target namespace and it fails:
    library1.xsd:
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://example.org/prod"
    xmlns:prod="http://example.org/prod">
    <xsd:element name="product" type="prod:ProductType"/>
    <xsd:complexType name="ProductType">
    <xsd:sequence>
    <xsd:element name="number" type="xsd:integer"/>
    <xsd:element name="size" type="prod:SizeType"/>
    </xsd:sequence>
    <xsd:attribute name="effDate" type="xsd:date"/>
    </xsd:complexType>
    <xsd:simpleType name="SizeType">
    <xsd:restriction base="xsd:integer">
    <xsd:minInclusive value="2"/>
    <xsd:maxInclusive value="18"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:schema>
    <prod:product xmlns:prod="http://example.org/prod"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="library1.xsd"
    effDate="2001-04-02">
    <number>557</number>
    <size>10</size>
    </prod:product>
    I get the following SAXParseException when I validate:
    [line 4, col 36|
    cvc-elt.1: Cannot find the declaration of element 'prod:product'.
    Am I doing something wrong with the namespace declaration?
    Edited by: alfredamorrissey on Oct 31, 2007 6:34 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • OIM should send spmlv2 requests via java code to service provider

    Hi,
    We have the situation in which OIM acts as Requesting authority,Spml provider acts as service provider.
    Oim should send spml requests from custom java code.Spml2Client is used.We are not using genericc technology connector.
    Require sample java code for Search operation.
    I had done for modify request.
    The request and response is as follows
    PSO ID returned after searching: org.openspml.v2.msg.spml.PSOIdentifier@5c32a864
    <deleteRequest xmlns='urn:oasis:names:tc:SPML:2:0' recursive='false'/>
    <deleteResponse xmlns='urn:oasis:names:tc:SPML:2:0' status='success'/>
    <modifyRequest xmlns='urn:oasis:names:tc:SPML:2:0' returnData='identifier'>
    <psoID ID='cn=TPS User8,ou=TPS,dc=fosterstechodc,dc=com'/>
    <modification modificationMode='replace'>
    <data>
    <dsml:modification xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' name='otherHomePhone' operation='replace'>
    <dsml:value>999999</dsml:value>
    </dsml:modification>
    </data>
    </modification>
    <modification modificationMode='delete'>
    <data>
    <dsml:modification xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' name='description' operation='delete'>
    </dsml:modification>
    </data>
    </modification>
    <modification modificationMode='add'>
    <data>
    <dsml:modification xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' name='firstname' operation='add'>
    <dsml:value>Barbara</dsml:value>
    </dsml:modification>
    </data>
    </modification>
    </modifyRequest>
    SpmlClient: sending to http://10.101.151.209/ARServerSPML/SPMLProvider.asmx
    <modifyRequest xmlns='urn:oasis:names:tc:SPML:2:0' returnData='identifier'>
    <psoID ID='cn=TPS User8,ou=TPS,dc=fosterstechodc,dc=com'/>
    <modification modificationMode='replace'>
    <data>
    <dsml:modification xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' name='otherHomePhone' operation='replace'>
    <dsml:value>999999</dsml:value>
    </dsml:modification>
    </data>
    </modification>
    <modification modificationMode='delete'>
    <data>
    <dsml:modification xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' name='description' operation='delete'>
    </dsml:modification>
    </data>
    </modification>
    <modification modificationMode='add'>
    <data>
    <dsml:modification xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' name='firstname' operation='add'>
    <dsml:value>Barbara</dsml:value>
    </dsml:modification>
    </data>
    </modification>
    </modifyRequest>
    SpmlClient: received
    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><modifyResponse status="failure" xmlns="urn:oasis:names:tc:SPML:2:0"><error>malformedRequest</error><errorMessage>At least one &lt;modification&gt; element must be specified.</errorMessage></modifyResponse></soap:Body></soap:Envelope>
    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><modifyResponse status="failure" xmlns="urn:oasis:names:tc:SPML:2:0"><error>malformedRequest</error><errorMessage>At least one &lt;modification&gt; element must be specified.</errorMessage></modifyResponse></soap:Body></soap:Envelope>
    org.openspml.v2.util.Spml2ExceptionWithResponse: At least one <modification
    The response says the modifaction tag is not present.
    The code for this request is
    Modification[] modifications =
                   { newModWithDSMLMod("otherHomePhone", "999999", ModificationMode.REPLACE),
                             newModWithDSMLMod("description", null, ModificationMode.DELETE),
                             newModWithDSMLMod("cn", "Barbara", ModificationMode.REPLACE)};
                   modifyResp = customSPMLClient.modifyUser(client,searchPSOId,modifications);
    method:
    public ModifyResponse modifyUser(Spml2Client client,PSOIdentifier psoId,Modification[] modifications) throws Exception {
              client.setTrace(true);
              ReflectiveXMLMarshaller marshaller = new ReflectiveXMLMarshaller();
              ModifyRequest modReq = new ModifyRequest(null, // String requestId,
                        null, // ExecutionMode executionMode,
                        psoId, // PSOIdentifier psoID
                        modifications, // Modification[] modifications
                        ReturnData.IDENTIFIER // ReturnData returnData
              System.out.println(modReq.toXML(marshaller));
              ModifyResponse modResp = (ModifyResponse) client.send(modReq);
              System.out.println(modResp.toXML(marshaller));
              return modResp;
    private static Modification newModWithDSMLMod(String modName, String modValue, ModificationMode modMode)
         throws DSMLProfileException
              /*DSMLModification dsmlMod = null;
              dsmlMod = new DSMLModification(modName, modValue, modMode);
              Extensible data = new Extensible();
              data.addOpenContentElement(dsmlMod);
              Selection component = null;
              return new Modification(component, data, null, modMode);
    Please help me out.
    I need sample java code for search operation tooo.
    regards,
    Sindhu.M

    the sample JAVA codes are provided for sending SPML requests, HTTPClient and one more (i dont remember rite now) within the OIM installation folders itself. It's in the 'SampleHttpClient' folder. Check it once. WSDL, sample XML's and the JAVA codes all are there. You just need to set the classpath and run it.
    - oidm.

  • Dynamic Java bean classes for XSD using JAVA (not any external batch or sh)

    Hi,
    How can we generate dynamic Java bean classes for XSD (dynamically support All XSD at runtime)?
    Note: - Through java code via only needs to generate this process. (Not using any xjc.bat or xjc.sh from JAXB).
    Thanks

    Muthu wrote:
    How can we generate dynamic Java bean classes for XSD (dynamically support All XSD at runtime)?
    Pretty sure you can't. Probably can do a lot of them with years of work.
    And can probably can do a resonable subset suitable for the business at hand with only a moderate effort.
    Note: - Through java code via only needs to generate this process. (Not using any xjc.bat or xjc.sh from JAXB).The Sun jdk, not jre, comes with the java compiler as part of it. You can create in memory class (I believe in memory) based on java code you create.
    I believe BCEL alllows the same thing (in memory) but you start with byte codes.
    You could just create a dynamic meta data solution as well, via maps and generic methods. Not as fast though.

  • Split XML in Multiple XML files with Java Code

    Hi guys , i have following xml file as input ....
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <T0020
    xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1">
    <INTERFACE>
    <NAME>SAFER</NAME>
    <VERSION>04.02</VERSION>
    </INTERFACE>
    <TRANSACTION>
    <VERSION>01.00</VERSION>
    <OPERATION>REPLACE</OPERATION>
    <DATE_TIME>2009-09-01T00:00:00</DATE_TIME>
    <TZ>CT</TZ>
    </TRANSACTION>
    <IRP_ACCOUNT>
    <IRP_CARRIER_ID_NUMBER>274845</IRP_CARRIER_ID_NUMBER>
    <IRP_BASE_COUNTRY>US</IRP_BASE_COUNTRY>
    <IRP_BASE_STATE>AR</IRP_BASE_STATE>
    <IRP_ACCOUNT_NUMBER>55002</IRP_ACCOUNT_NUMBER>
    <IRP_ACCOUNT_TYPE>I</IRP_ACCOUNT_TYPE>
    <IRP_STATUS_CODE>100</IRP_STATUS_CODE>
    <IRP_STATUS_DATE>2007-11-06</IRP_STATUS_DATE>
    <IRP_UPDATE_DATE>2009-08-03</IRP_UPDATE_DATE>
    <IRP_NAME>
    <NAME_TYPE>LG</NAME_TYPE>
    <NAME>A P SUPPLY CO</NAME>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>PH</ADDRESS_TYPE>
    <STREET_LINE_1>1400 N OATS</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>71854</ZIP_CODE>
    <COUNTY>MILLER</COUNTY>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    <IRP_ADDRESS>
    <ADDRESS_TYPE>MA</ADDRESS_TYPE>
    <STREET_LINE_1>P O BOX 1927</STREET_LINE_1>
    <STREET_LINE_2/>
    <CITY>TEXARKANA</CITY>
    <STATE>AR</STATE>
    <ZIP_CODE>75504</ZIP_CODE>
    <COUNTY/>
    <COLONIA/>
    <COUNTRY>US</COUNTRY>
    </IRP_ADDRESS>
    </IRP_NAME>
    </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    and i want to take this xml file and split it into multiple files through java code like this ...
    File1.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    File2.xml
    <T0020>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    <IRP_ACCOUNT> ..... </IRP_ACCOUNT>
    </T0020>
    like wise...
    Each xml file contain maximum 10 or 15 IRP_ACCOUNT.
    Can somebody please help me ? How can i do it with stax like start element and all ?
    thanks in advance.

    Ah, sorry, strike that. You want multiple files. I think the easiest way is to simply parse with DOM. [http://www.w3schools.com/xpath/default.asp] . And here [http://www.w3schools.com/xpath/default.asp].
    You can output the various XML elements using a PrintWriter or creating a separate DOM document for each file you want to create and serializing that.
    - Saish

  • Generate XSD from java class

    Hi all,
    Is there any tool that can generate an XSD from either a java code file or a byte code file?
    Thanks in advance,
    Asaf

    I've never used it, but the Castor project also provides such a tool...at least that what it says in its FAQ:
    http://www.castor.org/xml-faq.html#Is-there-a-way-to-automatically-create-an-XML-Schema-from-an-XML-instance?

  • Preventing JAXB xjc from re-generating java code of import ed schemas...

    Hi, I am using XJC to generate java code from xsd.
    However the xsd I run it on often has imports to another xsd that will be in a jar along with its java classes already existing.
    This jar is on the calsspath too.
    XJC however not only generates java code for existing xsd, but also for every import it has.
    And also for every import each of those imported xsd's might have.
    So if it were a long import chain A->B->C->D it generates code for all.
    How can i get it to generate code for only A and assume all the remaing code can be found on the jars in the classpath.
    The A.xsd also has a catalog file associated with it that has every namespace reference pointing to the correct xsd locations within jars.
    So it even has B->C mapping and C->D mapping. This was needed or else XJC didnt even generate anything at all and complained it could not reach C from B and so on.
    Catalog file solved that problem but not the fact that it keeps regnerating code.
    Thanks
    Edited by: Priyajeet on Dec 9, 2008 1:36 PM

    Problem solved.
    The xjc compiler reads file name in a case-sensitive fashion, even on windows.
    So, common.xsd and Common.xsd are seen as two distinct files.
    This was the cause of the compilation errors, since feature1 imported the schema using the filename Common.xsd, whereas the other schemas imported common using common.xsd
    I hope this could help.
    Salvatore

  • Invalid Java code from oracg

    I'm having a problem with oracg generating invalid Java code using XDK for Java 9.2.0.5.0 on Solaris 8.
    Specifically, oracg generates invalid Type names for elements that have both attributes and complexTypes; at least, that's where I'm having problems with it.
    I've included my test case in this posting. I have defined the following structure in test.xsd:
    <test lang="en">
    <table border="0">
    <tr>
    <td>blah</td>
    </tr>
    </table>
    </test>
    Then, oracg generates an add method for TestType as:
    public void addTable(TestType.Lang.Table thetable)
    It doesn't seem to realize that Lang is an attribute, and
    it puts it in the type path. This happens throughout the TestType.java file.
    Please advise.
    Thanks,
    -Darren
    P.S. I'm using "oracle-xdk-9.2.0.5.0/bin/oracg -schema test.xsd -outputDir src -package test"
    ========
    test.xsd
    ========
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace="http://xmlns/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns/test" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
    <xs:complexType name="testType" mixed="false">
    <xs:choice maxOccurs="unbounded">
    <xs:element name="table" nillable="false">
    <xs:complexType mixed="false">
    <xs:sequence maxOccurs="unbounded">
    <xs:element name="tr" nillable="false">
    <xs:complexType mixed="false">
    <xs:sequence maxOccurs="unbounded">
    <xs:element name="td" nillable="true"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="border" type="xs:nonNegativeInteger" use="optional" default="1"/>
    <xs:attribute name="cellspacing" type="xs:nonNegativeInteger" use="optional" default="2"/>
    <xs:attribute name="cellpadding" type="xs:nonNegativeInteger" use="optional" default="2"/>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    <xs:attribute name="lang" use="optional" default="en">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:minLength value="1"/>
    <xs:maxLength value="10"/>
    <xs:enumeration value="en"/>
    <xs:enumeration value="es"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:complexType>
    <xs:element name="test" type="testType" nillable="false"/>
    </xs:schema>
    =============
    TestType.java
    =============
    /* DO NOT EDIT THIS FILE - it is machine-generated */
    /* File: TestType.java - generated by XML Class Generator version 2.0.0 at Mon Jun 30 13:26:33 PDT 2003 */
    package test.types;
    import oracle.xml.parser.schema.*;
    import oracle.xml.parser.v2.*;
    import oracle.xml.classgen.CGXSDElement;
    import oracle.xml.classgen.InvalidContentException;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class TestType extends CGXSDElement
    static final String name = "testType";
    static final String namespace = "http://xmlns/test";
    protected TestType.Lang alang;
    public void setLang(TestType.Lang thelang)
    throws IllegalArgumentException
    this.alang = thelang;
    super.addAttribute("lang" , thelang.getNodeValue());
    public static class Lang extends CGXSDElement
    public Lang(XSDDataValue elemValue)
    throws InvalidContentException
    try
    Hashtable h = XSDSimpleType.getBuiltInDatatypes();
    XSDSimpleType baseType = (XSDSimpleType)h.get("string");
    type = XSDSimpleType.derivedFrom(baseType,"string", " ");
    XSDSimpleType stype = (XSDSimpleType)type;
    stype.setFacet("maxLength","10");
    stype.setFacet("minLength","1");
    stype.setFacet("enumeration","en");
    stype.setFacet("enumeration","es");
    String nodeValue = elemValue.getLexicalValue();
    stype.validateValue(nodeValue);
    super.setNodeValue(nodeValue);
    catch (Exception e)
    throw new InvalidContentException("Error: Invalid value.");
    public Lang(String value)
    throws InvalidContentException
    try
    Hashtable h = XSDSimpleType.getBuiltInDatatypes();
    XSDSimpleType baseType = (XSDSimpleType)h.get("string");
    type = XSDSimpleType.derivedFrom(baseType,"string", " ");
    XSDSimpleType stype = (XSDSimpleType)type;
    stype.setFacet("maxLength","10");
    stype.setFacet("minLength","1");
    stype.setFacet("enumeration","en");
    stype.setFacet("enumeration","es");
    stype.validateValue(value);
    super.setNodeValue(value);
    catch (Exception e)
    throw new InvalidContentException("Error: Invalid value.");
    public void addTable(TestType.Lang.Table thetable)
    throws InvalidContentException
    super.addElement(thetable);
    public static class Table extends CGXSDElement
    static final String name = "table";
    static final String namespace = "http://xmlns/test";
    public Table()
    super();
    public void setType(TestType.Lang.Table.Table_Type elemtype)
    throws IllegalArgumentException
    this.type = elemtype;
    public void print(XMLOutputStream out)
    throws IOException
    super.printAttributes(out, name, namespace);
    public static class Table_Type extends CGXSDElement
    static final String name = "Table_Type";
    static final String namespace = "http://xmlns/test";
    protected Integer aborder;
    protected Integer acellspacing;
    protected Integer acellpadding;
    public void setBorder(Integer theborder)
    throws IllegalArgumentException
    this.aborder = theborder;
    super.addAttribute("border" , theborder);
    public Integer getBorder()
    throws IllegalArgumentException
    return this.aborder;
    public void setCellspacing(Integer thecellspacing)
    throws IllegalArgumentException
    this.acellspacing = thecellspacing;
    super.addAttribute("cellspacing" , thecellspacing);
    public Integer getCellspacing()
    throws IllegalArgumentException
    return this.acellspacing;
    public void setCellpadding(Integer thecellpadding)
    throws IllegalArgumentException
    this.acellpadding = thecellpadding;
    super.addAttribute("cellpadding" , thecellpadding);
    public Integer getCellpadding()
    throws IllegalArgumentException
    return this.acellpadding;
    public void addTr(TestType.Lang.Table.Table_Type.Tr thetr)
    throws InvalidContentException
    super.addElement(thetr);
    public static class Tr extends CGXSDElement
    static final String name = "tr";
    static final String namespace = "http://xmlns/test";
    public Tr()
    super();
    public void setType(TestType.Lang.Table.Table_Type.Tr.Tr_Type elemtype)
    throws IllegalArgumentException
    this.type = elemtype;
    public void print(XMLOutputStream out)
    throws IOException
    super.printAttributes(out, name, namespace);
    public static class Tr_Type extends CGXSDElement
    static final String name = "Tr_Type";
    static final String namespace = "http://xmlns/test";
    public void addTd(TestType.Lang.Table.Table_Type.Tr.Tr_Type.Td thetd)
    throws InvalidContentException
    super.addElement(thetd);
    public static class Td extends CGXSDElement
    static final String name = "td";
    static final String namespace = "http://xmlns/test";
    public Td()
    super();
    public void setType(TestType.Lang.Table.Table_Type.Tr.Tr_Type.Td.Td_Type elemtype)
    throws IllegalArgumentException
    this.type = elemtype;
    public void print(XMLOutputStream out)
    throws IOException
    super.printAttributes(out, name, namespace);
    public static class Td_Type extends CGXSDElement
    static final String name = "Td_Type";
    static final String namespace = "http://xmlns/test";
    public void addText(String text)
    super.addElement(new String(text));
    public void addCDATA(String text)
    super.addElement(new String(text));
    public Vector getChildElements()
    return super.getChildElements();
    public void print(XMLOutputStream out)
    throws IOException
    super.print(out);
    public void validate(XMLSchema schema)
    public Vector getChildElements()
    return super.getChildElements();
    public void print(XMLOutputStream out)
    throws IOException
    super.print(out);
    public void validate(XMLSchema schema)
    public Vector getChildElements()
    return super.getChildElements();
    public void print(XMLOutputStream out)
    throws IOException
    super.print(out);
    public void validate(XMLSchema schema)
    public Vector getChildElements()
    return super.getChildElements();
    public void print(XMLOutputStream out)
    throws IOException
    super.print(out);

    Malaya_Kishore wrote:
    Inorder to get the advantages of latest features of Java1.6 [*performance, security*, etc], the code needs to be recompiled using JDK1.6Why do you think that?
    As I understand it you have two types of "latest features". Bug fixes, JVM updates and the like in which case recompiling will have no affect. API or language updates, when you will not simply recompile but update your code base to make use off.
    The only thing I can think of that a simple recompile would help with is if the compiler updates. I'd guess this would be minimal .
    Edited by: mlk on 22-Aug-2008 09:40

  • Generation of xml file from java code

    hi,
    I want to manipulate data in a xml file with java code.I have read data from xml file and also changed it. But i am unable to covert it again in xml file from java code. Can you please tell me how i can do this?

    Let me know which parser are you using currently for reading xml files so that i assist you. For now, you can refer to STAX Parser API under this link
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html

  • How to pass the parameter values to the stored procedure from java code?

    I have a stored procedure written in sqlplus as below:
    create procedure spInsertCategory (propertyid number, category varchar2, create_user varchar2, create_date date) AS BEGIN Insert into property (propertyid, category,create_user,create_date) values (propertyid , category, create_user, create_date); END spInsertCategory;
    I am trying to insert a new row into the database using the stored procedure.
    I have called the above procedure in my java code as below:
    CallableStatement sp = null;
    sp = conn.prepareCall("{call spInsertCategory(?, ?, ?, ?)}");
    How should I pass the values [propertyid, category, create_user, create_date) from java to the stored procedure?[i.e., parameters]
    Kindly guide me as I am new to java..

    Java-Queries wrote:
    I have a stored procedure written in sqlplus as below:FYI. sqlplus is a tool from Oracle that provides a user interface to the database. Although it has its own syntax what you posted is actually PL/SQL.

  • Include PHP and/or JAVA code in any BC site.

    I am thinking about including some PHP and/or JAVA code into my BC site and I was wondering if I am allowed to do this. Just Curious. Thanks.

    That's a shame, because I was thinking about implementing a business search api for my real estate website that was created using business catalyst that allows the collection of all real estate agents in Australia by searching and collecting their information from the Yellow Pages and White Pages directories, and include these information in a database that allows users to search for the real estate agent they want and comment on that agent. This can only be done by integrating some PHP or JAVA code into my BC website.
    So that means that the only way that I can do this is to create a web app that allows users to search for the real estate agent they want to see and comment on that agent, just by entering real estate agents' information into the web app's database and using various BC modules and plugins. Are there other easier ways to do this? Thanks.

Maybe you are looking for

  • Violatoins report in dbcontrol

    Oracle EE 10.2.0.2.0 HP-UX The other day I finally decided to address policy violations reported by dbcontrol. They were - 'execute' on utl_file granted to public - Well known accounts (anonymous, ordplugins, should be expired and locked - 'execute'

  • Macbook Pro air port or ethernet not working.

    I one of the original macbook pro with the glossy screen, its not reading the Airport or ethernet port? what would be causing this? its not showing up in system preferences or anything. the only thing that shows up is firewhire and bluetooth. any sug

  • Hint and Explain Plan

    Hi, in 11.2.0.3 I run a query  with hint and withou but the executed query plan from DBMS_XPLAN.DISPLAY_CURSOR are the same (any idea) even if i flushed shared pool : SQL_ID  gh0mjh2ap7maf, child number 0                                              

  • Issue with configuring RSA 9.1 connector

    Oracle Web logic Version 10.3.0.0 JDK                    JDK160_10 Oracle Identity Manager 9.1.0.2 bp11 OIM OS Windows      2003-R2-sp2-64bit Processor               AMD RSA OS Windows      2003-R2-sp2-64bit Processor               AMD JDK JDK150_04

  • Learning Oracle!

    I am in the process of learning Oracle, I have created a Table with one of the column as a Primary, now i want to remove the Primary Key Constraint, should i drop and re-create the Table, or can i drop the column alone and re-create the column, how d