You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Brian Ales <bk...@stern.nyu.edu> on 2003/04/02 20:34:00 UTC

validation across multiple namespaces

Hi
I need some help in a hurry - I'm trying to validate a schema (just as an XML document) that imports a namespace, and I'm only having partial success.  My problem is not with the S4S namespace, it's with the namespace defined in the import element for the 'xbrli' prefix (see below). Put simply, if you look at my schema snippet (see below), when I mispell 'debit', the parser goes and gets the correct schema and correctly sees it's not in the ennumeration for that attribute.  Great.  However, I can mispell 'balance' and Xerces doesn't complain at all - shouldn't it have a problem with an attribute name ('bXXlance') that isn't defined in the schema for the namespace defined by the xbrli: prefix?

Here's the relevant code for my parser (it happens to be under a JDOM SaxBuilder, but JDOM lets me get at the features/properties):
               SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);  
               builder.setFeature("http://apache.org/xml/features/validation/schema", true);

                                 //I'm using a scemaLocation Property to override the document hints.
               schemaLocs[0] = ".\\XMLSchema.xsd";         //I have a local copy
               schemaLocs[1] = "http://www.xbrl.org/2001/xbrl-instance.xsd";
               builder.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaLocs);  //only jaxp seems to work


Here's a portion of the schema I'm trying to validate (see the last attribute in the 'element' element - that's what I'm breaking to test validation):

<?xml version="1.0" encoding="utf-8"?>
<!-- Taxonomy based on XBRL standard v.2.  Created by UBmatrix Taxonomy Builder 5.0.76.  Contact www.ubmatrix.com -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xbrli="http://www.xbrl.org/2001/instance" 
    xmlns:link="http://www.xbrl.org/2001/XLink/xbrllinkbase" xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:iascf-pfs="http://www.xbrl.org/taxonomy/int/fr/ias/ci/pfs/2002-11-15"     
    targetNamespace="http://www.xbrl.org/taxonomy/int/fr/ias/ci/pfs/2002-11-15" elementFormDefault="qualified">
<annotation>
    <appinfo>
      <link:linkbaseRef xlink:type="simple" xlink:href="ias-ci-pfs-2002-11-15-references.xml" xlink:actuate="onRequest" 
            xlink:role="http://www.xbrl.org/linkprops/linkRef/reference" 
            xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" />
    </appinfo>
  </annotation>
  <import namespace="http://www.xbrl.org/2001/instance" schemaLocation="http://www.xbrl.org/2001/xbrl-instance.xsd" />
  <element id="iascf-pfs_WorkProgress" name="WorkProgress" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" 
    xbrli:balance="debit" />


Any help would be greatly appreciated!
Thanks in advance,
Brian