Re: Exporting SQL Server data to XML



Hi

Thanks for the reply.

Came across Altova's MapForce which I think will do the job. Looks great and
very easy to use to.


"Joe Fawcett" wrote:

I don't think there's a built in way to create XML that conforms to a known
schema. I would just use a FOR XML PATH query and hand craft it. Can be
difficult, I know.
There are tools that can show you what the instance document should look
like if you don't understand XML Schema documents. (Visual Studio 2008 SP1
for example, load the schema, right click the root element and create an
instance.)

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name
"Amir Tohidi" <AmirTohidi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7D3C21E0-A540-4914-A452-86EBD065C3AE@xxxxxxxxxxxxxxxx
Hello

Can anyone please suggest the best way to address the following problem (I
did Google, but couldn't find anything):

I have been given a SQL Server database and an XSD file. The requirement
is
to export the SQL Server data into an XML document that conforms to the
supplied XSD.

I am .NET / SQL Server developer, yet I have not previously had to do
anything like this. More importantly, I have not done any XSD stuff
before.

Does SQL Server / .NET Framework help with this? I need the simplest
solution possible please as time is of the essence.

Thanks
Amir

Excerpt from the XSD:


<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 sp1 (http://www.altova.com) by Richard
(Department For Education & Skills) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:bs7666="http://www.govtalk.gov.uk/people/bs7666";
xmlns:core="http://www.govtalk.gov.uk/core";
<xs:element name="ParticipantInformation">
<xs:annotation>
<xs:documentation>ESF2007 Participant training event
information</xs:documentation>
<xs:appinfo>
<Creator>Project ESF2007</Creator>
<Created>2008-05-20</Created>
<Modified>2008-05-22</Modified>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="ProvidingOrganisation">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TransferDate" type="core:DateType"/>
<xs:element ref="Region" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="SchemaVersion" type="xs:NMTOKEN" use="required"
fixed="0.3"/>
</xs:complexType>
</xs:element>
<xs:element name="Region">
<xs:complexType>
<xs:sequence>
<xs:element name="RegionCode">
<xs:simpleType>
<xs:restriction base="RegionCodeType"/>
</xs:simpleType>
</xs:element>
<xs:element name="RegionName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element ref="Agreement" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>




.



Relevant Pages

  • Re: SQL Server to .xsd
    ... > output an XSD from an entire database schema, ... > "Val Mazur" wrote: ... >> Do you need to get schema of specific table in a SQL Server? ...
    (microsoft.public.data.ado)
  • Re: SQL Server to .xsd
    ... output an XSD from an entire database schema, ... > Do you need to get schema of specific table in a SQL Server? ...
    (microsoft.public.data.ado)
  • Re: Exporting SQL Server data to XML
    ... I don't think there's a built in way to create XML that conforms to a known schema. ... There are tools that can show you what the instance document should look like if you don't understand XML Schema documents. ... I have been given a SQL Server database and an XSD file. ...
    (microsoft.public.sqlserver.xml)
  • Re: multiple cascade paths
    ... You should not have them if your schema is designed properly. ... make you understand that I tried to show that a proper design can have ... am a SQL Server MVP, for crying out loud - you can safely assume that I ...
    (comp.databases.ms-sqlserver)
  • Re: Need help on how to organize users and objects
    ... Yes Oracle is a bit different than Sql Server, but I think you will get the ... It doesnt become part of any schema until you assign it. ... a new developer started to work. ... need the COMMON database which stores tables with generic data and generic ...
    (microsoft.public.sqlserver.security)