TAILIEUCHUNG - Pro XML Development with Java Technology 2006 phần 6

Bạn sẽ quyết định sự kiện nào là quan trọng, và bạn cũng sẽ quyết định tạo ra kết cấu dữ liệu nào để nắm giữ các dữ liệu từ các sự kiện đó. Nếu bạn không dứt khoát lưu dữ liệu từ một sự kiện, nó sẽ bị loại bỏ. | CHAPTER 6 OBJECT BINDING WITH JAXB 171 Binding Catalog Schema to Java Classes In this section you will bind the catalog schema shown in Listing 6-6 to its Java content classes. You ll subsequently use the Java content classes to marshal and unmarshal the XML document shown in Listing 6-7. You will run xj c from within Eclipse. Therefore configure xj c as an external tool in Eclipse similar to the JAXB project configuration. The only difference for the JAXB project is that the xjc batch file Location field is set to the JAXB xjc batch file. You set the environment variables JAVA_HOME and JAXB_HOME similar to JAXB . Set JAXB_HOME for to C Sun jaxb. To add the xjc configuration to the External Tools menu select the Common tab and select the check box External Tools in the Display in Favorites menu area as shown in Figure 6-7. To run the xjc compiler on the example schema select the file in the Package Explorer and then select Run External Tools XJC. Schema-derived classes get generated in the gen_source folder as shown in Figure 6-12. Figure 6-12. Schema-derived Java content classes generated by xjc Java classes and interfaces are generated in the package generated by default. Fewer classes are generated with JAXB than with JAXB . For each xsd complexType schema component one value class gets generated instead of an interface and an implementation class. For example for the complex type catalogType shown in Listing 6-33 the value class gets generated. Listing 6-33. The Complex Type catalogType xsd complexType name catalogType xsd sequence xsd element ref journal minOccurs 0 maxOccurs unbounded xsd sequence xsd attribute name section type xsd string xsd attribute name publisher type xsd string xsd complexType 172 CHAPTER 6 OBJECT BINDING WITH JAXB The class consists of getter and setter methods for each of the attributes of the catalogType complex type. A getter .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.