Julien,
I have looked at the code and the only place that could throw NPE in that 
method is:

file.toURI().normalize().toString()

Since .toURI() and .normalize() can't return null (if I am reading the JavaDocs 
correctly) the only way this could happen is if 'file' itself is null. Can you 
check your code and see if that's the case?

Radu

-----Original Message-----
From: Julien Martelli [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 05, 2005 12:01 AM
To: [email protected]
Subject: Issue with XMLBeans


Hi,

I've just downloaded XMLBeans 2.0.0 and I am following the tutorial but 
I've got a problem when trying to parse a java.io.File... Here is the 
error message :

java.lang.NullPointerException
   at 
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(java.io.File, 
org.apache.xmlbeans.SchemaType, org.apache.xmlbeans.XmlOptions) (Unknown 
Source)
   at org.test.person.PersonDocument$Factory.parse(java.io.File) 
(Unknown Source)
   at PersonUpdater.main(java.lang.String[]) (Unknown Source)
   at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
   at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)

and the code is :

File f = new 
File("/home/julien/Desktop/xmlbeans-2.0.0/tutorials/gettingstarted/instances/person.xml");
PersonDocument.Factory.parse(f);

the person.xsd and person.xml :
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema";
 targetNamespace="http://test.org/person";
  >
  <xs:element name="person">
   <xs:complexType>
     <xs:sequence>
           <xs:element name="name" type="xs:string"/>
           <xs:element name="age" type="xs:integer"/>
           <xs:element name="city" type="xs:string"/>
           <xs:element name="test" type="xs:integer" minOccurs="0" 
maxOccurs="unbounded"/>
       </xs:sequence>
   </xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
 <person xmlns="http://test.org/person"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://test.org/person 
file:/home/julien/Desktop/xmlbeans-2.0.0/schemas/person.xsd">
  <name xmlns="">Moi</name>
  <age xmlns="">23</age>
  <city xmlns="">Dunedin</city>
</person>

If somebody can help me please....

Thanks
Julien

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to