JAXB Przypomnienie Wstęp Przykład Typy danych Unmarshalling Di
Listing 6: Hello
1 public class Hello (
2
3 private ObjeotFactory of;
4 private GreetingListType grList;
5
6 public Hello() i
7 of = new ObjectFactory();
8 grList = of.createGreetingListType();
1 public void raake( String t, String 1 ){
2 GreetingType g = of.createGreetingType();
3 g.setText ( t );
4 g.setLanguage( 1 );
5 grList.getGreeting().add( g );
18 public void marshalO (
19 try (
20 JAXBElement<GreetingListType> gl = of.createGreetings( grList );
21 JAXBContext je = JAXBContext.newlnstance( "hello" );
22 Marshaller ra = jc.createMarshaller();
23 m.marshalf gl, System.out );
24 } catchl JAXBException jbe )(
25 // .. .
28 )