OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xml-dev] XML Spy 4.0 Problems? - Not Validating Attributes Properly?



Has anyone experienced any validation problems with the new version of
XML Spy 4.0 (full version, not beta).
 
I have run into the problem that attributes are not validating properly.
Some Schemas that I have been working on have required attributes that
are not present in the XML Instance document and the XML Instance
document has some bogus attributes that are not represented in the
Schema.  Previously I have relied on using validition to discover these
discrepencies and hammer out the issues.  Now with XML Spy 4.0 I get a
message back stating that my XML is valid!  This cannot be as I know
that the XML Instance document is missing some required attributes and
has additional attributes not in the Schema.
 
This behavior seems even stranger as I created a few simple sample files
to test.  I created the following XML Schema with two required
attributes, one for the document root (Attribute1, required) and one for
Element2 (Attribute2, required).  I have found that if I validate the
following XML document against this schema in XML Spy 4.0 (see below the
Schema) it validates.  Clearly it is missing the Attribute1 attribute.
If I leave out the Attribute2 attribute it DOES NOT VALIDATE.  Finally,
if I place ANY attribute in my XML Instance document in place of the
Attribute 2 attribute it validates, even though it is named differently
than the Attribute2 attribute found in the Schema (plus it no longer has
to be boolean, I made the attribute named test="d" and it still
validated. 
 
Has anyone else run into these problems with the latest build of XML
Spy?  Any one have any suggestions?

Thanks,

Brian Magick
Compaq Computer Corporation
 
XML Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
       <xs:element name="Document">
             <xs:annotation>
                    <xs:documentation>Comment describing your root
element</xs:documentation>
             </xs:annotation>
             <xs:complexType>
                    <xs:sequence>
                           <xs:element name="Element1"
type="xs:string"/>
                           <xs:element name="Element2">
                                 <xs:complexType>
                                        <xs:simpleContent>
                                               <xs:extension
base="xs:string">
                                                     <xs:attribute
name="Attribute2" type="xs:boolean" use="required"/>
                                               </xs:extension>
                                        </xs:simpleContent>
                                 </xs:complexType>
                           </xs:element>
                    </xs:sequence>
                    <xs:attribute name="Attribute1" type="xs:string"
use="required"/>
             </xs:complexType>
       </xs:element>
</xs:schema>
 
XML Instance Document:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XML Spy v4.0 U
(http://www.xmlspy.com)-->
<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\XML
Validation\ValiditonTestSchema.xsd">
       <Element1>String</Element1>
       <Element2 Attribute2="1">String</Element2>
</Document>