Hi Sree,
You're right. I'm embarrassed to admit to having drawn the wrong
conclusion from the indentation.
I saved your instance as "test.xml". I was able to compile your schema
and extract data from test.xml with the enclosed Test.java. Does this
work for you?
Regards,
--
Ed Mooney |Sun Microsystems, Inc.|Time flies like
Java Web Services |UBUR02-201 |an arrow, but
Ed.Mooney_at_Sun.COM |1 Network Drive |fruit flies like
781-442-0459 |Burlington, MA 01803 |a banana. Groucho
Sree Pillai wrote:
> Thanks for the reply, Ed.
>
> My instance is
>
> <?xml version="1.0"?>
> <globalschema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://www.testschema.com/2003/GlobalSchema">
> <datasource>
> <dsname>ScottSchema</dsname>
> <type>oracle</type>
> <driver>oracle.jdbc.driver.OracleDriver</driver>
> <url>jdbc:thin_at_w154048.carlson.com:1521:sqlmyst</url>
> <username>scott</username>
> <password>tiger</password>
> </datasource>
> </globalschema>
>
> Am I missing something here? I think I am specifying all the six attributes for DataSourceType. I am new to schema.
>
> Sree
>
> On Wed, 30 Apr 2003 09:31:08 -0400, Ed Mooney <Ed.Mooney_at_Sun.COM> wrote:
>
>
>>Hi Sree,
>>
>>Your instance is invalid. It contains only one out of the six elements
>>required by a DataSourceType.
>>
>>Regards,
>>--
>>Ed Mooney |Sun Microsystems, Inc.|Time flies like
>>Java Web Services |UBUR02-201 |an arrow, but
>>Ed.Mooney_at_Sun.COM |1 Network Drive |fruit flies like
>>781-442-0459 |Burlington, MA 01803 |a banana. Groucho
>>
>>Sree Pillai wrote:
>>
>>>While unmarshalling this instance document, I get the following exception.
>>>
>>
>>[ ... ]
>
import java.io.IOException;
import java.io.FileInputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import com.testschema._2003.globalschema.*;
public class Test {
public static void main( String[] args ) {
try {
JAXBContext jc = JAXBContext.newInstance( "com.testschema._2003.globalschema" );
Unmarshaller u = jc.createUnmarshaller();
Globalschema gs = (Globalschema) u.unmarshal( new FileInputStream( "test.xml" ) );
DatasourceType ds = gs.getDatasource();
System.out.println("dsname = " + ds.getDsname());
} catch( JAXBException je ) {
je.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}