Solved

XML parsing: line 2, character 6, text/xmldecl not at the beginning of input

Posted on 2010-09-13
1
4,417 Views
Last Modified: 2012-08-13
Hi,

I am trying to create xml schema collection as follow:
use xmltest

create xml schema collection dbo.xmlProjectSchemaCollection as
'
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="project">
      <xs:complexType>
       <xs:sequence>
      <xs:element name="projectnumber" type="xs:int"/>
      <xs:element name="projectname" type="xs:string"/>
      <xs:element name="startdate" type="xs:date"/>
      <xs:element name="enddate" type="xs:date"/>
      <xs:element name="manager" type="xs:string"/>
      <xs:element name="scope" type="xs:string"/>
       </xs:sequence>
      </xs:complexType>
</xs:element>
</xs:schema>
'
However I am getting the following error when I executed the code above:
XML parsing: line 2, character 6, text/xmldecl not at the beginning of input

Why am I getting this error?   Could you please tell me how to fix?

Thanks~
0
Comment
Question by:IzzyTwinkly
1 Comment
 
LVL 5

Accepted Solution

by:
David Christal CISSP earned 500 total points
ID: 33668493
try this:

create xml schema collection dbo.xmlProjectSchemaCollection as
'<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="project">
<xs:complexType>
<xs:sequence>
<xs:element name="projectnumber" type="xs:int"/>
<xs:element name="projectname" type="xs:string"/>
<xs:element name="startdate" type="xs:date"/>
<xs:element name="enddate" type="xs:date"/>
<xs:element name="manager" type="xs:string"/>
<xs:element name="scope" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>'
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Question 5 25
SQL - SP needs a little help 9 20
ms sql last 8 weeks as columns 5 26
C# guarantee sql connection close 6 13
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now