Blog Home  Home Feed your aggregator (RSS 2.0)  
Implements IVillage - Friday, March 23, 2007
It takes a village to keep up with .Net
 
 Friday, March 23, 2007

Busy next couple of days.  Saturday is a double header of Orlando Code Camp then a birthday party for a co-worker (I am 3 years behind ya Paul!).  Later in the week on Tuesday is Scott Guthrie at Space Coast .Net User Group.

Friday, March 23, 2007 6:50:52 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0]    | 
 Thursday, February 01, 2007

The Space Coast Dot net User's Group has gotten Scott Guthrie to come talk at the March Meeting.  This is amazing as the group has been in existance for only a short time but is growing.  How did this happen?  Well from what I can tell, Ken Tucker (group leader and MVP) just asked.  And, Scott is in town for Connections.  So rather than have Scott do some of the canned Microsoft .Net 3.0 PowerPoint decks, we have been tossing around the idea of doing an open Q&A.  So, if you were at the meeting... What would you ask Scott?  Comment or email me!

Thursday, February 01, 2007 5:30:10 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    | 
 Wednesday, January 31, 2007

Got 71 seconds of geek fame this week.  I responded to a listener email on a show regarding searching through their old shows.  He complained that the transcripts did not have time codes in them, which it made it difficult to find the interesting content in the audio file.  I had been looking into this a few weeks back and found a site called PodZinger. This site actually gets podcasts, does text to speech on them (with time codes) and then makes the transcript searchable.  But wait! There's more!  When you search their database, you get results by podcast with the snippets of text where your terms appear.  Plus! You can then click on those snippets and actually play the audio of the found snippet.  Search is really starting to hit everything... not only the text of web pages, but now photos and audio.  Wow.  Anyway... listen to my 71 seconds of fame on DNR #212.  Listen to the whole show if you have time.  It's a great episode on high availability that makes you think about what you need to do from architechture down to coding.

Wednesday, January 31, 2007 5:21:02 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    | 
 Monday, January 15, 2007

A few months ago I came upon the need to validate some XML in an orchestration against one of the schemas in the project.  So, I turned to the wisdom of the net and came accross the desired information in the Arch hacker's BizTalk Blog:

http://thearchhacker.blogspot.com/2004/09/cool-xsd-validation-function-for.html

The code he wrote was functional and elegant.  I especailly like the way he referenced the schema in its assembly using the schema strong name.  Nice.  But alas, I was upgrading this project to BizTalk 2006 (and this .Net Framework 2.0) and was notified that: 

warning CS0618: 'System.Xml.XmlValidatingReader' is obsolete: 'Use XmlReader created by XmlReader.Create() method using appropriate XmlReaderSettings instead. http://go.microsoft.com/fwlink/?linkid=14202

So in an attempt to rid myself of the annoying compiler warnings, I set out in search of an updated version to no avail.  It was time to crack the Framework docs and do it myself.  So here it is:

        public static bool ValidateDocument( XmlDocument businessDocument, string schemaStrongName, ref string xmlValidationException )
        {
            // Constants
            const int PARTS_IN_SCHEMA_STRONG_NAME = 2;
            const int PART_CLASS_NAME = 0;
            const int PART_QUALIFIED_ASSEMBLY_NAME = 1;

            // Parse schema strong name
            string[] assemblyNameParts = schemaStrongName.Split( new char[] { ',' }, PARTS_IN_SCHEMA_STRONG_NAME );
            string className = assemblyNameParts[PART_CLASS_NAME].Trim();
            string fullyQualifiedAssemblyName = assemblyNameParts[PART_QUALIFIED_ASSEMBLY_NAME].Trim();

            // Load assembly
            Assembly schemaAssembly = Assembly.Load( fullyQualifiedAssemblyName );

            // Create instance of the BTS schema in order to get to the actual schemas
            Type schemaType = schemaAssembly.GetType( className );
            Microsoft.XLANGs.BaseTypes.SchemaBase btsSchemaCollection =
              ( Microsoft.XLANGs.BaseTypes.SchemaBase ) Activator.CreateInstance( schemaType );

            // Set up XML reader and validate document
            XmlReaderSettings ReaderSettings = new XmlReaderSettings();
            ReaderSettings.ValidationType = ValidationType.Schema;
            ReaderSettings.Schemas.Add(btsSchemaCollection.Schema);
            XmlReader reader = XmlReader.Create(new StringReader(businessDocument.OuterXml), ReaderSettings);
            
            try
            {
                while( reader.Read() ) {}
            }
            catch(XmlSchemaException xse)
            {
                xmlValidationException = string.Format("XML Validation Error: {0}", xse.Message);
                return false;
            }
            catch(Exception ex)
            {
                xmlValidationException = string.Format("Unexpected Error: {0}", ex.Message);
                return false;
            }

            // success
            xmlValidationException = String.Empty;
            return true;

        }

And it is called from an expression shape as was previously documented in the Arch hacker's blog:

ValidateDocument( myBtsMessage, myBtsMessage( BTS.SchemaStrongName ) );

 

Tuesday, January 16, 2007 12:48:57 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]    | 
 Sunday, January 14, 2007

January's meeting will be an overview of what is new in the .Net 3.0 Framework.

http://scdnug.org/blogs/events/archive/2006/11/09/Community-Launch-Part-1.aspx

Sunday, January 14, 2007 9:14:41 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    | 
 Tuesday, January 02, 2007

Been a rough new year for the whole family with the Flu. http://www.allheadlinenews.com/articles/7005804535

Hope to be back up and posting soon.

Tuesday, January 02, 2007 9:24:33 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]    | 
Copyright © 2008 Christian M Loris. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.