1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-01 04:20:39 +02:00

[xml/en] copy edit and fix code typo

under well-formedness and validation, the first line of comment within code blocks should be written as text paragraph instead, otherwise anyone who simply copy-paste the code will not be able to preview the result, the original code block is now separated into three parts, each preceded by a single line of text paragraph for clarity, also the external dtd file had a typo in last commit (60a1a43) that should have been removed at the end
This commit is contained in:
Mubiin Kimura
2020-10-02 21:43:32 +00:00
committed by GitHub
parent d566d6f3c9
commit 423f47f399

View File

@@ -100,8 +100,9 @@ This is what makes XML versatile. It is human readable too. The following docume
A XML document is *well-formed* if it is syntactically correct. However, it is possible to add more constraints to the document, using Document Type Definitions (DTDs). A document whose elements are attributes are declared in a DTD and which follows the grammar specified in that DTD is called *valid* with respect to that DTD, in addition to being well-formed. A XML document is *well-formed* if it is syntactically correct. However, it is possible to add more constraints to the document, using Document Type Definitions (DTDs). A document whose elements are attributes are declared in a DTD and which follows the grammar specified in that DTD is called *valid* with respect to that DTD, in addition to being well-formed.
Declaring a DTD externally:
```xml ```xml
<!-- Declaring a DTD externally: -->
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookstore SYSTEM "Bookstore.dtd"> <!DOCTYPE bookstore SYSTEM "Bookstore.dtd">
<!-- Declares that bookstore is our root element and 'Bookstore.dtd' is the path <!-- Declares that bookstore is our root element and 'Bookstore.dtd' is the path
@@ -114,8 +115,11 @@ A XML document is *well-formed* if it is syntactically correct. However, it is p
<price>30.00</price> <price>30.00</price>
</book> </book>
</bookstore> </bookstore>
```
<!-- The DTD file: --> The DTD file (Bookstore.dtd):
```
<!ELEMENT bookstore (book+)> <!ELEMENT bookstore (book+)>
<!-- The bookstore element may contain one or more child book elements. --> <!-- The bookstore element may contain one or more child book elements. -->
<!ELEMENT book (title, price)> <!ELEMENT book (title, price)>
@@ -128,10 +132,11 @@ A XML document is *well-formed* if it is syntactically correct. However, it is p
only contain text which is read by the parser and must not contain children. only contain text which is read by the parser and must not contain children.
Compare with CDATA, or character data. --> Compare with CDATA, or character data. -->
<!ELEMENT price (#PCDATA)> <!ELEMENT price (#PCDATA)>
]> ```
<!-- The DTD could be declared inside the XML file itself.--> The DTD could be declared inside the XML file itself:
```xml
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookstore [ <!DOCTYPE bookstore [