With xerces 1.3.1 and CR for xml schema when I imported
the standard http://www.w3.org/XML/1998/namespace for use of xml:lang,
it gets parsed perfect when I use xml spy or turbo xml but with xerces parser it gives
error :
"Globally defined attributes should have use= default or fixed "
I do not have any attributes in my xml schema, so I guess it is refering to attributes
defined in xml.xsd mentioned in
schemaLocation in import .
If I do not give schemaLoacation , xerces gives error :
" File "" not found."
Following is the xml snippet :
<xsd:schema xmlns:xsd = "http://www.w3.org/2000/10/XMLSchema"
elementFormDefault = "qualified">
<xsd:import namespace = "http://www.w3.org/XML/1998/namespace"
schemaLocation = "http://www.w3.org/2000/10/xml.xsd"/>
Any help is appreciated,
Komal.
[EMAIL PROTECTED] wrote:
> Hi David,
>
> Thanks for pointing out this problem. "use" and "fixed" were ignored if an
> attribute declarations refers to an attribute from another namespace.
>
> Now it's fixed in CVS. So grab the latest version and try again.
>
> Cheers,
> Sandy Gao
> Software Developer, IBM Canada
> (1-416) 448-3255
> [EMAIL PROTECTED]
>
>
> "David A.
> Riggs" To: [EMAIL PROTECTED]
> <driggs@asset. cc:
> com> Subject: Trouble with 'use' attribute
>when importing schema namespace
>
> 08/07/2001
> 10:21 AM
> Please respond
> to
> xerces-j-dev
>
>
>
> I'm attempting to validate an instance document against
> a slightly complicated schema which includes and imports
> several smaller ones. I've noticed that attributes
> specified use="required" that are referenced from an
> imported schema/namespace aren't enforced as I'd expect.
>
> I've included boiled-down examples to better illustrate
> below. I'm using JDK 1.3.1 and Xerces-J 1.4.2 and am
> trying to validate using one of the included samples,
>
> java -classpath xerces.jar;xercesSamples.jar dom.DOMCount -svnf
> instance.xml
>
> Any pointers or feedback would be greatly appreciated!
> Thanks,
>
> David A. Riggs
> ---
>
> The main schema:
> -----------------------------
> <?xml version = "1.0" encoding = "UTF-8"?>
> <xsd:schema xmlns = "http://birch.asset.com/example"
> targetNamespace = "http://birch.asset.com/example"
> xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
> xmlns:driggs="http://driggs.asset.com">
>
> <!-- Import namespace and global attribute from second schema -->
> <xsd:import namespace = "http://driggs.asset.com"
> schemaLocation = "importedSchema.xsd" />
>
> <xsd:element name="root">
> <xsd:complexType>
>
> <!-- This attribute is required, and the parser handles it
> properly
> -->
> <xsd:attribute name="LocalRequiredAttribute" use="required"
> />
>
> <!-- This referenced attribute is required, but the parser doesn't
> catch it -->
> <xsd:attribute ref="driggs:GlobalRequiredAttribute" use="required"
> />
>
> </xsd:complexType>
> </xsd:element>
>
> </xsd:schema>
> --------------------------------
> The imported schema containing the globally defined attribute:
> ---------------------------------
> <?xml version = "1.0" encoding = "UTF-8"?>
> <xsd:schema xmlns = "http://driggs.asset.com"
> targetNamespace = "http://driggs.asset.com"
> xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
>
> <xsd:attribute name="GlobalRequiredAttribute" />
>
> </xsd:schema>
> -----------------------------------
> The instance document - should produce errors when validated
> since GlobalRequiredAttribute is not present, xerces lists
> no errors when parsed and validated:
> ------------------------------------
> <?xml version = "1.0" encoding = "UTF-8"?>
> <root xmlns="http://birch.asset.com/example"
> xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation = "http://birch.asset.com/example example.xsd"
>
> LocalRequiredAttribute="blah" />
>
> --
> David A. Riggs
> Science Applications International Corporation - SAIC
> (304)284-9000x201 [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]