hi all ,
when m trying to validate my xml using xsd file it gives me the following error
"Data at the root level is invalid. Line 1, position 1"
i tried to open the XML file using IE and there are no errors and there are no blank space before the root element.the xml is created dynamically and it is send as a string to validate. the dynamically generated xml string is the following.
<?xml version="1.0" encoding="utf-8" ?>
<MessageEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Email retryattempts="1">
<Message>
<From>NotificationEmail</From>
<Recipients>
<Recipient recipientid="email@gmail.com" retryattempts="1" templateid="0" subject="email" />
</Recipients>
<Subject>email</Subject>
<Body>hi this is email body</Body>
<TemplateId>0</TemplateId>
</Message>
</Email>
<Sms retryattempts="0">
<Message>
<From>Notificationsms</From>
<Recipients>
<Recipient recipientid="9986267364" retryattempts="0" templateid="0" subject="SMS" />
</Recipients>
<Subject>SMS</Subject>
<Body>sms message</Body>
<TemplateId>0</TemplateId>
</Message>
</Sms>
</MessageEntity>
and the schema file is the following.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Notification">
<xs:complexType>
<xs:sequence>
<xs:element name="Email">
<xs:complexType>
<xs:sequence>
<xs:element name="Message">
<xs:complexType>
<xs:sequence>
<xs:element name="From" />
<xs:element name="Recipients">
<xs:complexType>
<xs:sequence>
<xs:element name="Recipient">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="recipientid" type="xs:string" use="required" />
<xs:attribute name="retryattempts" type="xs:string" use="required" />
<xs:attribute name="templateid" type="xs:string" use="required" />
<xs:attribute name="subject" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Subject" />
<xs:element name="Body" />
<xs:element name="TemplateId" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="retryattempts" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="Sms">
<xs:complexType>
<xs:sequence>
<xs:element name="Message">
<xs:complexType>
<xs:sequence>
<xs:element name="From" />
<xs:element name="Recipients">
<xs:complexType>
<xs:sequence>
<xs:element name="Recipient">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="recipientid" type="xs:string" use="required" />
<xs:attribute name="retryattempts" type="xs:string" use="required" />
<xs:attribute name="templateid" type="xs:string" use="required" />
<xs:attribute name="subject" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Subject" />
<xs:element name="Body" />
<xs:element name="TemplateId" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="retryattempts" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
can anyone help me plz...
regards,
John