Writing XML Element 'id="" ' tag with C#

  • Thread starter Thread starter GeX
  • Start date Start date

GeX

GeX

Soldato
Joined
17 Dec 2002
Posts
6,981
Location
Manchester
i'm having the same trouble with C#/asp.net

I am trying to write this;

Code:
    <Style id="yellowLineGreenPoly">
      <LineStyle>
        <color>7f00ffff</color>
        <width>4</width>
      </LineStyle>
      <PolyStyle>
        <color>7f00ff00</color>
      </PolyStyle>
    </Style>

and having issues with the 'ID' bit (won't parse as is, and won't work properly if modified);

Code:
xmlWriter.WriteStartElement("Style id="yellowLineGreenPoly"");

bit of pondering and;

ok, fixed my problem;

Code:
xmlWriter.WriteStartElement("Style id=\"yellowLineGreenPoly\"");

BUT

GeX: that's not correct. You should take it to your own thread anyway as it is completely off topic to this thread.

it works and i'm confused as to why it's wrong :confused:
 
Back
Top Bottom