0 Replies Latest reply on Aug 14, 2012 1:07 AM by MarieR

    XmlResolver resolveSchema question

      Dear All,

      I am somewhat confused by the behavior of XML resolvers and would appreciate advice. I wrote a subclass of XML Resolver to try to figure out the behavior, below is a Python snippet executed with dbxml 2.5.16 on a Windows 7 platform (compiled 32 bit, 64 bit os):

      class Resolver(XmlResolver):

      def __init__(self):
      XmlResolver.__init__(self) # initialize parent class
      print "Creating Resolver"

      def resolveSchema(self, txn, mgr, schemaLoc, nameSpace):
      print "Resolving schema %s to %s"%(nameSpace, schemaLoc)
      # Use default resolver...
      resolved= XmlResolver.resolveSchema(self, txn, mgr, schemaLoc, nameSpace)
      print resolved
      return resolved

      I have registered the resolver and can see it execute when I try to add instance documents. As an example, I might add:

      xsi:schemaLocation="http://tethys.sdsu.edu/schema/1.0 http://tethys.sdsu.edu/schema/tethys.xsd?nocache=1">
      <Name> popo </Name>
      <completename> Balaenoptera borealis </completename>
      <coding> Bb </coding>

      expecting it to fail due to the tag <bogus> which is not in the schema. External references are enabled, and I see the tethys.xsd is processed, but the value of resolved is None which I am not expecting as it is a valid address. Sample output:

      addDocument ITIS: doc size=0.9 MB, 28 32768 byte pages...
      Resolving schema http://tethys.sdsu.edu/schema/1.0 to http://tethys.sdsu.edu/schema/tethys.xsd?nocache=1
      Resolving schema to http:tethys.sdsu.edu/schema/Detections.v1_2.xsd
      Resolving schema to http:tethys.sdsu.edu/schema/itis.xsd?nocache=1
      Resolving schema to http:tethys.sdsu.edu/schema/Ensemble.xsd
      Resolving schema to http:tethys.sdsu.edu/schema/Localization.xsd
      Resolving schema to http:tethys.sdsu.edu/schema/SpeciesAbbreviations.xsd?nocache=1
      Resolving schema to http:tethys.sdsu.edu/schema/Localization.xsd

      What is more surprising is that tethys.xsd includes several other schema that are subsequently processed, all showing None as the resolved values intead of an XmlInputStream as expected.

      My questions are:
      1 - Why don't I see XmlInputStream objects?
      2 - If I actually am processing the schema, am I doing something silly in my instance document that is keeping this from working?

      Any ideas would be appreciated?

      Thanks - Marie