0

Is there a difference between these two formats in XML?

    <preview-millsfamilypharmacy>
         <html>10MB</html>
         <registry>0</registry>
          <viewState>0</viewState>
          <xsl>5MB</xsl>
         </preview-millsfamilypharmacy> 

    <preview-CheyenneProfessionalDrug
      html="10MB"
      registry="0"
      viewstate="0"
      xsl="5MB" />
  • Yes - in the first example, the root element has children elements. In the second example, the children elements have all been made attributes of the first element. Note that the second example is not valid XML if it is the only the element in the file. – Tim May 23 '14 at 16:13
  • Read this: http://stackoverflow.com/questions/241819/xml-best-practices-attributes-vs-additional-elements It contains a very good discussion about this. – helderdarocha May 24 '14 at 02:32
  • Actually @Tim, both are well-formed XML. They would only be invalid if both were the only elements of the same document, since a well-formed XML requires a single root. – helderdarocha May 24 '14 at 02:35

0 Answers0