You will need
- - text editor;
- - maybe a browser and an Internet connection.
Instruction
1
Determine what type will be the resulting XML document. Whether it's correctly built (well-formed) or valid document. Select the type of document depends on its content and purpose. If the document is required to save arbitrary data and is not intended for further publication or standardization structure, you can create a well-formed document. Such documents must conform to all XML syntax rules.A valid XML document must be well-formed and, in addition, to adhere to the rules defined by a specific DTD (Document Type Definition). Therefore, if you want to clearly define the structure and relationships between elements, you should create a valid XML document.
2
Choose or design a document type definition (DTD). For common tasks, you can use one of the existing XML applications, the specifications of which are published on the W3C web site, located at w3.org or on the websites of third-party developers. So, mathematical formulas it is convenient to describe the format MathML, vector graphics - in SVG, and e-books in FictionBook. The advantage of this approach is that documents that conform to approved specifications, can be processed by the existing software.In the case of a decision on developing custom DTD, refer to the regulatory documents of the W3C. If the created document will not conform to any DTD, consider and fix it possible to follow it in the future.
3
Select the encoding of the XML document. In XML, you can use different encodings. However, if the choice is to take into account the capabilities of the text editor, as well as requirements for the character set of the document data. For compatibility with ASCII, variable-length symbol and full support for the entire UNICODE set, in most cases it makes sense to use UTF-8 encoding.
4
Create an XML document. Start a text editor. Open a new document window. In the first line, type the XML Declaration:
<?xml version="1.0" encoding="UTF-8"?>
where the value of the version attribute is the version of language specification, and the value of encoding attribute indicates the encoding of the document. If you are using a document type definition, DTD, enter text or a link to a resource with a valid DTD. Next, create the data structure of the document starting from the root element. Save the document file on your hard disk.
<?xml version="1.0" encoding="UTF-8"?>
where the value of the version attribute is the version of language specification, and the value of encoding attribute indicates the encoding of the document. If you are using a document type definition, DTD, enter text or a link to a resource with a valid DTD. Next, create the data structure of the document starting from the root element. Save the document file on your hard disk.
5
Check the correctness of the generated XML document. If the document is presented in one of the common formats, it can be a program validator. Check the list of test documentslocated at http://www.w3.org/QA/Tools/. Check.