Re: Exporting SQL Server data to XML
- From: Amir Tohidi <AmirTohidi@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Feb 2009 08:13:19 -0800
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>
- References:
- Re: Exporting SQL Server data to XML
- From: Joe Fawcett
- Re: Exporting SQL Server data to XML
- Prev by Date: Re: XQuery - Only return if not null
- Next by Date: OPENXML to accept both attributes and elements
- Previous by thread: Re: Exporting SQL Server data to XML
- Next by thread: Fast Import/Export of XML data into a Microsoft SQL Server database
- Index(es):
Relevant Pages
|