  | |  | XMLSchemaLoader handling inlined schemas | XMLSchemaLoader handling inlined schemas 2004-03-03 - By Jeehong Min
I am trying to obtain XSModels for inlined schemas in WSDLs.
I am able to do this successfully, except when the inlined schemas reference each other. For instance, assume I have 2 inlined schemas in the WSDL.
<definitions> <types>
<xsd:schema targetNamespace="foo" xmlns:xsd="..."> ... </schema>
<xsd:schema targetNamespace="bar" xmlns:xsd="..."> <xsd:import namespace="foo"/> ... </schema>
</types> </definition>
Some type declarations in "bar" schema reference elements in the "foo" schema. As a result, when I try to load the schema for "bar" schema, I get an error saying that it cannot resolve the name "nsBar:Something" when nsBar is the prefix for "bar" namespace.
I am doing this: loader is instance of XMLSchemaLoader SchemaGrammer grammar = loader.loadGrammar(source) where source is the XMLInputSource representing the inlined schema. XSModel model = grammar.toXSModel()
I've tried setting an XMLEntityResolver to the XMLSchemaLoader that returns XMLInputSource representing "foo" schema when resolveEntity() is called.
However, I am still getting error messages to stout/sterr.
Any ideas? What is the best way to handle inlined schemas?
Thanks,
Jeehong Min <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2800.1106" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>I am trying to obtain XSModels for inlined schemas in WSDLs.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I am able to do this successfully, except when the inlined schemas reference each other. For instance, assume I have 2 inlined schemas in the WSDL.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2><definitions></FONT></DIV> <DIV><FONT face=Arial size=2><types></FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2><xsd:schema targetNamespace="foo" xmlns:xsd="..."></FONT></DIV> <DIV><FONT face=Arial size=2>...</FONT></DIV> <DIV><FONT face=Arial size=2></schema></FONT></DIV> <DIV><FONT face=Arial size=2> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2><xsd:schema targetNamespace="bar" xmlns:xsd="..."></FONT></DIV> <DIV><FONT face=Arial size=2><xsd:import namespace="foo"/></FONT></DIV> <DIV>...</DIV> <DIV><FONT face=Arial size=2></schema></FONT></DIV></FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></types></FONT></DIV> <DIV><FONT face=Arial size=2></definition></FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Some type declarations in "bar" schema reference elements in the "foo" schema. As a result, when I try to load the schema for "bar" schema, I get an error saying that it cannot resolve the name "nsBar:Something" when nsBar is the prefix for "bar" namespace.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I am doing this:</FONT></DIV> <DIV><FONT face=Arial size=2>loader is instance of XMLSchemaLoader</FONT></DIV> <DIV><FONT face=Arial size=2>SchemaGrammer grammar = loader.loadGrammar(source) where source is the XMLInputSource representing the inlined schema.</FONT></DIV> <DIV><FONT face=Arial size=2>XSModel model = grammar.toXSModel()</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I've tried setting an XMLEntityResolver to the XMLSchemaLoader that returns XMLInputSource representing "foo" schema when resolveEntity() is called.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>However, I am still getting error messages to stout/sterr.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Any ideas? What is the best way to handle inlined schemas?</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Thanks,</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Jeehong Min</FONT></DIV></BODY></HTML>
|
|
 |