Schema and DTD
Are used to define the use specification of XML tags in various files.
Schema is a standard XML file, while DTD uses its own special syntax. Therefore, you only need to know the XML syntax rules to write the schema, and you do not need to learn other syntax rules. you can use the same processor to interpret it,
Schema uses the namespace to associate special nodes in the file with the schema description. an XML file can have multiple corresponding schemas. If it is a DTD, an XML file can have only one corresponding DTD file.
The schema content model is open and can be expanded at will, while the DTD cannot interpret the expanded content. the DTD can only define the file type as a string, while the schema can define the file type as an integer, floating point number, String, Boolean value, or other data types without redefinition.
The obvious advantage of Schema over DTD is that the schema file itself is also an XML file, rather than using a special format like DTD, thus facilitating users and designers. because they can use the same tools to process and develop schema and other XML data, rather than using specialized development or processing tools.
XML File Parsing Method: Sax parsing and Dom Parsing
Sax parsing: uses the file stream to read and parse a row. After parsing, You can recycle it. Memory is saved, but the speed is slow.
Dom parsing: Read data into the memory at a time and analyze and explain its structure. The speed is improved, but the memory usage is very high.
Difference between DTD and schema & common methods for parsing XML files