Skip Menu |

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

Report information
The Basics
Id: 92026
Status: new
Priority: 0/
Queue: XML-Validator-Schema

People
Owner: Nobody in particular
Requestors: sandeep.rajanikanth.gupta [...] ericsson.com
Cc:
AdminCc:

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



Subject: Duplicate Attributes are not reported in the XML validation
Date: Fri, 10 Jan 2014 11:37:16 +0000
To: "bug-XML-Validator-Schema [...] rt.cpan.org" <bug-XML-Validator-Schema [...] rt.cpan.org>
From: Sandeep Rajanikanth Gupta <sandeep.rajanikanth.gupta [...] ericsson.com>
Hi , Duplicate Attributes are not reported in the XML validation, Attribute CopyIS is repeated twice, but no errrors were reported for validation. Please check and revert back My XML (foo.xml => Has duplicate Attributes in XML, did not report in the XML validation) <?xml version="1.0" encoding="utf-8"?> <Products> <Product Number="CSX10196" default="no" PRSTATE="R1A04"> <ISType Required="yes" IS="1095-" ConnectPSD="13161-" PsdREV="A"> <Document Number="190 10-CXP 905 0047">C</Document> <Document Number="190 00-CXP 905 0047">C</Document> </ISType> <ISType Required="yes" IS="3/1095-" CopyIS="1095-" CopyIS="1095-"> <Document Number="190 00-CXP 905 0047">B</Document> <Document Number="190 10-CXP 905 0047">A</Document> </ISType> </Product> </Products> My XSD (foo.xsd) <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Products"> <xs:complexType> <xs:sequence> <xs:element name="Product"> <xs:complexType> <xs:sequence> <xs:element name="ISType" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="Document" type="xs:string" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent> <xs:attribute type="xs:string" name="Number" minOccurs="1"/> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute type="xs:string" name="Required" use="required"/> <xs:attribute name="IS" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="(|\d+/)(1095-|15201-)"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute type="xs:string" name="ConnectPSD" use="optional" maxOccurs="1" minOccurs="0"/> <xs:attribute type="xs:string" name="PsdREV" use="optional" minOccurs="0"/> <xs:attribute type="xs:string" name="CopyIS" use="optional"/> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute type="xs:string" name="Number"/> <xs:attribute type="xs:string" name="default"/> <xs:attribute type="xs:string" name="PREVRST" use="optional" maxOccurs="1" minOccurs="0"/> <xs:attribute type="xs:string" name="PRSTATE" use="optional" maxOccurs="1" minOccurs="0"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> My code #!/usr/bin/perl use lib '/home/esthgta/lib/lib/perl5/site_perl/5.8.8'; #use lib '/home/esthgta/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi'; use XML::SAX::ParserFactory; use XML::Validator::Schema; # # create a new validator object, using foo.xsd # $validator = XML::Validator::Schema->new(file => 'foo.xsd'); # # create a SAX parser and assign the validator as a Handler # $parser = XML::SAX::ParserFactory->parser(Handler => $validator); # # validate foo.xml against foo.xsd # eval { $parser->parse_uri('foo.xml') }; die "File failed validation: $@" if $@; Output: (did not report any error for duplicate CopyIS attribute) $> perl val.pl $> Please respond to kadursandy@gmail.com<mailto:kadursandy@gmail.com> . Thanks & Regards Sandeep Rajanikanth Gupta Mob: 98806 84866 Email: sandeep.rajanikanth.gupta@ericsson.com<mailto:sandeep.rajanikanth.gupta@ericsson.com>

Message body is not shown because it is too large.