Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-09-13
1
Medium Priority
?
4,834 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

971 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