CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    381

    Creating XML Schema in VS.NET...

    Hi!
    I've created an XML file in VS.NET.
    I've created a Schema with "Create Shema" on the XML-menu.

    My XML-file then look like this:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <ROOT xmlns="http://tempuri.org/XMLFile1.xsd">
    <ELEM>
    </ELEM>
    </ROOT>
    The Schema-file (XMLFile1.xsd) now exists in the current dir.
    How do I now validate my XML against that Schema?

    When I press: "Validate XML Data" on the on the XML-menu I got the following error:
    Visual Studio could not locate a schema for this document. Validation can only ensure this is a well formed XML document and cannot validate the data against a schema.
    ...and justice for all

  2. #2
    Join Date
    May 1999
    Posts
    18

    Re: Creating XML Schema in VS.NET...

    This should help:
    Save the XSD from the webpage into this folder:
    C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml
    This is the secret place where VS.NET looks for schemas.

    Then open an XML file in the VS editor, and click inside it. Go to the Properties window, and set targetSchema using the dropdown to the nant schema, which it will now find. (This just puts in the correct xmlns attribute.) Then validation and intellisense should work fine.
    Regards, RD

  3. #3
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    381

    Re: Creating XML Schema in VS.NET...

    Thanks! That helped!
    ...and justice for all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured