Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-883

Validation problem using JAXP - Castor 0.9.5.2 or Xerces 2.6.1 bug?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 2.6.1
    • None
    • None
    • Operating System: Linux
      Platform: PC
    • 26738

    Description

      I'm using the SourceGenerator from Castor version 0.9.5.2 on the following schema:

      <?xml version="1.0" encoding="utf-8"?>
      <schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://power.inescn.pt/2004/01/compete"
      xmlns:compete="http://power.inescn.pt/2004/01/compete"
      elementFormDefault="qualified">

      <element name="PowerSystem">
      <complexType>
      <sequence>
      <element minOccurs="0" maxOccurs="unbounded" ref="compete:Node"/>
      <element minOccurs="0" maxOccurs="unbounded" ref="compete:Line"/>
      </sequence>
      <attribute name="name" type="string"/>
      </complexType>
      <key name="nodeName">
      <selector xpath="compete:Node"/>
      <field xpath="@ID"/>
      </key>
      <keyref name="fromNodeNameRef" refer="compete:nodeName">
      <selector xpath="compete:Line"/>
      <field xpath="compete:from"/>
      </keyref>
      <keyref name="toNodeNameRef" refer="compete:nodeName">
      <selector xpath="compete:Line"/>
      <field xpath="compete:to"/>
      </keyref>
      </element>

      <element name="Node" type="compete:NodeType"/>
      <complexType name="NodeType">
      <sequence/>
      <attribute name="ID" type="integer"/>
      <attribute name="voltage" type="double"/>
      </complexType>

      <element name="Line" type="compete:LineType"/>
      <complexType name="LineType">
      <sequence>
      <element name="from" type="integer"/>
      <element name="to" type="integer"/>
      </sequence>
      <attribute name="ID" type="integer"/>
      </complexType>
      </schema>

      I've set:

      org.exolab.castor.parser.validation=true
      org.exolab.castor.parser.namespaces=true
      org.exolab.castor.marshalling.validation=true

      to require validation and set to empty org.exolab.castor.parser and commented
      out org.exolab.castor.serializer on the castor.properties file to force using
      the default JAXP implementation.

      I've updated using the "endorsed" mechanism the Xalan on j2se1.4.2_03 on
      Linux/x86 to 2.5.2 and Xerces to 2.6.1 .

      I'm getting this stack trace:

      org.xml.sax.SAXException: In document:
      'file:///home/jpinto/src/eclipse/Test/powersystem.xsd'
      Parsing Error : Document is invalid: no grammar found.
      Line : 2
      Column : 8

      at
      org.exolab.castor.xml.schema.reader.Sax2ComponentReader.error(Sax2ComponentReader.java:281)
      at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
      at
      org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown
      Source)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
      Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
      Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at
      org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:372)
      at
      org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:425)
      at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:760)

      If I processe an XML instance of the document that uses this schema using JAXP
      and DOM, with validation, I have no problem.

      Anybody has an idea?
      Do you believe it is an issue on the way Castor sets the parser validation flags
      or is it a Xerces problem??

      Thank you in advance,

      João Luis

      Attachments

        Activity

          People

            Unassigned Unassigned
            jpinto@inescporto.pt João Luis Pinto
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: