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

  • 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.
    <Compute Timestamp="2014-06-30 09:09:00">
        <Fuels Unit="LBS">
                <Origin Currency="USD" Quantity="USG">3.11</Origin>
                <Destination Currency="USD" Quantity="USG">4.00</Destination>
                <Savings Currency="USD">2098.98</Savings>
        <Dispatcher>JOHNNY ROCKET</Dispatcher>

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
Jim Horn
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.

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