Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Inline embedded Schema(Inline embedded Schema)
Inline embedded Schema [message #881252] Mon, 04 June 2012 08:20 Go to next message
Sasi Varnan Sundarakandasamy is currently offline Sasi Varnan SundarakandasamyFriend
Messages: 9
Registered: June 2011
Junior Member
How can I load an inline embedded schema as XSDSchema?

I have a model which can have any contents inside. Similar to the WSDL types, I want to inline the schema definitions there. If I declare a schema in it, I want the EMFResource to load it as XSDSchema element. Currently all my elements are loaded as XSDAnyType elements.

Please suggest.
Re: Inline embedded Schema [message #881320 is a reply to message #881252] Mon, 04 June 2012 10:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Sasi,

Comments below.

On 04/06/2012 10:20 AM, Sasi Varnan Sundarakandasamy wrote:
> How can I load an inline embedded schema as XSDSchema?
What's it embedded in?
>
> I have a model which can have any contents inside. Similar to the WSDL
> types, I want to inline the schema definitions there. If I declare a
> schema in it, I want the EMFResource to load it as XSDSchema element.
> Currently all my elements are loaded as XSDAnyType elements.
The best you can do is use XSDResourceImpl to load the whole resource;
it will scan the DOM for xsd:schema elements and build XSDSchema
instances from them. The XSD model needs be built from a DOM; the SAX
parsing used by XMLResourceImpl/XMIResourceImpl won't suffice.
>
> Please suggest.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Inline embedded Schema [message #881836 is a reply to message #881320] Tue, 05 June 2012 10:45 Go to previous messageGo to next message
Sasi Varnan Sundarakandasamy is currently offline Sasi Varnan SundarakandasamyFriend
Messages: 9
Registered: June 2011
Junior Member
Hi Ed,


Thanks for the input. I tried loading my file with the XSDResourceImpl and called the getSchema, but i am getting some exception logged in the cosole. Sample content attached

I am gtting the following error

org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0
at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:352)
at org.eclipse.xsd.impl.XSDSchemaImpl.patch(XSDSchemaImpl.java:1576)
at org.eclipse.xsd.impl.XSDSchemaImpl.traverseToRootForPatching(XSDSchemaImpl.java:1529)
at org.eclipse.xsd.impl.XSDConcreteComponentImpl.changeAttribute(XSDConcreteComponentImpl.java:1183)
at org.eclipse.xsd.impl.XSDSchemaImpl.changeAttribute(XSDSchemaImpl.java:2467)
at org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDConcreteComponentImpl.java:1154)
at org.eclipse.xsd.impl.XSDConcreteComponentImpl.setElementGen(XSDConcreteComponentImpl.java:2791)
at org.eclipse.xsd.impl.XSDConcreteComponentImpl.setElement(XSDConcreteComponentImpl.java:2822)
at org.eclipse.xsd.impl.XSDSchemaImpl.setElement(XSDSchemaImpl.java:2601)
at org.eclipse.xsd.impl.XSDSchemaImpl.createMetaSchema(XSDSchemaImpl.java:538)
at org.eclipse.xsd.util.XSDResourceImpl.handleSchemaElement(XSDResourceImpl.java:833)
at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:702)
at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:796)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1282)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
at org.eclipse.xsd.impl.XSDSchemaImpl.getSchemaForSchema(XSDSchemaImpl.java:665)
at org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl.handleNewBaseTypeDefinition(XSDSimpleTypeDefinitionImpl.java:1677)
at org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl.reconcileAttributes(XSDSimpleTypeDefinitionImpl.java:1625)
  • Attachment: types.xml
    (Size: 0.71KB, Downloaded 343 times)
Re: Inline embedded Schema [message #881896 is a reply to message #881836] Tue, 05 June 2012 12:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
What version of XSD are you using? Maybe you want to try with the
namespace used in the final 1.0 specification.

http://www.w3.org/2001/XMLSchema


On 05/06/2012 12:45 PM, Sasi Varnan Sundarakandasamy wrote:
> Hi Ed,
>
>
> Thanks for the input. I tried loading my file with the XSDResourceImpl and called the getSchema, but i am getting some exception logged in the cosole. Sample content attached
>
> I am gtting the following error
>
> org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException: index=0, size=0
> at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:352)
> at org.eclipse.xsd.impl.XSDSchemaImpl.patch(XSDSchemaImpl.java:1576)
> at org.eclipse.xsd.impl.XSDSchemaImpl.traverseToRootForPatching(XSDSchemaImpl.java:1529)
> at org.eclipse.xsd.impl.XSDConcreteComponentImpl.changeAttribute(XSDConcreteComponentImpl.java:1183)
> at org.eclipse.xsd.impl.XSDSchemaImpl.changeAttribute(XSDSchemaImpl.java:2467)
> at org.eclipse.xsd.impl.XSDConcreteComponentImpl.eNotify(XSDConcreteComponentImpl.java:1154)
> at org.eclipse.xsd.impl.XSDConcreteComponentImpl.setElementGen(XSDConcreteComponentImpl.java:2791)
> at org.eclipse.xsd.impl.XSDConcreteComponentImpl.setElement(XSDConcreteComponentImpl.java:2822)
> at org.eclipse.xsd.impl.XSDSchemaImpl.setElement(XSDSchemaImpl.java:2601)
> at org.eclipse.xsd.impl.XSDSchemaImpl.createMetaSchema(XSDSchemaImpl.java:538)
> at org.eclipse.xsd.util.XSDResourceImpl.handleSchemaElement(XSDResourceImpl.java:833)
> at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:702)
> at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:796)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1494)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1282)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
> at org.eclipse.xsd.impl.XSDSchemaImpl.getSchemaForSchema(XSDSchemaImpl.java:665)
> at org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl.handleNewBaseTypeDefinition(XSDSimpleTypeDefinitionImpl.java:1677)
> at org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl.reconcileAttributes(XSDSimpleTypeDefinitionImpl.java:1625)


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Inline embedded Schema [message #881963 is a reply to message #881896] Tue, 05 June 2012 14:53 Go to previous message
Sasi Varnan Sundarakandasamy is currently offline Sasi Varnan SundarakandasamyFriend
Messages: 9
Registered: June 2011
Junior Member
Hi Ed,

The change of namespace worked. Thanks again.

Thanks & Regards
Sasi Varnan
Previous Topic:Include several XSD files
Next Topic:Defining type for specific Occrrance of the element.
Goto Forum:
  


Current Time: Fri Apr 19 17:10:27 GMT 2024

Powered by FUDForum. Page generated in 0.02016 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top