xml

When do I need to use the " in xml?


When I have quotes that are not in an attribute do I need to encode them using "?

Which is correct? Exhibit A or Exhibit B?

Exhibit A

<boat>
    <name> Bertha </name>
    <description> Good boat.  10 feet long.  "Fixer-upper"</description>
</boat>

Exhibit B

<boat>
    <name> Bertha </name>
    <description> Good boat.  10 feet long.  &quot;Fixer-upper&quot;</description>
</boat>

Solution

  • Both of your examples are valid.

    You only need &quot; inside an attribute value; a " character would close the attribute early.