This discussion is archived
0 Replies Latest reply: Aug 13, 2012 6:07 PM by MarieR RSS

XmlResolver resolveSchema question

MarieR Newbie
Currently Being Moderated
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:

<te:Abbreviations
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:te="http://tethys.sdsu.edu/schema/1.0"
xsi:schemaLocation="http://tethys.sdsu.edu/schema/1.0 http://tethys.sdsu.edu/schema/tethys.xsd?nocache=1">
<bogus>wow</bogus>
<Name> popo </Name>
<Map>
<completename> Balaenoptera borealis </completename>
<coding> Bb </coding>
</Map>
...
</te:Abbreviations>

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
None
Resolving schema to http:tethys.sdsu.edu/schema/Detections.v1_2.xsd
None
Resolving schema to http:tethys.sdsu.edu/schema/itis.xsd?nocache=1
None
Resolving schema to http:tethys.sdsu.edu/schema/Ensemble.xsd
None
Resolving schema to http:tethys.sdsu.edu/schema/Localization.xsd
None
Resolving schema to http:tethys.sdsu.edu/schema/SpeciesAbbreviations.xsd?nocache=1
None
Resolving schema to http:tethys.sdsu.edu/schema/Localization.xsd
None

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

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points