Skip Menu |

This queue is for tickets about the XML-Compile CPAN distribution.

Report information
The Basics
Id: 53392
Status: resolved
Priority: 0/
Queue: XML-Compile

People
Owner: Nobody in particular
Requestors: NIKOLAS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.10
Fixed in: (no value)



Subject: length work not correctly for xsd:list
In the documentation it is told that it is "lenght" for the list should to define a stake-in of elements in the list, instead of lenght each element as it works in XML:: Compile

---------------------------------------------------------------------------------------------------------------------------------
List Types

Whereas enumerated types force an XML developer to use a value from a predefined set of values, list types allow an XML developer to provide multiple values for a given element. The xsd:list element is used to create list types, which are useful any time you need to allow for a list of information. As an example, you might want to create an element that stores rainfall totals for each month of the year as part of an XML-based weather application. Following is code that carries out this function:

<xsd:element name="rainfall">
  <xsd:simpleType>
    <xsd:list base="xsd:decimal">
      <xsd:length value="12"/>
    </xsd:list>
  </xsd:simpleType>
</xsd:element>

This code allows you to list exactly 12 decimal numbers, separated by white space. Following is an example of what the XML code might look like for the rainfall element:

<rainfall>1.25 2.0 3.0 4.25 3.75 1.5 0.25 0.75 1.25 1.75 2.0 2.25</rainfall>

If you wanted to be a little more flexible and not require exactly 12 items in the list, you could use the xsd:minLength and xsd:maxLength elements to set minimum and maximum bounds on the list. You can also create a completely unbounded list by using the xsd:list element by itself, like this:

<xsd:element name="cities">
  <xsd:simpleType>
    <xsd:list base="xsd:string"/>
  </xsd:simpleType>
</xsd:element>
--------------------------------------------------------------------------------------------------------------------------------------
I offer here such patch:

BuiltInFacets.pm
179c179
<     sub { return $_[0] if defined $_[0] && length($_[0])==$len;
---
>     sub { return $_[0] if defined $_[0] && ((ref $_[0] eq 'ARRAY' && scalar @{$_[0]}) || length($_[0])==$len);
Reader.pm
800,803c800,802
<     EL: for my $e (ref $v eq 'ARRAY' ? @$v : $v)
<         {   for(@$late) { defined $e or next EL; $e = $_->($e) }
<             push @r, $e;
<         }
---
>         my $e = $v;
>         for(@$late) { defined $e or last; $e = $_->($e) }
>         push @r, $e;

CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #53392] length work not correctly for xsd:list
Date: Tue, 5 Jan 2010 17:02:31 +0100
To: Николай Шуляковский via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Николай Шуляковский via RT (bug-XML-Compile@rt.cpan.org) [100105 10:17]: Show quoted text
> Tue Jan 05 05:17:53 2010: Request 53392 was acted upon. > Transaction: Ticket created by NIKOLAS > Queue: XML-Compile > Subject: length work not correctly for xsd:list > Broken in: 1.10 > Severity: Critical > Owner: Nobody > Requestors: NIKOLAS@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53392 > > > > In the documentation it is told that it is "lenght" for the list should to > define a stake-in of elements in the list, instead of lenght each element > as it works in XML:: Compile
It is documented as an issue for quite some time, but no-one ever complained about it. Accidentally, I was looking for a fix last week. It seems to be quite simple to do. Your bug-report will pressure me a bit more to get it implemented. As temporary work-around you can use 'ignore_facets' with compile. -- Thanks for the report, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Втр Янв 05 11:02:56 2010, solutions@overmeer.net писал:
Show quoted text
> * Николай Шуляковский via RT (bug-XML-Compile@rt.cpan.org) [100105 10:17]:
> > Tue Jan 05 05:17:53 2010: Request 53392 was acted upon.
> > Transaction: Ticket created by NIKOLAS
> > Queue: XML-Compile
> > Subject: length work not correctly for xsd:list
> > Broken in: 1.10
> > Severity: Critical
> > Owner: Nobody
> > Requestors: NIKOLAS@cpan.org
> > Status: new
> > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53392 >
> >
> >
> > In the documentation it is told that it is "lenght" for the list should to
> > define a stake-in of elements in the list, instead of lenght each element
> > as it works in XML:: Compile
>
> It is documented as an issue for quite some time, but no-one ever
> complained about it. Accidentally, I was looking for a fix last week.
> It seems to be quite simple to do. Your bug-report will pressure me a
> bit more to get it implemented.
>
> As temporary work-around you can use 'ignore_facets' with compile.

Thanks for an efficient answer. But ignore_facets to me does not approach on a number of other reasons.
That you can tell apropos me of the offered decision. I have not completely investigated a code, and I think that there will be other problems! What will tell about it?

Subject: Re: [rt.cpan.org #53392] length work not correctly for xsd:list
Date: Fri, 8 Jan 2010 12:43:16 +0100
To: Николай Шуляковский via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Николай Шуляковский via RT (bug-XML-Compile@rt.cpan.org) [100108 10:03]: Show quoted text
> Queue: XML-Compile > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=53392 > > > That you can tell apropos me of the offered decision. I have not completely > investigated a code, and I think that there will be other problems! What will > tell about it?
Following your request, I have released 1.11 There was a need for a more serious rewrite than your patch. Enums and patterns on lists will now work as well. Facets on date and base42Binary however still need to get fixed. It will be publicly availeble via CPAN within an hour or so. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
fixed