[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Spy 4.0 Problems? - Not Validating Attributes Properly?

  • From: "Magick, Brian" <Brian.Magick@C...>
  • To: xml-dev@l...
  • Date: Thu, 20 Sep 2001 11:46:22 -0500

validating attributes in xml
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>
 
 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.