Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it valid to have XML attributes on newlines?

I know that you can have newlines inside your XML attributes. But can you put each attribute on its own line?

<maritalStatusCode
  code="M"
  displayName="Married"
  codeSystem="2.16.840.1.113883.5.2"
  codeSystemName="MaritalStatusCode"/>

In Sublime it shows up as a non-closing tag. And when I try to parse it with something like jsdom it breaks there as well. I've tried googling this but haven't found a definitive answer yet. I can provide more info on the document if needed. I'm not super well versed in all the intricacies of XML so I may have left out pertinent information.

like image 506
robdodson Avatar asked Mar 23 '23 20:03

robdodson


1 Answers

Yes, line-breaks within an XML element are absolutely fine.
Perhaps you are moving between Windows and Unix, and the difference in line-breaks is tripping up the parsers?

like image 60
Edward Avatar answered Apr 01 '23 20:04

Edward