Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



Component One


LearnNow
 


RssBus

Reader rating:
Article source: CoDe (2008 - Vol. 5 - Issue 1 - Extensibility)


Article Pages:  1  2 - Next >


How XML Tools Use the Visual Studio SDK

I have a funny story about how Visual Studio extensibility works. I work at Microsoft in the SQL Server division focusing on XML technologies and I went to the Visual Studio team a few years ago and asked them if they could build some better XML tools. They said they’d put it on their list. You know how that goes. The bottom line is that the Visual Studio team cannot possibly build every tool on the planet. So I installed the Visual Studio SDK and started hacking away in C#. I wanted to build an XML editor that understood namespaces and XSD built on the new System.Xml platform provided by our team. This was back in 2003, and so there was no managed language service framework, so I built one by porting the native Babel C++ framework to managed code-this is now the Microsoft.VisualStudio.Package.LanguageService framework in the Visual Studio SDK. Once that was done I was able to get an XML editor demo up and running in a few weeks and I took it over to the Visual Studio team and they liked it so much they asked to ship it in Visual Studio 2005. I’m happy to see many other languages adopt it, from IronPython to the new XAML editor and a new T/SQL language service being developed in our building.

I’ve really enjoyed working with the Visual Studio Developer Tools Platform team and I guess I’m now considered an internal partner. In fact, we now have a whole team in our building called “Data Programmability Tools” (DP Tools) dedicated to extending Visual Studio to provide all sorts of “data-centric” tools from XML editing, XSLT debugging in Visual Studio 2008, and now we are building graphical design tools for editing XSD and EDM schemas. So it’s been a fun ride!

The Visual Studio SDK contains a lot of functionality! Though it might seem a bit daunting at first, I’ve generally found it’s pretty cleanly componentized so I don’t need to know the stuff I don’t use. Microsoft built the XML Editor (Figure 1) on the managed package framework (MPF) and the managed language service framework (MLSF), it integrates with the XSLT debugger, and it uses quite a few Visual Studio shell features.

Click for a larger version of this image.

Figure 1: Microsoft built the XML Editor on the managed package framework (MPF) and the managed language service framework (MLSF).

For example, it uses IVsWebBrowserUser to render the XSLT output, it overrides various MPF methods to plug in custom tools/options and user profile persistence, and so on. It also uses the IVsSolution and IVsProject interfaces and project tracking events and so on so it can track location of XSD schemas for IntelliSense. It also implements custom EditorFactory and IVsEditorFactoryNotify interfaces so it can intercept XML Editor creation and redirect to registered XML designers when appropriate.

After shipping Visual Studio 2005 we started work on our new XSD Designer. Figure 2 shows our new “XML Schema Explorer” which shows all the XML schemas in a given “Set” and all the global types defined in the set. We knew we needed a better way to integrate with the XML Editor. We wanted to support “View Code” functionality so you can edit the raw XML using the XML Editor, and “View Designer” functionality to switch back to the graphical view all with smooth integration. But the only story we had for folks who are building on Visual Studio 2005 is to copy the Visual Studio SDK sample called “SynchronousXmlDesigner”. The sample XML designer does what the Data Set Designer and ResX Designer do, which is to synchronize changes at the “whole buffer” level. This means that when the user edits the raw XML, the designer sucks in the whole IVsTextLines buffer again and re-parses the whole thing and rebuilds the whole UI over again-hopefully with some smart UI context preservation. Conversely, when the user edits the graphical view, the designer re-serializes the entire thing back to XML and blasts that into the buffer (losing whatever user formatting was done, and sometimes even losing things like XML comments and other XML stuff not modeled by the designer).

Click for a larger version of this image.

Figure 2: XML Schema Explorer.

Figure 3 illustrates this problem.

Click for a larger version of this image.

Figure 3: No shared “parse tree” can be a problem.

&

By: Chris Lovett

Fast Facts

Visual Studio 2008 will make it easier for a VSX developer to build new XML tools.



Article Pages:  1  2 - Next Page: 'How XML Tools Use the Visual Studio SDK (con't.' >>

Page 1: How XML Tools Use the Visual Studio SDK
Page 2: How XML Tools Use the Visual Studio SDK (con't.

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
1.9 out of 5

19 people have rated this article.

rssbus

      Sharepoint TechCon

 

RssBus