Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

SSIS 2012, XML Source Editor, Generate XSD.. returns errmsg 'Data at the root level is invalid. Line 1, position 1.

{ Warning:  SQL/SSIS expert, XML N00b }

Hi All

Looking for either an answer to 'How to I get around the below error', or a work-around.

I have an XML file (below) where I am being asked to flatten it and import into SQL Server.
<FlightInfo>
    <FlightKey>
        <Alc>SCX</Alc>
        <Number>0117</Number>
        <STD>2014-06-30T11:00:00Z</STD>
        <OriginIcao>KMSP</OriginIcao>
    </FlightKey>
    <Compute Timestamp="2014-06-30 09:09:00">
        <Fuels Unit="LBS">
            <Pre>27151</Pre>
            <Release>10651</Release>
            <Tankerage>16500</Tankerage>
            <Burn>3830</Burn>
            <Arrival>22996</Arrival>
            <Costs>
                <Origin Currency="USD" Quantity="USG">3.11</Origin>
                <Destination Currency="USD" Quantity="USG">4.00</Destination>
                <Savings Currency="USD">2098.98</Savings>
            </Costs>
        </Fuels>
        <Dispatcher>JOHNNY ROCKET</Dispatcher>
    </Compute>
</FlightInfo>

Open in new window

In SSIS when I open an XML Source Editor, add the path, and hit the 'Generate XSD..' button I receive an error message 'Data at the root level is invalid.  Line 1, position 1. xml-source-editor-data-at-the-root-level
0
Jim Horn
Asked:
Jim Horn
1 Solution
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorAuthor Commented:
Figured it out.  Made a copy of the .xml file and pasted it as sample.xml, then added <?xml version="1.0"?> to the top of it, saved, used that as the XML Location, and I was able to generate an .xsd file.

Will leave the question open for any professionals to suggest better ways of doing this.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now