views:

216

answers:

2

Hi, is there a way to enable IntelliSense for XML literals in VB9 (VS 2008)? The ideal source of IntelliSense is an XSD document, but I can use anything else format to do it.

Thanks

+2  A: 

http://msdn.microsoft.com/en-us/library/bb531402.aspx

It works, I used it a few months back. If you have VS2k8 Docmentation installed, go to How to: Enable XML IntelliSense in Visual Basic at ms-help://MS.MSDNQTR.v90.en/dv_vbalr/html/af67d0ee-a4a6-4abf-9c07-5a8cfe80d111.htm, it has the example you need to get this working. The on-line documentation is lacking.

  • How to Use LINQ to XML
  • How to: Enable XML IntelliSense in Visual Basic
  • Shows how to add an XML schema to a Visual Basic project to provide XML IntelliSense that shows possible attributes, child elements, or descendant elements for XML literals.

Excerpt

To import an XML namespace in a code file Identify the target namespace from your XSD schema.

At the beginning of the code file, add an Imports statement for the target XML namespace, as shown in the following example.

Imports <xmlns:ns="http://someNamespace"&gt;

To import an XML namespace as the default namespace, that is, the namespace that is applied to XML elements and attributes that do not have a namespace prefix, add an Imports statement for the target default XML namespace. Do not specify a namespace prefix. Following is an example of an Imports statement.

Dim phone2 As XElement = <phone type="home">206-555-0144</phone>
phone2.@owner = "Harris, Phyllis"

Console.WriteLine(phone2)

'Imports <xmlns="http://defaultNamespace"&gt;
AMissico
It provides intellisense only for querying the XElements, but not the creating by xml literals :(
TcKs
+1 Its very detailed, bud I still don't know how can I write for ecmpple:<hzml><body text="red"><a href="blablabla><img src=somehere.jpg/></body></html>with a intellisense support. I only way how to intellisense support I foung was in querying the xml. Miss I somehing?
TcKs
I now understand what you are asking about. There is no IntelliSense with the actual declaration of the XML Literal because it ***is*** the declaration. All the editor can do is check for well-formed XML.
AMissico
It's not happy to me ... VB.NET could be the best X(HT)ML document generator ever with this feature.But thanks for your effort and time.
TcKs
Hm, seem to me generating XHTML through XML Literals could be better accomplished through another process. Maybe XML Literals is not the way to go?
AMissico
Its not only for XHTML, I use it for XML messages webservices without WSDL but with XSD for XML messages.
TcKs
Check out http://www.devx.com/codemag/Article/38880/1954. I haven't completely reviewed the article, but I thought it had sufficent detail to possibly help you. Here is the link to the "XML to Schema Tool for Visual Basic 2008" at http://msdn.microsoft.com/en-us/vbasic/bb840042.aspx.
AMissico
+1  A: 

I haven't seen any way of doing this. Please go rate or comment on this suggestion on the Microsoft Connect site.

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=490740

Dennis Palmer