A Tech Log

April 7, 2009

Accessing Strongly Typed XML Data using XPathNavigator

Filed under: Development — adallow @ 4:56 pm
Tags: ,

As an instance of the XPath 2.0 data model, the XPathNavigator class can contain strongly-typed data that maps to common language runtime (CLR) types. According to the XPath 2.0 data model, only elements and attributes can contain strongly-typed data. The XPathNavigator class provides mechanisms for accessing data within an XPathDocument or XmlDocument object as strongly-typed data as well as mechanisms for converting from one data type to another.

http://msdn.microsoft.com/en-us/library/1bkbyzbb(VS.80).aspx

March 17, 2009

ADO.Net XML Provider

Filed under: Development — adallow @ 12:58 pm
Tags: ,

The WilsonXmlDbClient is an ADO.NET provider that enables Xml to be worked with just like any other database in .NET. It supports the most common Select, Insert, Update, and Delete SQL syntax, as well as tranactions and parameters.

Wilson.XmlDbClient is the original open source release by Paul Wilson. It includes:

XmlDbCommand
XmlDbDataReader
XmlDbDataAdapter
XmlDbConnection
XmlDbParameter
XmlDbTransaction
XmlDbException

http://code.msdn.microsoft.com/WilsonXmlDbClient

December 19, 2008

XML Notepad 2006

Filed under: Development — adallow @ 6:31 pm
Tags:

XML Notepad 2006 provides a simple intuitive User Interface for browsing and editing XML documents.  XML Notepad shows how to use some advanced features of System.XML in the .NET Frameworks 2.0.  The download includes source code. See the handy design doc that goes with it.  Features include:

  • Tree View synchronized with Node Text View for quick editing of node names and values.
  • Incremental search (Ctrl+I) in both tree and text views, so as you type it navigates to matching nodes.
  • Cut/copy/paste with full namespace support.
  • Drag/drop support for easy manipulation of the tree, even across different instances of XML Notepad and from the file system.
  • Infinite undo/redo for all edit operations.
  • In place popup multi-line editing of large text node values.
  • Configurable fonts and colors via the options dialog.
  • Full find/replace dialog with support for regex and XPath.
  • Good performance on large XML documents, loading a 3mb document in about one second.
  • Instant XML schema validation while you edit with errors and warnings shown in the task list window.
  • Intellisense based on expected elements and attributes and enumerated simple type values.
  • Support for custom editors for date, dateTime and time datatypes and other types like color.
  • Handy nudge tool bar buttons for quick movement of nodes up and down the tree.
  • Inplace HTML viewer for processing xml-stylesheet processing instructions.
  • Built-in XML Diff tool.”

See : http://blogs.msdn.com/xmlteam/archive/2006/09/05/741251.aspx

Picking the right MSXML Version

Filed under: Development — adallow @ 6:17 pm
Tags:

Good article, the full post is long but relevant if you use MSXML, however the basic summary is below:

see: http://blogs.msdn.com/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx

  • Use MSXML 6.0 – it is “in the box” on Vista and available for download on Win2k, XP, and 2003. It has the best security, performance, reliability, and W3C conformance
  • MSXML 3.0 is our preferred “fallback” – It is installed on every OS from a fully patched Win2k SP4 installation on up, so it requires “zero-deployment” and is serviced regularly with the OS
  • MSXML 4.0 was released to the web about 5 years ago, but at this point has been superseded by MSXML 6.0 and is only intended to support legacy applications
  • MSXML 5.0 for Microsoft Office Applications is purpose-built for Office applications and isn’t intended for broad deployment. Internet Explorer 7 actually has the MSXML5 components “off-by-default” in the Internet zone so your customers will get a goldbar for each MSXML5 control on a page if your code tries to instantiate it. The best recommendation is to avoid MSXML5 in your web apps (only machines with Office 2003 or higher will have it, anyway.).

Ideally, customers should standardize on MSXML6, but as mentioned above legacy applications or zero-deployment requirements may block full migration to MSXML6 in the short run. In this case there are two tensions that need to be balanced – functionality and test costs. This essentially leads to two options:

  • Try MSXML6 and fallback to MSXML3 – MSXML6 has some improvements that aren’t in MSXML3 such as support for XSD schema, and improved stability, performance, and security. So your app may try out MSXML6 if it is on the box and then “fallback” gracefully. Just remember to test your app with MSXML6 and with MSXML3 so you aren’t surprised when you release your application. Here’s a quick example:

if (Web.Application.get_type() == Web.ApplicationType.InternetExplorer) {

var progIDs = [ ‘Msxml2.DOMDocument.6.0’, ‘Msxml2.DOMDocument.3.0’];

for (var i = 0; i < progIDs.length; i++) {

try {

var xmlDOM = new ActiveXObject(progIDs[i]);

return xmlDOM;

}

catch (ex) {

}

}

return null;

}

  • Standardize on MSXML3 with an eye towards MSXML6 in the future – This limits functionality somewhat to what is in MSXML3 but also keeps down test costs. I’ll try to post something in the future about writing MSXML3 apps that should upgrade more easily to MSXML6 (and beyond).

XML Tools in Visual Studio 2008

Filed under: Development — adallow @ 6:15 pm
Tags: ,

tooling support offered in Visual Studio 2008 that will make working with XML easier. It will cover editing XML files, working with XML schemas, debugging XSLT style sheets and extending Visual Studio by writing your own custom XML Designers.”

see http://www.code-magazine.com/Article.aspx?quickid=0712162

Blog at WordPress.com.