YAML's indentation rules are easy to break, and many APIs only accept JSON. XML is what many feeds, enterprise systems and older integrations require. YAML is at home in configuration files written by people; XML is the usual choice for document-like data, feeds and enterprise systems.
Keys, nesting and values carry over. Comments in the YAML file are not carried over, because only the data is read. A YAML file with several documents (separated by ---) is read as a list of documents. XML allows only one root element, so data without one is wrapped in a <root> element.