Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322486 - Parsing XSD Schema Problem due to O.S.
Summary: Parsing XSD Schema Problem due to O.S.
Status: RESOLVED INVALID
Alias: None
Product: EMF
Classification: Modeling
Component: XSD (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-12 05:11 EDT by Eneko Fernandez CLA
Modified: 2023-01-12 11:52 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eneko Fernandez CLA 2010-08-12 05:11:42 EDT
Hi all,

I'm programming an own xsd editor using emf´s xsd api and I faced a weird problem that I want to share/inform with u. 

The given situation is that I have to xsd files "A" & "B" (both define types) and B imports A. 

Parsing the second xsd I want walk trought the types defined only in B (A´s types have already been treated), so i proceed like this:

org.eclipse.xsd.XSDSchema schema=... (B schema)

Iterator<XSDTypeDefinition> itTypes = schema.getTypeDefinitions()
				.iterator();
		while (itTypes.hasNext()) {
			XSDTypeDefinition type = itTypes.next();

The weird behaviour raises depending OS:

Windows: type is only defined in B type
Linux and Mac: type can be either A defined type or B defined type.

So to make sure that I only treat B´s type I had to add the clause:

Iterator<XSDTypeDefinition> itTypes = schema.getTypeDefinitions()
				.iterator();
		while (itTypes.hasNext()) {
			XSDTypeDefinition type = itTypes.next();
				if (type.getSchema() != xsdSchema)
				continue;
		....

Which is a little strange fixed, isnt it?

Does anyone know about the reason of this problem?

Best Regards,

Eneko Fernández
Comment 1 Ed Merks CLA 2010-08-12 11:25:09 EDT
XSDSchema.typeDefinitions should be the union of all types from all imported and included schemas, as well as from the schema itself.  Likely on one OS, your imports/includes aren't resolving (because you aren't using a proper absolute URI to load the schema) so you see only the local things.  In any case, you should expect to see the closure of all things.