http://www.perlmonks.org?node_id=431790


in reply to Re: .XSD (schema) Validation issue
in thread .XSD (schema) Validation issue

Sam,

Thanks for posting!
Yes, I made sure to read the documentation very closely but it didn't seem to shed any light on this particular error - other than "SimpleTypes must come after their base types in the schema body."

I searched through the module source and found where the error was being generated:

_err("Found <simpleType> illegally combined with complexType>.") if $mother->{is_complex};

By "illegally combined" does the error mean simpleType cannot be a child (or parent) of complexType?

I hope the following .xsd snippet will be helpful as it seem s exemplary of the file as a whole.

SAMPLE XSD MARKUP

<xsd:element name="Phone" type="PhoneType" minOccurs="0"/> <xsd:element name="Fax" minOccurs="0"> <xsd:complexType> <xsd:sequence> <xsd:element name="F_AreaCode" nillable="1"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:length value="3"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="F_Prefix" nillable="1"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:length value="3"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="F_Suffix" nillable="1"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:length value="4"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element>

END SAMPLE XSD

Any help is appreciated.

j

Replies are listed 'Best First'.
Re^3: .XSD (schema) Validation issue
by samtregar (Abbot) on Feb 17, 2005 at 00:09 UTC
    Yes, I made sure to read the documentation very closely but it didn't seem to shed any light on this particular error

    I wouldn't expect that it would. XML::Validator::Schema has terrible failure behavior. If it's trying to process a schema which is doing things it can't support it won't generally give you much help figuring out why.

    I hope the following .xsd snippet will be helpful

    Not particularly... I don't see any place in that snippet where a simpleType is the (direct) child of a complexType. Are you sure you've found the problem?

    Here's what I need if I'm going to find and fix this bug:

    • A small, complete XSD file containing the problematic construct. No more than 20 lines would be ideal.
    • A small XML file which you posit should validate against the sample XSD. Again, smaller is better.

    In some cases I can create these myself but you haven't given me enough information to do the job.

    Thanks,
    -sam

      Sam,

      I would be happy to help but I'm quite new to the XML/XSD front. Tearing that xsd file down to a manageable size without understanding the intricacies would most likely prove useless. I would be happy to send you the .xsd and sample .xml file that I have been working with. They are large but they validate in XMLSpy and are the ones causing trouble with your mod.

      Let me know.

      j
        Well, alright, but just this once. Send them to me at sam@tregar.com.

        -sam