Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - How can I stop Visual Studio spoiling my valid XHTML ?

 
Thread Tools Search this Thread
Old 03-01-2005, 09:41 AM   #1
Default How can I stop Visual Studio spoiling my valid XHTML ?


I'm using Visual Studio to build ASP.Net pages and I'm trying to be
standards compliant by using XHTML.

In my page I create valid XHTML such as:
<ul>
<li>first list item</li>
<li>second list item<br />
includes a line break</li>
</ul>

When I switch between design and HTML modes Visual Studio screws up my XHTML
to turn it in to:
<ul>
<li>
first list item
<li>
second list item<br>
includes a line break
</li>
</ul>
Any <LI> except the last is missing its closing tag.
Any 'self closing' tag such as IMG, BR, HR is stripped of it closure.

I've searched all over but can't find any instruction or setting that might
control this kind of thing.

The obvious place would be the !DOCTYPE setting, but manually inserting the
correct DOCTYPE and a URL for the DTD doesn't help.

Less obvious would be the 'target browser' setting but none of the options
offered geerates XHTML.

So. Can anyone tell me how to set up VS2003 (EA) so that I can have the IDE
build ASP.Net pages that are
valid XHTML instead of HTML?

Brian Lowe
---------@




Brian Lowe
  Reply With Quote
Old 03-01-2005, 09:53 AM   #2
=?Utf-8?B?S29zdGFkaW4gS29zdG92?=
 
Posts: n/a
Default RE: How can I stop Visual Studio spoiling my valid XHTML ?

In VS go to Tools - Options - HTML/XML - Format
At the top top you have "Apply Automatic Formatting" section.
Uncheck the tow checkboxes, so the VS doesn't format your HTML.

Hope that helps!
Regards,
Kostadin Kostov

"Brian Lowe" wrote:

> I'm using Visual Studio to build ASP.Net pages and I'm trying to be
> standards compliant by using XHTML.
>
> In my page I create valid XHTML such as:
> <ul>
> <li>first list item</li>
> <li>second list item<br />
> includes a line break</li>
> </ul>
>
> When I switch between design and HTML modes Visual Studio screws up my XHTML
> to turn it in to:
> <ul>
> <li>
> first list item
> <li>
> second list item<br>
> includes a line break
> </li>
> </ul>
> Any <LI> except the last is missing its closing tag.
> Any 'self closing' tag such as IMG, BR, HR is stripped of it closure.
>
> I've searched all over but can't find any instruction or setting that might
> control this kind of thing.
>
> The obvious place would be the !DOCTYPE setting, but manually inserting the
> correct DOCTYPE and a URL for the DTD doesn't help.
>
> Less obvious would be the 'target browser' setting but none of the options
> offered geerates XHTML.
>
> So. Can anyone tell me how to set up VS2003 (EA) so that I can have the IDE
> build ASP.Net pages that are
> valid XHTML instead of HTML?
>
> Brian Lowe
> ---------@
>
>
>

  Reply With Quote
Old 03-01-2005, 10:54 AM   #3
Brian Lowe
 
Posts: n/a
Default Re: How can I stop Visual Studio spoiling my valid XHTML ?

Thanks.

This is a good answer to my question. It does exactly what I asked.

My question should have been "How can I get Visual Studio to tidy up my
XHTML without making it invalid?"

I'd like to be able to have VS reformat the XHTML in the same way that it
does HTML, but for it to retain the necessary closures on 'self closing'
elements like <br /> and <img /> and on tags like <li> where the </li> is
optional in HTML but mandatory in XHTML.

At least until I find something to do that I can just stop VS reformatting
anything.




"Kostadin Kostov" <> wrote in
message news:FD4384D9-B4D8-4ECF-82A8-...
> In VS go to Tools - Options - HTML/XML - Format
> At the top top you have "Apply Automatic Formatting" section.
> Uncheck the tow checkboxes, so the VS doesn't format your HTML.
>
> Hope that helps!
> Regards,
> Kostadin Kostov
>
> "Brian Lowe" wrote:
>
>> I'm using Visual Studio to build ASP.Net pages and I'm trying to be
>> standards compliant by using XHTML.
>>
>> In my page I create valid XHTML such as:
>> <ul>
>> <li>first list item</li>
>> <li>second list item<br />
>> includes a line break</li>
>> </ul>
>>
>> When I switch between design and HTML modes Visual Studio screws up my
>> XHTML
>> to turn it in to:
>> <ul>
>> <li>
>> first list item
>> <li>
>> second list item<br>
>> includes a line break
>> </li>
>> </ul>
>> Any <LI> except the last is missing its closing tag.
>> Any 'self closing' tag such as IMG, BR, HR is stripped of it closure.
>>
>> I've searched all over but can't find any instruction or setting that
>> might
>> control this kind of thing.
>>
>> The obvious place would be the !DOCTYPE setting, but manually inserting
>> the
>> correct DOCTYPE and a URL for the DTD doesn't help.
>>
>> Less obvious would be the 'target browser' setting but none of the
>> options
>> offered geerates XHTML.
>>
>> So. Can anyone tell me how to set up VS2003 (EA) so that I can have the
>> IDE
>> build ASP.Net pages that are
>> valid XHTML instead of HTML?
>>
>> Brian Lowe
>> ---------@
>>
>>
>>



  Reply With Quote
Old 03-01-2005, 12:10 PM   #4
Tampa.NET Koder
 
Posts: n/a
Default Re: How can I stop Visual Studio spoiling my valid XHTML ?

Unfortunately, this feature...it really is a bug..did not ship with vs2003.
It will always mess with your markup no matter what you do. They plan on
resolving this in the next release of Visual Studio

"Brian Lowe" <> wrote in message
news:...
> Thanks.
>
> This is a good answer to my question. It does exactly what I asked.
>
> My question should have been "How can I get Visual Studio to tidy up my
> XHTML without making it invalid?"
>
> I'd like to be able to have VS reformat the XHTML in the same way that it
> does HTML, but for it to retain the necessary closures on 'self closing'
> elements like <br /> and <img /> and on tags like <li> where the </li> is
> optional in HTML but mandatory in XHTML.
>
> At least until I find something to do that I can just stop VS reformatting
> anything.
>
>
>
>
> "Kostadin Kostov" <> wrote in
> message news:FD4384D9-B4D8-4ECF-82A8-...
>> In VS go to Tools - Options - HTML/XML - Format
>> At the top top you have "Apply Automatic Formatting" section.
>> Uncheck the tow checkboxes, so the VS doesn't format your HTML.
>>
>> Hope that helps!
>> Regards,
>> Kostadin Kostov
>>
>> "Brian Lowe" wrote:
>>
>>> I'm using Visual Studio to build ASP.Net pages and I'm trying to be
>>> standards compliant by using XHTML.
>>>
>>> In my page I create valid XHTML such as:
>>> <ul>
>>> <li>first list item</li>
>>> <li>second list item<br />
>>> includes a line break</li>
>>> </ul>
>>>
>>> When I switch between design and HTML modes Visual Studio screws up my
>>> XHTML
>>> to turn it in to:
>>> <ul>
>>> <li>
>>> first list item
>>> <li>
>>> second list item<br>
>>> includes a line break
>>> </li>
>>> </ul>
>>> Any <LI> except the last is missing its closing tag.
>>> Any 'self closing' tag such as IMG, BR, HR is stripped of it closure.
>>>
>>> I've searched all over but can't find any instruction or setting that
>>> might
>>> control this kind of thing.
>>>
>>> The obvious place would be the !DOCTYPE setting, but manually inserting
>>> the
>>> correct DOCTYPE and a URL for the DTD doesn't help.
>>>
>>> Less obvious would be the 'target browser' setting but none of the
>>> options
>>> offered geerates XHTML.
>>>
>>> So. Can anyone tell me how to set up VS2003 (EA) so that I can have the
>>> IDE
>>> build ASP.Net pages that are
>>> valid XHTML instead of HTML?
>>>
>>> Brian Lowe
>>> ---------@
>>>
>>>
>>>

>
>



  Reply With Quote
Old 03-01-2005, 03:53 PM   #5
=?Utf-8?B?U2NvdHQgU2ltb25z?=
 
Posts: n/a
Default RE: How can I stop Visual Studio spoiling my valid XHTML ?

If you know what you are doing enough to write xhtml on your own I recommend
just giving design view the boot. I haven't used design view in about 2
years now. Also, the doctype that visual studio sticks in there is invalid
and causes your page to render in quirks mode.
  Reply With Quote
Old 03-02-2005, 09:26 AM   #6
Brian Lowe
 
Posts: n/a
Default Re: How can I stop Visual Studio spoiling my valid XHTML ?


"Tampa.NET Koder" <> wrote in message
news:...
> Unfortunately, this feature...it really is a bug..did not ship with
> vs2003. It will always mess with your markup no matter what you do. They
> plan on resolving this in the next release of Visual Studio


All that hype about it being extensible and being able to add your own
XSD/DTD to add your own intellisense etc, and yet the combined wisdom of
Microsoft isn't able to create the required custom extension that enables
XHTML in the IDE?

Roll on 2005 (Oh, 2005 is here, so where's VS2005?)

Brian Lowe
---------@


  Reply With Quote
Old 03-02-2005, 09:30 AM   #7
Brian Lowe
 
Posts: n/a
Default Re: How can I stop Visual Studio spoiling my valid XHTML ?

I guess design view isn't offering me much of a benefit anyway, so setting
it aside is the way to go.

Thanks also for the tip about the generated doctype.

Brian Lowe
---------@

"Scott Simons" <Scott.Simons.At.MealMagic.Com.Remove.This> wrote in message
news21E33A5-A3A8-49CE-AB17-...
> If you know what you are doing enough to write xhtml on your own I
> recommend
> just giving design view the boot. I haven't used design view in about 2
> years now. Also, the doctype that visual studio sticks in there is
> invalid
> and causes your page to render in quirks mode.



  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump