???? ID: 317611 - ????? ???????: 04 ?????? 2010 - ??????: 2.0

BUG: ?????? "###" ??????? ?? ????? XSD ?????? ????? ?????? ?? reference declared ???? ??

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.

?? ????? ??

??? ?? ??????? ???? | ??? ?? ??????? ????

?????

??????? ??????????? ??? .NET ????? XSD ?????? ??????? ?? ?????? ?? ??? ????? XSD ?? ??????? referencing ?????? ?? targerNamespace ?????? ???? (??? "chameleon" ?? ?????? ???? ???? ????? ???)? ?????? ?? ???, ????? a.xsd ????? b.xsd ?? c.xsd ??????? ????? ???? ??:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 	targetNamespace="test">

	<xsd:include schemaLocation="b.xsd" />
	<xsd:include schemaLocation="c.xsd" />
</xsd:schema>
				
B.xsd, ?? ???? ?? testType ?????? ????????? ??:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:simpleType name="testType">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="test"/>
		</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>
				
???? c.xsd, ??????? testType ?????? ?? ??? declared ??:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:element name="test" type="testType"/>             <!-- this fails, but it should not fail -->
</xsd:schema>
				
????? ?????? ????? ?? a.xsd ?????? ???? ?? ??? ???? ??? ??:
"?????? 'testType' ?? ???? declared." c.xsd ???

????????

?? ?????? ?? ?? ???? ?? ??? ??? xmlns ????? c.xsd ????? ??? ????? declaration "????" ?? ?????? ?? ??? =:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="test">
	<xsd:element name="test" type="testType" xmlns="test"/>              
</xsd:schema>
				

??????

Microsoft ?? ?????? ?? ?? Microsoft ??? ?? ?? ?? ?? ???? ?? ???? ??? ???????? ?????????

???? ???????

?????? ?? ???: ??????? ???? ?? ??? ???

  1. ????? a.xsd ????? ?? c:\temp ??????? ??? ??????? ???? ??????? ?? ??????? b.xsd ?? c.xsd ??????? ?? a.xsd ?? ??? ??? ???????
  2. ??? C# ????? ????????? ??????
  3. ??? ?? ???????????? ????? ??? ?? ??? Class1.cs ????? ????? ??:
    using System;
    using System.IO;
    using System.Xml;
    using System.Xml.Schema;
    
    namespace ValidationTest
    {
    	class Sample
    	{
    		public static void Main()
    		{
    			try
    			{
    				XmlSchemaCollection sc = new XmlSchemaCollection();
    				sc.Add("test", "c:\\temp\\a.xsd");
                                    Console.WriteLine("No Schema error.");			
    			}
    			catch(XmlSchemaException ex)
    			{
    				Console.WriteLine("XSD schema Error: {0}", ex.Message);
    			}
    			
    			Console.Read();
    		}
    	}
    }
    					
  4. ?????? ????, ?? ??? ????????? ?? ?????? ?????? ????? ??? ????? ?????? ????? ???? ??:
    XSD ?????? ??????: '????' ?????? declared ???? ??? File:///c:/temp/c.xsd(2, 3) ?? ??? ?????? ??????? ????
  5. C.xsd ???? ?????, ?? ?? xmlns ????? = "????" ???? ?? ??? xsd:element, ?????? ?? ???:
    <xsd:element name="test" type="test" xmlns="test"/>
    					
  6. ?????? ????, ?? ??? ????????? ?? ?????? ?????? ????? ??? ????? ?????? ???? ??:
    ??? ?????? ???????

???? ???? ???? ??:
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2003 Professional Edition
??????: 
kbvs2002sp1sweep kbbug kbenv kbmt KB317611 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:317611  (http://support.microsoft.com/kb/317611/en-us/ )