Oops! Apparently <xs:length value="50"/> means the element text MUST be 50
characters long. <xs:maxLength value="50"/> does the trick.
"Don Miller" <nospam@nospam.com> wrote in message
news:%23ZpG2FwoHHA.5084@TK2MSFTNGP02.phx.gbl...
>> Have you tried to compare the original XSD vs. the one in Visual Web
>> Developer? In what way has it changed?
>
> They were identical. I opened the original in NotePad, selected and copied
> the text, opened the copy in Visual Web Developer and pasted it in, saved
> it, and now that part seems to work. I don't know why.
>
> But when I try to validate my XML file before BulkLoading using a
> ValidateFile function
> (
http://msdn2.microsoft.com/en-us/library/ms171806.aspx) from MS I still
> get the
>
> 'DANNER' violates length constraint of ' 50'
> The element 'LastName' with value 'DANNER' failed to parse.
>
> for an element like this <LastName>DANNER</LastName> where the XSD uses a
> derived type
>
> <xs:simpleType name="VARCHAR_50">
>
> <xs:restriction base="xs:string">
>
> <xs:length value="50"/>
>
> </xs:restriction>
>
> </xs:simpleType>
>
> <xs:element name="LastName" type="VARCHAR_50" sql:datatype="varchar"/>
>
> This is probably an entirely separate problem, something to do with
> MSXML2.XMLSchemaCache.6.0 and MSXML2.DOMDocument.6.0 objects and not
> because of Web Developer. If I susbstitute type="xs:string" instead of
> VARCHAR_50 it works but I lose my pre-load checking. But with this parse
> error, if I ignore it and continue with the bulkload, the load still
> works! Any ideas???
>
>
>
>
> "John Saunders [MVP]" <john.saunders at trizetto.com> wrote in message
> news:Op7yxdvoHHA.588@TK2MSFTNGP06.phx.gbl...
>> "Don Miller" <nospam@nospam.com> wrote in message
>> news:u3C2WruoHHA.4220@TK2MSFTNGP04.phx.gbl...
>>>I have a bizarre problem when I try to validate XML documents and their
>>>schemas once they have been opened and transfered to a Visual Web
>>>Developer 2005 Express project. I receive validation errors for XML/XSDs
>>>that worked fine when first created in another environment (XMLSpy
>>>trial).
>>>
>>> I have a source XML document and an XSD file created wtih XMLSpy and
>>> stored in a separate folder. When I run a very simple VBScript to
>>> validate the XML with the XSD (in the process of a bulkload to SQL
>>> Server with SQLXMLBulkload.4.0), there are no validation errors, and the
>>> load to the DB works perfectly.
>>>
>>> When I try to use the exact same VBScript to bulkload copies of the same
>>> files from before, which were duplicated and added to a Visual Web
>>> Developer project, I get validation errors like
>>>
>>> "Schema: unable to load schema 'XXXX'. An error occurred (Text is not
>>> allowed in the context of
>>> element'{
http://www.w3.org/2001/XMLSchema}sequence' according to
>>> DTD/Schema"
>>>
>>> And then I get a validation error for a simple type like:
>>>
>>> 'DANNER' violates length constraint of ' 50'
>>> The element 'LastName' with value 'DANNER' failed to parse.
>>>
>>> with the source <LastName>Danner</LastName> for the simple type below
>>>
>>> <xs:simpleType name="VARCHAR_50">
>>> <xs:restriction base="xs:string">
>>> <xs:length value="50"/>
>>> </xs:restriction>
>>> </xs:simpleType>
>>>
>>> So, it seems like the XSD file has been changed somehow and cannot be
>>> parsed or is stricter???? Are there changes to the encoding or
>>> whitespace when an XSD file is opened/transferred to Visual Web
>>> Developer 2005 Express?
>>
>> Have you tried to compare the original XSD vs. the one in Visual Web
>> Developer? In what way has it changed?
>> --
>> John Saunders [MVP]
>>
>>
>
>