Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When do I need to use the " in xml?

Tags:

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>
like image 220
sixtyfootersdude Avatar asked Mar 03 '11 20:03

sixtyfootersdude


People also ask

Where we dont use the?

'The' is used to refer to a definite person or thing: With a superlative: This must be the hottest day of the year. We use the with some names of some rivers, oceans, rivers, newspapers etc. We do not usually use the before a plural noun unless we add more information to show which group we are talking about.

Can we use the before name?

If the name or proper noun identifies a thing or place, the is used. It's an article and not part of the name. I'm going to the Magical Park.

When should we not use articles?

Every singular, countable noun in English must have an article, whereas non-countable nouns and plural nouns do not require an article, as in: 2.1 My father got a new car yesterday.


2 Answers

Both of your examples are valid.

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

like image 134
SLaks Avatar answered Sep 23 '22 02:09

SLaks


From MSDN:

&quot; must be used for an attribute value, but a straight quotation mark (") is acceptable as the content of an element.

like image 42
chiper Avatar answered Sep 24 '22 02:09

chiper