dalby@sdu.dk |
Newbie |
|
Denmak |
|
|
None Specified |
|
Wednesday, December 4, 2019 |
Wednesday, December 4, 2019 4:23:26 PM |
1 [0.01% of all post / 0.00 posts per day] |
|
I have generated an XML with an inline xsd schema in in MS SQL Server. XML Spy cannot validate it
I get errror:
Unable to locate a reference to a supported schema type (DTD, W3C Schema) within this document instance.
but it is inline!?
Is SQL Server generating invalid XML?
Code:<Drugs> <xsd:schema targetNamespace="Drugs.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes" elementFormDefault="qualified"> <xsd:import namespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" schemaLocation="http://schemas.microsoft.com/sqlserver/2004/sqltypes/sqltypes.xsd" /> <xsd:element name="row"> <xsd:complexType> <xsd:attribute name="Case_No" type="sqltypes:int" use="required" /> <xsd:attribute name="Drug_No" type="sqltypes:int" use="required" /> <xsd:attribute name="TradeName"> <xsd:simpleType> <xsd:restriction base="sqltypes:varchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52"> <xsd:maxLength value="30" /> </xsd:restriction> </xsd:simpleType> </xsd:attribute> <xsd:attribute name="ATCCode"> <xsd:simpleType> <xsd:restriction base="sqltypes:varchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52"> <xsd:maxLength value="8" /> </xsd:restriction> </xsd:simpleType> </xsd:attribute> <xsd:attribute name="GenericName"> <xsd:simpleType> <xsd:restriction base="sqltypes:varchar" sqltypes:localeId="1033" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth" sqltypes:sqlSortId="52"> <xsd:maxLength value="60" /> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:schema> <row xmlns="Drugs.xsd" Case_No="45" Drug_No="1" TradeName="XXXX" ATCCode="XXXX" GenericName="XXXX" /> <row xmlns="Drugs.xsd" Case_No="1" Drug_No="1" TradeName="XXXX" ATCCode="XXXX" GenericName="XXXX" /> </Drugs>
I have used following SELECT in MSSQL:
Code:SELECT [Case_No] ,[Drug_No] ,[TradeName] ,[ATCCode] ,[GenericName] FROM [DrugsAahus] for xml raw, root('Drugs'), XMLSCHEMA ('Drugs.xsd')
Thanks in advance
Kind regards Soeren
|
|