XML Tools in VS.Net 2005

In VS.NET 2005 the new XML editor that has been provided is very useful in XML file editing. The XML editor can also be used for complete checking of XML 1.0 syntax, and supports DTD (Document Type Definitions), full XSD (XML Schema Definition), IntelliSense and does a validation as you type the lines. Further there are many integrated tools in XML Editor that are capable of providing XSD inference, conversion from DTD to XSD, conversion from XDR (External Data Representation) to XSD, and XSD based IntelliSense.


All the Visual Studio Express products come with the feature rich XML Editor, where as the higher level and the Professional versions of VS.NET 2005 alone will have the XSLT editor/debugger features.

If you are in need of an improved method for XML editing and XSLT Debugging then VS.NET 2005 can provide you both features. The popularity of the XML Editor is due to its functionality such as design time well-formedness, error validation capabilities, extended validation support for Schema, DTD, and XDR, ability to infer an XSD Schema from an XML instance, ability to convert either a DTD or XDR to XSD Schema and finally the context-sensitive intellisense.

XSLT editing and viewing the results of transformation also comes as an additional feature of XML Editor. Besides this, XML Editor also extends support for standard Visual Studio code editing such as commenting or uncommenting and outlining.

The important feature of the XSLT debugger is that the debugger can be invoked from XML Editor, and it has got the ability to set and reset breakpoints. It also has the functionality of debugging function for standard Visual Studio codes and menu
bindings, and helps in viewing the results or the output of the process as and when it happens.

Further, it has additional functionality such as Locals, Watch, and Call stack windows, and help in stepping into the XSLT from a CLR (Common Language Runtime) program or C#.

Features that are part and parcel of VS.NET 2005 include XML editing, validation, smart indenting, tool tips, IntelliSense, auto-completion, reformat, schema creation, view XSL, documented outlining, syntax coloring, XSL editing, and debug XSL. We will see the details of all the features in brief now.

XML Editor simplifies the XML editing process and it can also support checking of XML native rules, allows schema-based validation, outlining of documents, IntelliSense, and auto-completion. You can also use The XML Editor for checking XML 1.0 syntax the XML Editor can carry out DTD, XSD or XDR validation as and when you type lines.

Any of the XML 1.0 well-formed errors are highlighted in red coloured squiggles and all the semantic errors that are based on DTD, XDR or XSD schema validation are represented by blue coloured squiggles. When the mouse pointer is made to hover or placed over the squiggle, you will get the error message displayed as a tool tip.

Auto-completion will get invoked when an item from the IntelliSense drop down is selected by the user or when the user opts for command completion by invoking or pressing ALT+Right Arrow keys. The IntelliSense feature will make use of the DTD’s that are associated with the document or the schemas to complete the XML elements.

In case of the reformat feature depending upon the XML Editor optional settings, the whole of XML document or only the selected portions of the document will get reformatted automatically. Regarding the smart indenting feature, when you press enter key the feature automatically does the right indentation for the next XML element of the document.

If you want to get the various attributes and elements of a document coloured then you can make use of the syntax coloring feature. Whenever you place or float the mouse pointer over an XML element or attribute, you will get a tool tip window appearing over pointer area or the element area that carries culled out information from the XSD schema.

On the left hand portion of the document editor window you can find small [+] and [-] signs or boxes that will enable you to expand or collapse and such signs are indication for the presence of multiple lines or child markup content in any XML element. You can create an XSD schema from a DTD, or XML, or XDR document using the create
schema feature.

The XML Editor when used for editing XSL can provide all the features that are made available for XML files and additionally it can also support additional features such as colour coding specific to XML document editing. Whenever you use the XSL command for viewing, you will get a new window with which you can see the output of the XSL transformation.

Whenever you edit an XML document that features an associated XSL stylesheet or when editing the XSL stylesheet, you can make use of the XSL debug command for debugging XSL documents.

The XML Editor is very useful in simplifying the process of XML file creation and editing. In VS 2005, it is easy to create an XML file and you can do this by selecting the File Menu and after selecting the New Menu option, select the appropriate XML File template from the displayed list. And for opening the existing XML file, you have select File menu option and then select Open option.

In the context menu you can find one Add Existing / Add New option with which you can add an XML file to any of the existing solution or project. In Visual Studio few XML files such as .config will not have any associated editor by default and you can open such of those files using the XML Editor.

Whenever the user starts the editing process, the XML editor takes care of the checking the well-formedness errors in the XML and you will be provided with live feedback. The feedback so generated will be made available in two ways or mechanisms.

In the first mechanism the red squiggly will form over the error character set and you can get the tip window with error text when you move the mouse pointer over the red squiggly. In the second mechanism an error list will be generated with information on errors. The Visual Studio Error List will depict all the error messages in text form and it will even tell the positional information of the errors.

When you are reading the error list, you can just get the XML Editor cursor placed exactly on the error location by double clicking the error in the error list.

If the XML file that you edit happens to have XDR association, or DTD or an XSD Schema, then the XML editor can provide you design time validation and you can get the error report by way of two mechanisms as in well-formedness error checking.

In the first type of mechanism you will get blue squiggly under all the XML contents that are invalid.

In the second mechanism, one error list will be generated with all the errors that have been identified. You can also get context-sensitive Intellisense provided by the XML editor whenever you take up editing a file that has got an attached schema to it.

From an XML document, inferring a schema is also made possible by XML Editor. To understand the concept better, think of a situation where in the user have some XML files and need to create a schema for it. Such a need of creating a schema for an XML file may arise in a data aggregation scenario, where the recipient may have to accommodate the received XML due to less or void power in the deal and there is scope for even absence of schema in the incoming XML. Here, there may be a necessity for the recipient to have a schema and to deserialize the received XML into C# objects.

With the assistance of the XML Editor present in the Visual Studio, you can simplify the process of schema generation from any of the XML documents. In XML Editor you can find the menu of Create Schema and based on the XML instance this menu command will infer a schema. Based on the XML that has been used to infer it, the inferred schema will be the most restrictive in nature.

Further, for generating an XSD Schema from the XDR or DTD that have association with the edited XML files you can make use of the same Create Schema command in the XML Editor. The XML editor also has provision for creating the schema manually by the user.

Whenever XSLT editing is done, in addition to the XML standard syntax error you can also get feedback on XSLT errors. To understand this better, if any of the template elements is inadvertently specified without a valid name attribute or a match, then the particular template element keyword will get underlined with red squiggles and one error list will also get generated with all the error text.

You can find many context-sensitive information in the Intellisense dropdown list. For example, whenever a template element is edited by a user, you can see the list of valid attributes from the dropdown list. The list also takes care of the attributes that have already been specified in the element and if the match attribute is already specified, the list shown for the next time will not have the match option.

_______________________________________________________________________

Add to My Yahoo!


FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

Visit .NET Programming Tutorial Homepage

______________________________________________________

Recommended Resource





| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.