IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

SQL Server generated inline xsd could not validate Options · View
dalby@sdu.dk
Posted: Wednesday, December 4, 2019 4:20:32 PM
Rank: Newbie

Joined: 12/4/2019
Posts: 1
Location: Denmak
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
K101
Posted: Thursday, December 5, 2019 8:21:01 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 401
XMLSpy doesn't presently support validating against inline schemas, but it'll be taken under consideration for the future.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.