anchor.diff:              logger.log(Level.ERROR, "Corrupted phonebook file ", e);
               throw new Exception("Corrupted phonebook file ");
           }
  ----------------------------------------------------------------------------------------
  +-----------------------
   
   Let's comment the source :
   
  
positive.code: 
  [source,java]
  
  ---------------------------------------------------------------------------------------
          Phonebook phonebook = null;
          JAXBContext jc;
  
  
negative.code: 
  [source,xml]
  
  -----------------------
  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.0" >
  
      <xsd:element name="phonebook" type="Phonebook" />;
  
      <xsd:complexType name="Phonebook">
      ...
      </xsd:complexType>
  -----------------------
  
  If you use that schema, you'll have an error (`java.lang.ClassCastException: javax.xml.bind.JAXBElement cannot be cast to package.name.Phonebook`) when unmarshalling and an other (`unable to marshal type "package.name.Phonebook" as an element because it is missing an @XmlRootElement annotation`) when marshalling. You'll have to write the following java code to unmarshall and marshall without errors with the schema above :
  
  [source,java]
  
  -----------------------
  phonebook  =
       (Phonebook) ((JAXBElement)u.unmarshal( new FileInputStream( phonebookFilename ) )).getValue;
  
       m.marshal( new JAXBElement( new QName("", "phonebook"), Phonebook.class, phonebook ), System.out);
  -----------------------
  
  Instead, a better way to declare your schema (and have simplier java code) is :
  
  [source,xml]
  
  -----------------------
  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.0" >
  
      <xsd:element name="phonebook" >;
  
      <xsd:complexType >
      ...
      </xsd:complexType>
      </xsd:element>
  -----------------------
  
  The two others tips to knows will be the subjects of the next posts.
  