Hi I am having a hard time with validation of my XML file with given schema.
Here are the files:
roboerrorlog.xsd
<robomss:schema xmlns:robomss="http://www.w3.org/2001/XMLSchema"
xmlns="robomss"
elementFormDefault="qualified" targetNamespace="robomss">
<robomss:element name="roboErrorLog" type="errorLogType"/>
<robomss:complexType name="errorLogType">
<robomss:sequence maxOccurs="unbounded">
<robomss:element name="error" type="errorType"/>
</robomss:sequence>
</robomss:complexType>
<robomss:complexType name="errorType">
<robomss:sequence>
<robomss:element name="user" type="robomss:string"/>
<robomss:element name="datetime" type="robomss:string"/>
<robomss:element name="message" type="robomss:string"/>
<robomss:element name="stack" type="stackType"/>
</robomss:sequence>
</robomss:complexType>
<robomss:complexType name="stackType">
<robomss:sequence>
<robomss:element name="functionName" type="robomss:string"/>
<robomss:element name="lineNumber" type="robomss:string"/>
</robomss:sequence>
</robomss:complexType>
</robomss:schema>
roboerrorlog.xml
<?xml version="1.0" encoding="utf-8"?>
<roboErrorLog xmlns:robomss="http://www.w3.org/2001/XMLSchema">
<error>
<user>steve</user>
<datetime>12/18/2007 2:31:33 PM</datetime>
<message>Null reference error!</message>
<stack>
<functionName>Void btnSearch_Click(System.Object,
System.EventArgs)</functionName>
<lineNumber>300</lineNumber>
</stack>
</error>
<error>
<user>steve</user>
<datetime>12/18/2007 2:31:38 PM</datetime>
<message>Null reference error!</message>
<stack>
<functionName>Void btnSearch_Click(System.Object,
System.EventArgs)</functionName>
<lineNumber>300</lineNumber>
</stack>
</error>
<error>
<user>steve</user>
<datetime>12/18/2007 2:31:43 PM</datetime>
<message>Null reference error!</message>
<stack>
<functionName>Void btnSearch_Click(System.Object,
System.EventArgs)</functionName>
<lineNumber>300</lineNumber>
</stack>
</error>
<error>
<user>steve</user>
<datetime>12/18/2007 3:22:37 PM</datetime>
<message>Null reference error!</message>
<stack>
<functionName>Void btnSearch_Click(System.Object,
System.EventArgs)</functionName>
<lineNumber>300</lineNumber>
</stack>
</error>
<error>
<user>steve</user>
<datetime>12/18/2007 3:22:38 PM</datetime>
<message>Null reference error!</message>
<stack>
<functionName>Void btnSearch_Click(System.Object,
System.EventArgs)</functionName>
<lineNumber>300</lineNumber>
</stack>
</error>
</roboErrorLog>
When I pass these files to a validator it has an issue with the roboErrorLog
declaration.
Now the weird thing is if I change the namespace in the opening tag to
xmlns="robomss" than the validator sees it as valid
So the valid tag looks like <roboErrorLog xmlns="robomss"rather than
<roboErrorLog xmlns:robomss="http://www.w3.org/2001/XMLSchema">
If anyone knows what the issue is I'd appreciate your help.