tanszek:oktatas:techcomm:dtd
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tanszek:oktatas:techcomm:dtd [2024/10/07 17:46] – [Example: An album has at least one title, followed by at least one **track title** and **duration**:] knehez | tanszek:oktatas:techcomm:dtd [2024/10/07 17:57] (current) – [Complex DTD Example for a Hypothetical Mail Processing System] knehez | ||
---|---|---|---|
Line 105: | Line 105: | ||
</CD> | </CD> | ||
</ | </ | ||
+ | ---- | ||
==== Example: An album has at least one title, followed by at least one **track title** and **duration**: | ==== Example: An album has at least one title, followed by at least one **track title** and **duration**: | ||
Line 130: | Line 130: | ||
</ | </ | ||
- | --- | + | ---- |
==== Example: A library may contain **books** (zero or more)==== | ==== Example: A library may contain **books** (zero or more)==== | ||
Line 158: | Line 158: | ||
</ | </ | ||
+ | ===== Defining Attributes in DTD ===== | ||
+ | |||
+ | If a class has an attribute such as " | ||
+ | |||
+ | <sxh> | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | Attributes can be: | ||
+ | - **# | ||
+ | - **# | ||
+ | - **#FIXED**: fixed value | ||
+ | |||
+ | === Specifying a Default Attribute Value == | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <sxh> | ||
+ | < | ||
+ | </sxh | ||
+ | |||
+ | The XML could look like this: | ||
+ | |||
+ | <sxh> | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | === Enumerated Values === | ||
+ | |||
+ | **Syntax**: | ||
+ | <sxh> | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | **DTD Example**: | ||
+ | <sxh> | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | **XML Example**: | ||
+ | <sxh xml> | ||
+ | <payment type=" | ||
+ | </ | ||
+ | |||
+ | ==== Complex DTD Example for a Hypothetical Mail Processing System ==== | ||
+ | |||
+ | **Task**: Provide an XML example that satisfies the following DTD: | ||
+ | |||
+ | <sxh> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | === A Possible XML for the given DTD === | ||
+ | |||
+ | <sxh xml> | ||
+ | < | ||
+ | < | ||
+ | <address nick=" | ||
+ | <sender nick=" | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | This provides an example of how attributes, including mandatory, optional, and default values, can be defined in a DTD and represented in an XML document. |
tanszek/oktatas/techcomm/dtd.1728323189.txt.gz · Last modified: 2024/10/07 17:46 by knehez