Welcome to MSDN Blogs Sign in | Join | Help

We’re thrilled to announce that today the new XML Schema Explorer is included in the Orcas SP1 Beta release for Visual Studio 2008. We previously released a CTP showcasing a subset of the XML Schema Explorer functionality last August. Many of the people who downloaded and tried our August preview requested that we ship the functionality in Visual Studio 2008 and so we are. You can download the beta here.

The XML Schema Explorer illustrates our initial thinking about the future of XSD tools from Microsoft. Instead of working with strictly one XSD file in a text editor, the XML Schema Explorer allows you to view and work with an XML Schema Set, showing all XSDs imported and included in a hierarchal view.  The XML Schema Explorer offers tight integration with the XML Editor (allowing navigation seamlessly from Editor to XML Schema Explorer and back), the ability to search over the full schema set, the ability to show different views of a schema set (offering the ability to hide/show namespaces, files, as well as change schema set node ordering), the ability to general sample XML for global elements, and more. We are very much interested in gathering your feedback on the product, so please download the beta, give the feature set a try, and send us some feedback.

Over the next few weeks we’ll follow up with additional blog posts describing the functionality we’ve added in this release and discussing our future plans for adding to this start.

Please send us your comments, questions, and suggestions via the XML and the .NET Framework forum on MSDN here.

Thanks,

Tim Laverty

Program Manager, XML Tools

 

Untitled

Prior to SQL Server 2008, SQLXML 4.0 was released with SQL Server and was installed by all SQL Server editions, except in SQL Server Express. Beginning with SQL Server 2008, the latest version of SQLXML is no longer included in SQL Server.

 

When SQL Server 2008 is generally available, the latest version of SQLXML will be SQLXML 4.0 SP1.  The URL for the site where you can install SQLXML 4.0 SP1 will be added to this blog entry, and to the SQL Server 2008 Books Online, when SQLXML 4.0 SP1 is available.

 

If an application that requires SQLXML 4.0 will run on a computer where SQLXML 4.0 is not installed, you will need to download and install SQLXML 4.0 SP1.

 

SQLXML 4.0 SP1 Behavior with New Data Types Using SQLOLEDB and SQL Server Native Client OLE DB Provider

SQL Server 2008 introduces the following data types, which developers using SQLXML might want to use:

·         Date

·         Time

·         DateTime2

·         DateTimeOffset

When using SQLXML 4.0 SP1 with either SQLOLEDB (from Windows Data Access Components, formerly Microsoft Data Access Components) or SQL Server Native Client OLE DB from SQL Server 2005, these new types will appear as strings to a developer. SQLXML 4.0 SP1 will enable these four new data types as built-in scalara types when used with SQL Server Native Client OLE DB Provider 10.0 (SQLNCLI.10), which ships in SQL Server 2008. Until you download SQLXML 4.0 SP1, mapping these types to non-string types might cause truncation of some data. For example, mapping DateTime2 to xsd:date will cause data to be truncated to the SQL Server 2005 DateTime precision of 3.33 miliseconds.

 

David Schwartz

Programming Writer, Microsoft 

 

 

1 Comments
Filed under:

CoDe Magazine published an article on XML Tools.  It covers a wide range of topics:

  • Editing XML files,
  • Schema cache and catalogs,
  • Performance and working with large files,
  • XSLT debugging, and
  • Extending XML Tools

Enjoy!

Scott Hanselman talks about XML Tools in his new book "Professional ASP.NET 3.5: in C# and VB".  He mentions XML Editor, which is available in Visual Studio 2005 and 2008, as well as XML Schema Explorer, which we plan to ship in the next service pack.

We’re gearing up for the next release of the .NET Framework, and we are looking for people that have a passion for building great frameworks to help with the effort.  Since we’ve shipped the .NET Framework 3.5 we’ve been working on projects like the ADO.NET Data Services Framework (aka Astoria) and LINQ to XML support in Silverlight.  If you’re interested in designing the next set of API’s for data and want to work for a team that’s focused on shipping technologies and having fun, we’re interested in hearing from you.  Drop us a line through the team blog or directly to me and we’ll get back to you.

Carl Perry
Lead Program Manager

cperry@microsoft.com

I’m happy to announce that today we are re-releasing the LINQ to XSD Preview Alpha 0.2 for Visual Studio 2008. The previous preview release of LINQ to XSD targeted Beta 1 of Visual Studio 2008 but did not work on later builds. Many of the people who originally downloaded and tried the LINQ to XSD Preview Alpha requested an update for the final release of Visual Studio 2008 – this release is it. You can download it from here.

 

The LINQ to XSD preview illustrates our initial thinking on a strongly-typed programming experience over LINQ to XML. Instead of working with untyped XML trees, LINQ to XSD allows you to program in terms of strongly-typed classes, generated based on an XSD schema.  The LINQ to XSD project is still incubation, but we are looking at ways to incorporate its functionality into future Visual Studio and .NET Framework releases. We are very much interested in gathering your feedback on the product, so please download it, give it a try, and send us some feedback.

 

I know it’s taken us a while to get this release out and some of you have been wondering what’s happening with this project. The team has only recently resurfaced from the Visual Studio 2008 release push and has begun looking at how we can take LINQ to XSD forward again. We’re looking forward to getting your feedback on this preview and on our future work on strongly-typed XML programming.

 

Please send us your comments, questions, and suggestions via the LINQ forum on MSDN: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=123&SiteID=1

 

Shyam Pather

Dev Manager, Data Developer Experience Team
29 Comments
Filed under: ,

The W3C Recommendation Extensible Markup Language (XML) 1.0 was initially published on the 10th of February 1998. Since then, XML has proliferated at a rapid pace, becoming the predominant method for electronic data interchange between information systems, and we can safely describe it as universally applicable, fast, scalable and durable integration code.  XML and its related standards and tools are continuing to enable data interoperability, content manipulation, content sharing and reuse, document assembly, document security and access control, document filtering, and document formatting for all types of devices and applications.  As we celebrate its tenth anniversary, we have a great opportunity to look back and reflect on the role XML has played in the technical ecosystem in which it functions, and to acknowledge the fact that it will take its place among the technical standards having the greatest impact on the world in which we live.

The Microsoft’s XML Team believes that XML's potential has only begun to be realized and that there are still new XML tools to be created, steps to be made, issues to be resolved and risks to be avoided, in order for XML to fulfill its promise. The XML team is committed to continue to assist developers everywhere to quickly build implementations that are scalable, robust, and flexible enough to work across all types of applications. Systems that implement the tooling required to process and query XML must address performance problems without destroying the requirement for ubiquity and the Microsoft’s XML Team is here to help enable implementers to rapidly prototype ideas.

Congratulations to all who made XML such a milestone 10 years ago and congratulations to all that today are releasing and innovating products and technologies that will direct the future of XML, helping it realize its full potential for increasing the value of information technology!

Irinel Crivat
Program Manager | Data Programmability

 

4 Comments
Filed under:

XML Tools team has released the XSLT Profiler Addin for VS 2008 - a quick and reliable performance analysis profiler tool that assists in the development and debugging of XSLT documents. The XSLT Profiler Addin for VS 2008 allows developers to measure, evaluate, and target performance-related problems in XSLT code by creating detailed XSLT performance reports. The XSLT Profiler includes a wealth of useful hints for XSL and XSLT style sheet optimizations, which are essential for XSLT-based applications that demand maximum performance.

 

If you need to develop reliable and robust software, the XSLT Profiler is capable of detecting the performance errors and defects in coding so that they are corrected at an early stage in the development. This is essential in reducing the overall cost of developing software applications. The XSLT Profiler tool is fully integrated into Microsoft Visual Studio 2008 to provide a seamless and approachable user experience, combining several Microsoft technologies, including Microsoft XML Editor and XSLT Debugger, Visual Studio Team System, F1 (Performance Suites), and more.

 

For more information and download check out Microsoft Downloads site.

 

Irinel Crivat

Program Manager | Data Programmability

Chris Lovett was interviewed by book author Michael van Otegem recently and he asked some very interesting questions:

Please tell us who you are and what you do.
I’m an architect on the Data Programmability Tools team in SQL Server, and I work on XML tools that ship in Visual Studio.  As an architect I do lots of different things including: product development on the XML editor in Visual Studio 2008; cross-group collaboration to make sure all our tools work together; playing with other concepts like XML Notepad; and thinking about and communicating our strategy and future directions for our technologies.
 
How long have you worked for Microsoft and what did you do before your current position?
I have worked on pretty much every XML core technology from Microsoft starting with MSXML in 1997, then to System.Xml in the .NET frameworks v1, and v2. and for the last few years I’ve been focusing on building XML tools in Visual Studio – for example, I was the primary developer on the XML editor in Visual Studio 2005.  Before Microsoft I worked at IBM on OS/2 applications, then I joined the IBM Apple/IBM joint venture called Taligent, then I started my own company in Sillicon Valley with friends from Taligent during the height of the .com boom and that’s what led me to Microsoft.
 
A lot of the .NET Framework works with XML in some form or another. Why is XML such a key component and what were the challenges you faced because of that?
For one thing the .NET frameworks were designed during the peak of the XML hype curve, but more seriously, many folks at Microsoft were waking up to the fact that not everything had to be buried in code.  Some things could be very neatly described at a higher “declarative” level and Tim Berners-Lee showed the world that “markup” is a great way to do that.  So XML became the way to specify configuration information (.config files), and build information (MSBuild files), and setup information (WIX), object remoting with SOAP, and security permissions and so on.  All of these domain specific uses of XML were then supported by our core System.Xml classes.  It’s interesting to note that even those teams that didn’t adopt XML back in .NET v1.0 are fixing that. For example, we have the new AJAX work from the ASP.NET team and we have XAML in the Windows Presentation Framework (I’m a huge fan of WPF by the way.  I’ve done a lot of UI development in the last 20 years and I have to say WPF totally rocks).   So XML is touching everything from database, management, communications, content publishing and now even into the user interface layer.  I was amazed at the last PDC where just about every talk showed some snippet of XML somewhere during their talk.
 
I remember when we started XML at Microsoft most people thought we were crazy.  The biggest challenge was convincing people the cost of parsing and storing verbose XML tags was worth it and our team has been working on performance, and scalability ever since.  But the real reason XML become a key component of .NET, (and Windows, and SQL Server and Office) is because it achieved true cross-platform interoperability and because it was good enough for that job.
 
What do you (personally) like the most about XML and its associated standards?
Simplicity, cross-platform interoperability and huge adoption.  The great thing about XML is that it is humble.  It’s not trying to solve world hunger.  Just invent your own tags, group them into structures that make sense for your domain and voilà.  It is very simple and it is this same simplicity that helped HTML take the world by storm.   XML then improved on HTML by providing a clean separation between data and UI.  It brought MVC to the masses so to speak. 
 
The other day my 12 year old son was all excited and just had to show me what he discovered.  He was editing Age of Empires XML files to tweak the behavior of the game using Notepad.    I asked him how he knew that he could do that and how he knew the XML syntax.  He didn’t know what “syntax” meant, but he knew how to edit XML!  Then the same week my doctor was all excited when he heard I worked on XML because he was involved in a software purchasing decision at our local hospital and it came down to their level of XML support.  I couldn’t believe my ears. 
 
The funny thing is that most programmers don’t really like XML.  Probably because it doesn’t use curly brackets, so most programmers treat XML a bit like the ugly duckling.  But the reality is that the whole world gets markup – to them markup makes our programming world more approachable.  There are still way too many programmers that don’t get this.                                                                                                                                                                                              
What would be your #1 tip to people learning XML, XML Schema, XSLT and XQuery?
First of all I would say that XML 1.0 is the foundation.  A must have.  Can’t go wrong there, learn it, and learn how XML encoding works – that’s the number one issue people have with XML 1.0 – people don’t take the time to understand how UTF-8 encoding works which is a pretty important foundation to XML.  Don’t worry too much about DTD, because we now have XML schema.
 
XML Schema (XSD) is a layer on top of XML 1.0.  When you need a way to describe your XML structure in “standard contract” XSD is handy and most importantly – it’s there and it’s a standard.  So don’t re-invent the wheel, but I’m not going to say that XSD is the be all and end all of data modeling, because it isn’t.  A lot of things are missing, which is why people had to invent things like Schematron, and why Microsoft is working on EDM and SML and so on.  Model driven development is now on the peak of the hype curve so I expect that modeling will be a battle ground for a long time to come.  So take a pragmatic approach to XSD - use it if it fits your purpose.  Some folks use other modeling approaches then have a tool that spits out the XSD – and that’s fine too.
 
Same goes for XQuery and XSLT – I think of these as being yet another layer above XSD.  We did XSLT and XQuery because we figured that XML is data therefore people will want ways to query and transform that data.  Makes sense, and I’ve done a lot of XSLT development, I still use it for specific tasks, but some things are a bit tedious.  I find myself escaping to script a lot.  XSLT 2.0 is a good improvement, but again, these things are not going to be the be all and end all of query and transformation languages.
 
For example, I’m a huge fan of the work they are doing in Visual Basic 9 with XML literals connected to our new Language Integrated Query (LINQ).  It makes a lot of sense, because instead of having to “escape” to script, you just write the code you need right there in place – you have a complete general purpose programming language at your finger tips.   VB-XML integration is big leap forward for VB programmers and allows those developers, who may not be as familiar with the standard XML technologies like XSLT, to easily process XML data inside their programs.  It’s a huge advantage to the VB programmer and we think it helps make VB an extremely compelling language for XML programming – it makes me want to write VB again, and I’ve heard many others say the same thing.  However, it is VB-specific so development teams that need cross-platform interoperability at the query/transform layer are likely to stick to the standard technologies like XSLT and XQuery.
 
There’s a very interesting tension going on here where general purpose languages like VB and C# are moving up into declarative space with LINQ but not going all the way into declarative, versus SQL, XQuery and XSLT which are fully declarative with no side effects, which are therefore more optimizable, but sometimes rather incomplete as programming languages go and rather hard to author in some cases.  I really don’t know how it’s going to end up.  I think we should continue innovating on both approaches and see what happens.  It should be very interesting.
 
As for all the myriad other XML standards out there, there’s a lot of hype that you have to sort though.  To me it’s a funny thing to see programmers going to town making XML more complicated with layer upon layer of new concepts.  I remember going to a conference and people were telling me “stop! – we can’t take any more”.  There is genius in simplicity.  I’m glad to see the renewed focus on simple REST-ful XML based services for this reason.  If simple works, why complicate it.  Conversely, if it isn’t simple, chances are people just won’t use it. 
 
What can we expect from Microsoft in the future in the XML arena? Will support for XQuery 1.0 and XSLT 2.0 become part of Microsoft’s offering?
Microsoft is a pretty big place, so it’s hard for me to know all that is going on with XML across the company.  But I do know about .NET, Visual Studio and SQL server.  As I’ve mentioned before we are shipping the XML support in Visual Basic 9.0 with XML literals, XML axis properties and integration with LINQ to XML.  LINQ to XML is our API which we are adding to the XML runtime in .NET 3.5, it is a new XML object model that is designed to work well with the Language Integrate Query capabilities of C# and VB.    We are also shipping some cool new features in the XML tools in Visual Studio 2008, including an incremental parser with extensibility API based on LINQ to XML that 3rd party XML designers can build on. We are also adding data breakpoints in the XSLT debugger and we have a new command line tool named “xsltc.exe” which takes XSLT and generates a .NET assembly which you can then deploy with your app instead of the XSLT source so you don’t have to compile XSLT on the server.  Anton Lapounov has a great blog that talks about that.   There is not much else new in the System.Xml runtime because  Visual Studio 2008 is essentially a service pack release of the .NET 2.0 runtime, so we’ve fixed some bugs there.  We are also working on some XML features in Silverlight and we put up a preview of our LINQ to XSD work on MSDN.  We are working on a new XSD designer and you will see more CTP's on as this takes shape. 
 
As for XQuery, you probably know we have a subset of XQuery already supported inside SQL Server.  We currently have no official plans that we can announce on a client side XQuery engine but we are definitely interested in expanding client side query processing.  LINQ offers a path to this (for both relational as well as XML).  ESQL provides another client-side investment.  We are open to customer feedback on the relative importance of client side XQuery compared to all these other possibilities.  Meanwhile we are doing some XQuery improvements in SQL Server 2008, adding LET, better datetime support, and lax validation.
 
As for XSLT 2.0 - we’ve heard from customers and understand the improvements in XSLT 2.0 over XSLT 1.0, but right now we’re in the middle of a big strategic investment in LINQ and EDM for the future of the data programming platform which we think will create major improvements in programming against all types of data.  But we are always re-evaluating our technology investments  so if your readers want to ramp up their volume on XSLT 2.0 please ask them to drop us a line with their comments.
 
Meanwhile I was rather surprised by the positive feedback to my little XML Notepad 2007 tool.  It now has over 1 million downloads and is still going strong.  Not bad for a few weeks work and no marketing.  So something about this tool hit the sweet spot.  The interesting thing there is it reaches out to the non-programmer community and I think that is the key and it has the right balance of simplicity and usability.  A Swedish customer said it is “logam” – just enough.  I think you should expect to see more from Microsoft in the future that helps to make XML something that everyone on the planet can deal with easily and in a way that integrates deeply with everything else Microsoft provides. 
 
As the XML hype is wearing off, folks are realizing that not everything that made it through the standards process needs to be implemented.   So I think you will see Microsoft continue to innovate on new XML technologies and tools like LINQ to XML and VB 9.0 XML and you’ll see Microsoft taking a more pragmatic customer-demand-driven approach to standards.    Microsoft will probably never implement every standard that comes out but I’m confident you will see Microsoft continue to be committed to the really important XML standards, like XML 1.0 and XSD, and any other standard that is essential to achieving cross-platform interoperability, including Open XML.  There is enormous power in the cross-platform reach of XML and the huge industry adoption it has and I’m happy to see that Microsoft is continuing to do some really innovative work with XML.   

On Tuesday we did a live MSDN Webcast to demo XML tools in Orcas as well as a few addons we are planning to release shortly after Orcas RTM.  The webcast is now available online (http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032355975&Culture=en-US). If you have any feedback about our tools or features, we'd like to hear it!

Below is a list of topics covered in the webcast and time markers for easier access.

XML Editor overview: 2:15
    Color-coding, formating, brace-matching, basic editing support: 2:15
    Error-checking/validation: 5:35
    New Schema Dialog: 8:05
    Snippets: 11:00
    Generating XSD from XML: 19:30
    Schema cache and schema catalogs: 20:10

XSLT Debugger: 27:25
    Debugging, xslt and data breakpoints, side-by-side viewing: 30:15
    Default templates: 33:55
    Debugging XSLT from a CLR program: 35:35

Post-Orcas addons:
    XSLT Profiler: 37:15
    XML Schema Designer: 42:40

 

Hello All,

 

In March , we posted our intention to killbit MSXML4  and encouraged users to move to MSXML6 and asked for feedback – And we received lots and lots of it. The summary is MSXML4 is still being used extensively and the suggested timeframe for killbit seemed aggressive for most customers. The lack of CAB for MSXML6 was also making the migration difficult.

 

So in the best interest of our customers , we have decided to NOT killbit MSXML4.

 

Our goal with the killbit was to ensure our customers have a safe browsing experience. And that goal is still very important to us even though we are not proceeding with the killbit.

 

To address this , we are working on 2 things –

 1. Fixing any security issues in MSXML4 and releasing an updated binary that our customers can use while they migrate to MSXML6

 2. Getting MSXML6 in band on all supported Operating Systems so that lack of a CAB does not prohibit anybody.

 

We would like to stress that MSXML4 will only be updated for security issues and is in a maintenance mode. Any/All functionality & performance improvements WILL ONLY be made in MSXML6, so all new applications should be taking dependency on MSXML6 and existing applications need to be migrated to MSXML6 in reasonable timeframe.

 

 

We are working on the details on an updated MSXML4 release timeline and will update the community as soon as we have that timeline.

 

We are still listening at  msxml4@microsoft.com .So if you have any questions/comments or need help with migration to MSXML6 , please tell us!!!

 

 

Resources:

MSXML6 can be downloaded from http://www.microsoft.com/downloads/details.aspx?FamilyID=d21c292c-368b-4ce1-9dab-3e9827b70604&displaylang=en

Migration guide to MSXML6 available at http://blogs.msdn.com/xmlteam/archive/2007/03/12/upgrading-to-msxml-6-0.aspx

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

 

Thanks

Nithya Sampathkumar

Program Manager

6 Comments
Filed under: ,

XML Tools team has released the first CTP of the XML Schema Designer - a graphical tool for working with XML Schemas. The XML Schema Designer is integrated with Microsoft Visual Studio 2008 and the XML Editor to enable you to work with XML Schema definition language (XSD) schemas. If you have used the Visual Studio editor or notepad to edit your schemas, consider downloading this CTP and using it for editing your schema files. You can download it from Microsoft Downloads site. This CTP introduces the Schema Explorer - a tool that helps you navigate, search and work with schema sets. You can view a short video of the new functionality here

Here are some of the main features that are included in this CTP. 

Details

Overview

An XML Schema can contain multiple XML Schema files. The new XML Schema Designer lets you work with a schema set. That is, when you open an XML Schema file, the XML Schema Designer opens it as a schema set, which includes any included or imported schemas.

Tree View

The Schema Explorer displays pre-compiled schema set information in a tree structure. The tree structure is organized as follows:

  • At the top level is the schema set node.
  • The second level contains the namespaces.
  • The third level contains the files.
  • The fourth level contains the global nodes. This can include elements, groups, complex types, simple types, attributes, and attribute groups.

The following is an example of the tree structure:

Schema Set

    Namespace 1

        File 1

            Global node 1

    Namespace 2

        File 2

            Global node 2

Search

The Schema Explorer enables you to search the schema set in the following ways:

  • Keyword search
  • Schema-specific search (for example, "Show All Derived Types")

Filter and Sort Feature

The Schema Explorer includes filter and sort options available on the Schema Explorer toolbar. The following filter options are available from the toolbar. The Show Namespaces and Show Schema Files options are selected by default.
  • Show Namespaces
  • Show Schema Files
  • Show Compositors (sequence/choice/all)

The following sorting options are available from the toolbar. The default is Sort By Type.

  • Sort By Type
  • Sort by Name
  • Sort by Document Order

Around Memorial Day we released a new preview release for LINQ to XSD. The download has been picked up meanwhile by blogs and search engines. I am planning to blog about X/O mapping (“Typed XML programming”) and the project somewhat more in depth shortly, but I wanted to quickly complement the download with this info:

·         Here is the download.

·         Requires Orcas Beta 1.

·         Functionality-wise identical with Alpha 0.1.

·         Some new samples related to “Data Contract” and the papers at XML 2006.

You should also check out the very much revised “Revealing the X/O impedance mismatch”. BTW, we added a new subtitle: “Changing lead into gold”.

Getting back to you very soon.

Ralf Lämmel

 

These videos provide some great information and a preview of the new XML Editor, XSLT Debugger, and EDM Wizard coming in Orcas, as well as a sneak preview of a new XSD Designer and EDM Designer that we can expect to see released after the upcoming Orcas release.
2 Comments
Filed under: , , ,

I have received a number of requests over a period of time asking how to get all the facets defined on simple types or complex types with simple content in an XML Schema. I recently wrote a code sample for the same and I thought i will post it for wider consumption. The code sample will handle restrictions on lists, unions as well as facets defined on base types.

 public static void GetSchemaTypeFacets(XmlSchemaType schemaType) {

  if (schemaType == null || schemaType.Datatype == null) { //Complex type with complex content
   return;
  }

  XmlSchemaSimpleType st = schemaType as XmlSchemaSimpleType;
  if (st != null) {
   GetSimpleTypeFacets(st);
  }
  else { //Complex type simple content
   XmlSchemaComplexType ct = schemaType as XmlSchemaComplexType;
   Debug.Assert(ct != null);
   XmlSchemaSimpleContent simpleContent = ct.ContentModel as XmlSchemaSimpleContent;
   Debug.Assert(simpleContent != null);
   XmlSchemaSimpleContentRestriction simpleRest = simpleContent.Content as XmlSchemaSimpleContentRestriction;
   if (simpleRest != null) { //Can also be simple content extension
    PrintFacets(simpleRest.Facets);
   }
   GetSchemaTypeFacets(ct.BaseXmlSchemaType);

  }
 }

 public static void GetSimpleTypeFacets(XmlSchemaSimpleType st) {
   if (st == null || st.QualifiedName.Namespace == XmlSchema.Namespace) { //Built-in type, no user-defined facets
     return;
   }
   switch(st.Datatype.Variety) {
    case XmlSchemaDatatypeVariety.List:
      XmlSchemaSimpleType itemType = (st.Content as XmlSchemaSimpleTypeList).BaseItemType;
      GetSimpleTypeFacets(itemType);
    break;
 
    case XmlSchemaDatatypeVariety.Union:
      XmlSchemaSimpleTypeUnion union = st.Content as XmlSchemaSimpleTypeUnion;
      foreach(XmlSchemaSimpleType stu in union.BaseMemberTypes) {
        GetSimpleTypeFacets(stu);
      }
    break;

    case XmlSchemaDatatypeVariety.Atomic:
      XmlSchemaSimpleTypeRestriction rest = st.Content as XmlSchemaSimpleTypeRestriction;   
      PrintFacets(rest.Facets);
    break;

    default:
    break;  
  }

  if (st.BaseXmlSchemaType != null) { //Chain to the base type
   GetSimpleTypeFacets(st.BaseXmlSchemaType as XmlSchemaSimpleType); //BaseType of a simple type is always a simple type
  }
 
 }

 private static void PrintFacets(XmlSchemaObjectCollection facets) {
  foreach(XmlSchemaFacet facet in facets) {
   Console.WriteLine(facet.GetType().ToString() + " " + facet.Value);
  }    
 }

Let me know if you have any questions.

-Priya Lakshminarayanan 

 

More Posts Next page »
 
Page view tracker