Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLvalidation error using XSD (syntax issue?) 1

Status
Not open for further replies.

lauridsd

MIS
Dec 13, 2000
7
US
I really need some help gang, I can totally stuck. I am using XMLValidate in ColdFusion 8 to validate generated XML content against an XSD. The problem is that I cannot seem to make the value of a simple string based element "required". I assume it is a basic syntax issue in the XSD, but everything I have read online indicates that my syntax is ok.

Here is the relevant snippet from the XSD:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs=" <xs:element name="transaction">
<xs:complexType>
<xs:sequence>
<xs:element name="location">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minlength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="terminal_id" type="xs:string" />
...

Here is the relevant section of the generated XML :

<?xml version="1.0" encoding="UTF-8"?>
<transaction xmlns:xsi="xsi:noNamespaceSchemaLocation=" code="1" description="Report Fault" ID="0000000000000027" status="">
<location></location>
<terminal_id>DOC</terminal_id>
...

And here is the error from the "errors" sections of the results structure returned by XMLValidate:

"[Error] :9:32: s4s-elt-must-match.1: The content of 'restriction' must match (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)). A problem was found starting at: minlength. "

I receive this error even if I populate the value of the location tag in the XML, so I know it isn't that.

What is the syntax that the XMLValidate method is expecting? How do I "properly" enforce required values for string elements?

Any and all help would be appreciated.

Thanks!

David
 
><xs:minlength value="3"/>
[tt]<xs:min[red]L[/red]ength value="3"/>[/tt]
 
Oh. My. God.

Thanks, tsuji! I feel like a complete idiot, but that was, in fact, the problem.

Stupid case sensitivity!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top