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

sglai has asked for the wisdom of the Perl Monks concerning the following question:

Need help on this. I am running this on Win32. Thanks.
use XML::Pastor; $pastor = XML::Pastor->new(); $pastor->generate( mode =>'offline', style => 'multiple', schema=>'my. +xsd', class_prefix=>'MyApp::Data', destination=>'.');
Can't locate object method "effectiveAttributes" via package "XML::Pas +tor::Schema::SimpleType" at...

Replies are listed 'Best First'.
Re: xml-pastor runtime error?
by ramrod (Curate) on Mar 07, 2009 at 16:34 UTC
    It seems to me that something's worng with your schema. I used one of the examples from the w3schools website, and the your code executed with no errors. Here's the sample xsd I used:
    <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified"><xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element></xs:schema>
    Provide some info towards what you need your data to look like for better help.
Re: xml-pastor runtime error?
by kennethk (Abbot) on Mar 07, 2009 at 15:41 UTC

    Please read Writeup Formatting Tips, especially the section on <code> tags.

    Are you certain your .xsd is valid? Can you post it so we can replicate the issue? There are no bug reports on this issue registered with CPAN.

Re: xml-pastor runtime error?
by Anonymous Monk on Jun 09, 2009 at 15:33 UTC
    I experienced similar errors in two situations: (1) When you have multiple inheritance (your XSD elements are of extended type, where your class needs to have 'SimpleType' as well as your type in @ISA array, but Pastor adds only one). (2) When your XSD does not specify 'type' for any leaf elements (your generated code shows 'class' => undef). Check for these two situations. -Bhaskar