tailieunhanh - Pro XML Development with Java Technology 2006 phần 2

XML (Extensible Markup Language) đã phát triển từ buzzword cuối cùng trở thành cơ sở của nền công nghệ thương mại điện tử trong thời gian kỷ lục. Những bài hướng dẫn mới nhất bàn về các vấn đề XML là gì, tại sao nó được phát triển, và cách nó đang tạo hình thái tương lai của thương mại điện tử ra sao. Trong đó cũng bao gồm rất nhiều vấn đề chung và các tiêu chuẩn quan trọng trong lập trình XML, được kết thúc bằng hai nghiên cứu tình huống chỉ ra cách những công ty. | 14 CHAPTER 1 INTRODUCING XML AND JAVA xsd complexType name paperType xsd all xsd element name title type titleType xsd element name author type authorType -- we have yet to define titleType and authorType -- xsd all xsd complexType Named Model Groups You can define all the model groups you ve seen so far sequence choice and all within a named model group. The named model group in turn can be referenced in complex types and in other named model groups. This promotes the reusability of model groups. For example you could define paperGroup as a named model group and refer to it in the paperType complex type using the ref attribute as shown in the following example xml version encoding UTF-8 xsd schema xmlns xsd http 2001 XMLSchema xsd complexType name paperType xsd group ref paperGroup xsd complexType xsd group name paperGroup xsd all xsd element ref title xsd element ref author xsd all xsd group xsd schema Cardinality You specify the cardinality of a construct with the minOccurs and maxOccurs attributes. You can specify cardinality on an element declaration or on the sequence choice and all model groups as long as these groups are specified outside a named model group. You can specify named model group cardinality when the group is referenced in a complex type. The default value for both the minOccurs and maxOccurs attributes is 1 which implies that the default cardinality of any construct is 1 if no cardinality is specified. If you want to specify that a catalogType complex type should allow zero or more occurrences of journal elements you can do so as shown here xsd complexType name catalogType xsd sequence xsd element maxOccurs unbounded minOccurs 0 ref journal xsd sequence xsd complexType Attribute Declarations You can specify an attribute declaration in a schema with the attribute construct. You can specify an attribute declaration within a schema or a complexType. For example if you want to define the title and publisher attributes in the .