Posts Tagged Uniform Resource Locator

Visual Studio 2010 XML Schema Errors–xsd:import


Introduction

I’ve been looking at the option for a Publish and Subscribe web service model for a development project which is starting up at work. The research into the Publish and Subscribe model has had me looking at closely at the WS-BaseNotification specification.

To take a closer look at the standard, and what would be involved in implementing this for the project I downloaded the xml schemas (XSD’s) and web service definition language (WSDL) files for the standard. These files I then loaded up into Visual Studio 2010, and that’s when the “fun started”. These files were including (xsd:import) schemas from over the web, and Visual Studio was getting errors doing this. After a quick browse on the internet, it seemed like a common problem, with some complex solutions.  So, thinking there must be a better way, I started solving the problem, my way.

The Errors

Warning          2          Request for the permission of type ‘System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

Warning          3          Request for the permission of type ‘System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

The “Fix”

I have found that the simplest way to solve these types of errors is to do the following:

  • Download the xsd file being referenced.
    • Paste the URL into IE and get the xsd file up in the browser.
    • Use File –> Save As. To save a copy of the xsd file into the Visual Studio project directory which you are keeping your source code in.
  • Add the xsd file you just downloaded to the project, and open the xml editor for that file.
  • Right click the editor tab for file you just downloaded, and select the “Copy Full Path”.
  • Then change the xsd:import from:
  <xsd:import namespace="http://www.w3.org/2005/08/addressing"
    schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"
  />

To

  <xsd:import namespace="http://www.w3.org/2005/08/addressing"
    schemaLocation="file://visual studio 2010/Projects/Project1/DummyShell/ws-addr.xsd"
  />

  • Tip: You have the file location in the clipboard from the “Copy Full Path”, so you only need to swap the \’s to /’s.
  • This makes the reference to a local copy of the schema file.

I’ve had situations where Visual Studio still gives the System.Security.Permissions.FileIOPermission exception/error after making this change. Restarting Visual Studio seemed to “clean out” the error and everything was fine after the restart.

Conclusion

Importing schemas into other schemas is a very powerful feature of xml schema language, but a real pain with Visual Studio. I’m not sure why things get so difficult, the schema cache which Visual Studio maintains seems to, in part, cause extra confusion. This approach ignores the schema cache altogether. Although I did “copy” the xml schema (xml.xsd) from the cache, into the project as well (one of the consequential dependencies required it).

Advertisements

, , , , , , ,

7 Comments

Start a new Blog? Or use the Menus Option on this one?


Introduction

I’ve been thinking about expanding the range of content which I post into the Blogosphere. The types of things I was considering posting include:

  • Recipes: Things I’ve adapted to suite my tasks and requirements.
    • Cooking Tips: There are things one picks up, learns or discovers, which could make useful reading.
    • I should start writing about “Cooking for One”. This I find is a very is a poorly serviced element in the cooking and culinary arts sphere. Almost all of the recipes I find are for family meals. So, unless you fancy eating leftovers for a week, or freezing the remainder until you feel like eating it again, they are not much help. Downscaling recipes is something which I do experiment with at time, and I’m getting better a doing this as time goes on. Oh, the joys of being a single cook.
    • I also have two other “niche” cooking styles which are worth blogging about. These are:
      • RC (Remote control) cooking. An old style of cooking which is often done mainly in the oven. The main principle is; set the timer, and forget, until the timer rings and dinner is done.
      • “Commando” Cooking. This is the “hit and run” cooking. The main principle here is a fast as possible. Switching the stove on,  to completed meal, in the minimum of time.
    • Guitar Stuff: Sheet music which I use to practice, maybe some Guitar Pro files as well.  If I start posting files, they will have to go on my “Sky Drive”, WordPress would not recognise Guitar Pro files as being a valid upload file type.
    • Creative writing: One of my motivations for starting blogging was to get back into doing some creative writing. This objective is something which I’ve been remiss in, thus far.

    The Pro’s Of Using The Menus Option

    There is a fundamental reason why utilisation of the “Menus Option” should work, or at least the experiment is worthwhile performing. That reason is that the structure of the menus can “invert” the nature of a blog. The meaning of “invert” in this context is that: A blog is a chronological series of posts where the latest entry is at the “top”. The “inversion” that the menu option allows is for the first written (the oldest ,or chapter 1 in the case of a book) to be presented as the first entry in a list (be that a menu, or a list of links on a page).

    There are a number of reasons to think that going down this track is going to be the most profitable approach. These reasons include:

    • the WordPress advice contained in the “Write a Book” help page. The nub of the discussion on that page is that it is possible to write a book on WordPress. The set up is something which will require some thought. The advice is around “Chapters” of a book. A present, I think, I’ll be writing short stories, rather than a book. But that is my expectation at present, which may well change when I start writing.
    • the WordPress advice contained in the “Custom Menus” help page. The demonstration of the implementation describes setting up the type of structure which some of the “new” content could be. So, again there is advice that expanding the types of content in a blog should work.
    • Looking around the blogs on WordPress, I’ve seen examples which seem to work. So, I’ve some other peoples good ideas, I can copy and adapt to my own ends.

    The Con’s of Using The Menu Option

    There are a couple of things which are potential negatives for the menu approach. These downsides include:

    • I’ve no way of setting the menu option up in a “sandpit” (a not online environment).  I’d not like to “kill” my live site with the modifications. It’s probably doable, only adding the top level menus when I’ve all of the underlying elements working right. I should post a question on the WordPress.com Forum about a “sandpit” environment.
      • And before I get the comment, just install the WordPress.Org version of WordPress, and work on that version. My poor notebook would melt down if I added another web server, web sites and the like to it. Time for an upgraded notebook, maybe, but that’s a story for another day.
    • I’m not sure that adding more topics into the current blog is “right”. I’m not sure what the correct blogging etiquette is. Is multiple topic blogging “best practice” blogging? This is a small concern for the following reasons:
      1. The title, and tag line, on the blog, “Craig’s Eclectic Blog”, and “An eclectic collection of thing that catch my eye”. These statements allow me to, within reason,  to pretty much include whatever I choose. There is a warning that there will be a mixture of subject matter found here.
      2. It’s my blog. The corollary of that is: “I make the rules for what gets blogged about!”.
      3. I blog for pleasure, not for money, and not for fame. So, mixing topics may be a commercially poor choice for professional bloggers. But for amateur blogging, it’s probably acceptable.

    A Plan Of Attack

    As alluded to above I think I will use the menu option for adding new types of content to this blog.

    The development and implementation strategy:

    1. I think I can quarantine the additions to the structure of the blog site from the main part of the site. This should prevent me “breaking” the main part of the site.
    2. This will be a process of developing the subpages independently. So long as I can get a URL to the page so I can test in the browser. I will be able to get to the pages as I development the through the “Administration Console –> Pages” menu as well.
    3. Testing components as I build them.
    4. When all is working, then adding the Menu to the “Top” (home page) of the site, and wire up the menu to go to the URL of the new page(s).

    That’s the theory.

  • Next comes the practice. But, “there’s many a slip, betwixt cup and lip”, and “the proof of the pudding is in the eating”.

    , , , , , , , ,

    Leave a comment

    This should look better


    I have spent a couple of hours of mucking around with the settings on this site. Now, I think I have sorted out most of the options I want to have in this blog (for now, as always the editor reserves the right to correct, modify, or just plain fiddle about), with a look and feel which is reasonable.

    There is one big feature from the Windows Live Blog which is missing WordPress. This feature was the is the list option.  On the Windows Live Blog I had lists of books which I was reading, or had read. These lists were looking up the cover art from Amazon, and would link to the book on Amazon. I’ll have to have a think about how to implement on this site. It will be a case of out with the “roll your own HTML”, maybe I’ll need to have some script as well (if one can embed script in the HTML on this site – further research has shown that script is not allowed, so I’ll have to stick with “vanilla HTML”). The basic HTML is not too hard, just an <img src="" alt="" > tag with the correct URL and other bits of navigation. Doing the same for CD’s would be interesting as well. Finding a site of CD cover art would be the “tricky bit”, the one that Windows Media Player uses would be a good starting point.

    After some fiddling about with HTML, Amazon and W3Schools I think I have something which will work for books. I still need to test it this solution on WordPress from within my blog. That testing will come in the next couple of days. The interesting next step will be to see if I can get something working for CD’s, and then DVD’s after that. Amazon may be a source for the CD’s, but I’ve yet to explore that, and the breadth of the CD selections on Amazon.

      

    WordPress Tags: Windows Live List,List,WordPress,Windows Live,Blog,Amazon,HTML,script,Windows Media Player

     

    , , , , , , ,

    2 Comments

    %d bloggers like this: