diff --git a/src/formatting/formatters/v2-xml-formatter.ts b/src/formatting/formatters/v2-xml-formatter.ts index daa7994..5f31514 100644 --- a/src/formatting/formatters/v2-xml-formatter.ts +++ b/src/formatting/formatters/v2-xml-formatter.ts @@ -120,15 +120,15 @@ export class V2XmlFormatter implements XmlFormatter { } // entering StartTag.Attribute.AttributeValue - else if (location === Location.Attribute && cc === "\"") { - output += "\""; + else if (location === Location.Attribute && (cc === "\"" || cc === "'")) { + output += cc; lastNonTextLocation = location; location = Location.AttributeValue; } // exiting StartTag.Attribute.AttributeValue, entering StartTag - else if (location === Location.AttributeValue && cc === "\"") { - output += "\""; + else if (location === Location.AttributeValue && (cc === "\"" || cc === "'")) { + output += cc; lastNonTextLocation = location; location = Location.StartTag; } diff --git a/src/test/test-data/single-quotes.formatted.xml b/src/test/test-data/single-quotes.formatted.xml index e8aa42e..550877b 100644 --- a/src/test/test-data/single-quotes.formatted.xml +++ b/src/test/test-data/single-quotes.formatted.xml @@ -1,4 +1,4 @@ - - + + \ No newline at end of file diff --git a/src/test/test-data/single-quotes.unformatted.xml b/src/test/test-data/single-quotes.unformatted.xml index e8aa42e..550877b 100644 --- a/src/test/test-data/single-quotes.unformatted.xml +++ b/src/test/test-data/single-quotes.unformatted.xml @@ -1,4 +1,4 @@ - - + + \ No newline at end of file