All metadata must be well-formed and validated against an XML schema or DTD (Document Type Definition).
The purpose of a DTD or XML Schema is to define the building blocks of an XML document with a list of elements and attributes.
Well formed XML has all metadata tags opened and closed in the proper order and has a DTD or XML schema declaration at the top of the record, with the proper attributes.
Example of a DTD:
<!DOCTYPE ArticleSet PUBLIC "-//NLM//DTD PubMed 2.6//EN" "http://www.ncbi.nlm.nih.gov/corehtml/query/static/PubMed.dtd">
The XML editor that you use to create your metadata will have a built in validation mechanism. For example the Oxygen XML editor will display a green box if the record is well formed and validated.