Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » import resolution and namespaces
import resolution and namespaces [message #72435] Tue, 19 June 2007 18:39 Go to next message
Eclipse UserFriend
Originally posted by: t.agnoloni.gmail.com

hi,
we are having problems in the resolution of imported schemas.

I enclose here an ultrasimplified version of the schema we are dealing
with.

nirstrict.xsd:
_________________________________________________

<xsd:schema
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:h="http://www.w3.org/HTML/1998/html4"
targetNamespace="http://www.normeinrete.it/nir/2.2/"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

<xsd:import namespace="http://www.w3.org/HTML/1998/html4"
schemaLocation="./h.xsd"/>

<!--<xsd:group name="elblocchi">
<xsd:choice>
<xsd:element ref="h:div"/>
<xsd:element ref="h:p"/>
<xsd:element ref="h:img"/>
<xsd:element ref="h:table"/>
</xsd:choice>
</xsd:group>-->

<xsd:element name="Legge" type="xsd:string" />


</xsd:schema>

_____________________________________________________

h.xsd :

<xsd:schema targetNamespace="http://www.w3.org/HTML/1998/html4"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:h="http://www.w3.org/HTML/1998/html4" elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:import namespace="http://www.normeinrete.it/nir/2.2/"
schemaLocation="./nirstrict.xsd"/>

<xsd:element name="p" type="xsd:string" />

</xsd:schema>

_____________________________________________________



The problem is in the resolution of the imported schema h.xsd from the
main schema nirstrict.xsd


The code we are using is the following



/**
*
* @param schemaURL
* @return
* @throws Exception
*/
public static XSDSchema loadSchemaUsingResourceSet(String schemaURL)
throws Exception{

System.out.println("--> Loading Schema Using Resource Set @ url
"+schemaURL);

XSDResourceFactoryImpl resourceFactory = new XSDResourceFactoryImpl();

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",resourceFactory);


//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// ////////////////////
//
// prende il path assoluto di schemaURL
//
File file = new File(schemaURL);
if (file.isFile())
schemaURL =
URI.createFileURI(file.getCanonicalFile().toString()).toStri ng();

// Create a resource set and load the main schema file into it.
ResourceSet resourceSet = new ResourceSetImpl();



//
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./xlink.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/xlink.xsd "));//,URI.createURI("./xlink.xsd"));
//
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./h.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));//,URI.createURI("./h.xsd"));
//
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./dsp.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/dsp.xsd "));//,URI.createURI("./dsp.xsd"));
//

System.err.println("URIMAP:
" +resourceSet.getURIConverter().getURIMap().entrySet().toStri ng());


resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
Boolean.TRUE);


XSDResourceImpl xsdSchemaResource = null;
try
{
xsdSchemaResource =
(XSDResourceImpl)resourceSet.getResource(URI.createURI(schem aURL),true);
}
catch(Exception e)
{
System.err.println("Exception caught in method 'load schema using
ResourceSet' message = " + e.getMessage() + " xsdSchemaResource: " +
xsdSchemaResource);
}

Resource resource = (Resource)xsdSchemaResource;
if (resource instanceof XSDResourceImpl)
{
XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
// Iterate over the schema's content's looking for directives.
XSDSchema xsdSchema = xsdResource.getSchema();
for (Iterator contents = xsdSchema.getContents().iterator();
contents.hasNext(); )
{
XSDSchemaContent xsdSchemaContent =
(XSDSchemaContent)contents.next();
if (xsdSchemaContent instanceof XSDSchemaDirective)
{
XSDSchemaDirective xsdSchemaDirective =
(XSDSchemaDirective)xsdSchemaContent;
if (xsdSchemaDirective.getResolvedSchema() == null){

System.err.println("Unresolved schema "+
xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());

if(xsdSchemaDirective instanceof XSDImport){
XSDImport xsdSchemaImport = (XSDImport)xsdSchemaDirective;
System.err.println(" IMPORT: namespace -->
"+xsdSchemaImport.getNamespace());
System.err.println(" IMPORT: location -->
"+xsdSchemaImport.getSchemaLocation());
}
}
else {
System.err.println("Resolved schema "+
xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
if(xsdSchemaDirective instanceof XSDImport){
XSDImport xsdSchemaImport = (XSDImport)xsdSchemaDirective;
System.err.println(" IMPORT: namespace -->
"+xsdSchemaImport.getNamespace());
System.err.println(" IMPORT: location -->
"+xsdSchemaImport.getSchemaLocation());
}
}
}
}
return xsdResource.getSchema();
}
System.err.println("loadSchemaUsingResourceSet(" + schemaURL + ") did
not contain any schemas!");
return null;
}




What we noticed is that if elements of the imported xsd are referred in
the main schema like here:

<xsd:group name="elblocchi">
<xsd:choice>
<xsd:element ref="h:div"/>
<xsd:element ref="h:p"/>
<xsd:element ref="h:img"/>
<xsd:element ref="h:table"/>
</xsd:choice>
</xsd:group>



i.e. commenting out such block in nirstrict.xsd,

the import is resolved otherwise it is not.

see here the results in the two cases:

with references to h: elements

*****************
Resolved schema ./h.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_2/nirstrict.xsd
IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
IMPORT: location --> ./h.xsd
loaded schema
*****************

or without

*****************
Unresolved schema ./h.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_2/nirstrict.xsd
IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
IMPORT: location --> ./h.xsd
*****************



In the actual schemas we are using we have two different version, a light
and a strict version. The light version which refers imported elements in
the main schema is correctly resolved, in the strict, where the imported
elements are referred from other included xsd files and not in the main
one, the import resolution does not succeed.

Do you have any hint on what could be the reason? Do we need to perform a
recursive import resolution ove all the resources in the resourceSet ?
Notice that all works in cases of include instead of import.


We also tried various URI Mapping like

resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./h.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));

or

resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.w3.org/HTML/1998/html4/"),URI.createURI("./h.xsd"));

but none solves the problem. Which is the correct URI mapping for a case
like our:

<xsd:import namespace="http://www.w3.org/HTML/1998/html4"
schemaLocation="./h.xsd"/>


Notice that, in the for cycle over the resources of the resourceSet, the
imported resources correctly inherit the absolute path from the main
resource.
In case you need the complete schema we are using I can send it. Running
xsdMainExample load and validate on it gives the same Unresolved import
problems.



Any help is greatly appreciated,

thanks in advance

Tommaso
Re: import resolution and namespaces [message #72456 is a reply to message #72435] Tue, 19 June 2007 18:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Tommaso,

Imports are resolved on demand, i.e., when a name from that namespace
needs to be resolved, so if there isn't such a need, it won't be
resolved. This type of approach would force the resolution:

for (Object content : xsdSchema.getContents())
{
if (content instanceof XSDImport)
{
XSDImport xsdImport = (XSDImport)content;
xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
}
}


Tommaso wrote:
> hi,
> we are having problems in the resolution of imported schemas.
>
> I enclose here an ultrasimplified version of the schema we are dealing
> with.
> nirstrict.xsd:
> _________________________________________________
>
> <xsd:schema xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> targetNamespace="http://www.normeinrete.it/nir/2.2/"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
>
> <!--<xsd:group name="elblocchi">
> <xsd:choice>
> <xsd:element ref="h:div"/>
> <xsd:element ref="h:p"/>
> <xsd:element ref="h:img"/>
> <xsd:element ref="h:table"/>
> </xsd:choice>
> </xsd:group>-->
>
> <xsd:element name="Legge" type="xsd:string" />
>
>
> </xsd:schema>
>
> _____________________________________________________
>
> h.xsd :
>
> <xsd:schema targetNamespace="http://www.w3.org/HTML/1998/html4"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:import namespace="http://www.normeinrete.it/nir/2.2/"
> schemaLocation="./nirstrict.xsd"/>
>
> <xsd:element name="p" type="xsd:string" />
>
> </xsd:schema>
>
> _____________________________________________________
>
>
>
> The problem is in the resolution of the imported schema h.xsd from the
> main schema nirstrict.xsd
>
>
> The code we are using is the following
>
>
>
> /**
> * * @param schemaURL
> * @return
> * @throws Exception
> */
> public static XSDSchema loadSchemaUsingResourceSet(String
> schemaURL) throws Exception{
>
> System.out.println("--> Loading Schema Using Resource
> Set @ url "+schemaURL);
>
> XSDResourceFactoryImpl resourceFactory = new
> XSDResourceFactoryImpl();
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",resourceFactory);
>
>
>
> //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// ////////////////////
>
> //
> // prende il path assoluto di schemaURL
> //
> File file = new File(schemaURL);
> if (file.isFile())
> schemaURL =
> URI.createFileURI(file.getCanonicalFile().toString()).toStri ng();
>
> // Create a resource set and load the main schema file into it.
> ResourceSet resourceSet = new ResourceSetImpl();
>
> //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./xlink.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/xlink.xsd "));//,URI.createURI("./xlink.xsd"));
>
> //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./h.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));//,URI.createURI("./h.xsd"));
>
> //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./dsp.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/dsp.xsd "));//,URI.createURI("./dsp.xsd"));
>
> //
>
> System.err.println("URIMAP:
> " +resourceSet.getURIConverter().getURIMap().entrySet().toStri ng());
>
>
>
> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
> Boolean.TRUE);
>
>
> XSDResourceImpl xsdSchemaResource = null;
> try
> {
> xsdSchemaResource =
> (XSDResourceImpl)resourceSet.getResource(URI.createURI(schem aURL),true);
> }
> catch(Exception e)
> {
> System.err.println("Exception caught in method 'load
> schema using ResourceSet' message = " + e.getMessage() + "
> xsdSchemaResource: " +
> xsdSchemaResource);
> }
>
> Resource resource = (Resource)xsdSchemaResource;
> if (resource instanceof XSDResourceImpl)
> {
> XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
> // Iterate over the schema's content's looking for
> directives.
> XSDSchema xsdSchema = xsdResource.getSchema();
> for (Iterator contents =
> xsdSchema.getContents().iterator(); contents.hasNext(); )
> {
> XSDSchemaContent xsdSchemaContent =
> (XSDSchemaContent)contents.next();
> if (xsdSchemaContent instanceof XSDSchemaDirective)
> { XSDSchemaDirective
> xsdSchemaDirective = (XSDSchemaDirective)xsdSchemaContent;
> if (xsdSchemaDirective.getResolvedSchema() == null){
>
> System.err.println("Unresolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
>
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println(" IMPORT:
> namespace --> "+xsdSchemaImport.getNamespace());
> System.err.println(" IMPORT:
> location --> "+xsdSchemaImport.getSchemaLocation());
> }
> } else {
> System.err.println("Resolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println("
> IMPORT: namespace --> "+xsdSchemaImport.getNamespace());
> System.err.println("
> IMPORT: location --> "+xsdSchemaImport.getSchemaLocation());
> }
> } }
> }
> return xsdResource.getSchema();
> }
> System.err.println("loadSchemaUsingResourceSet(" + schemaURL +
> ") did not contain any schemas!");
> return null;
> }
>
>
>
>
> What we noticed is that if elements of the imported xsd are referred
> in the main schema like here:
>
> <xsd:group name="elblocchi">
> <xsd:choice>
> <xsd:element ref="h:div"/>
> <xsd:element ref="h:p"/>
> <xsd:element ref="h:img"/>
> <xsd:element ref="h:table"/>
> </xsd:choice>
> </xsd:group>
>
>
>
> i.e. commenting out such block in nirstrict.xsd,
>
> the import is resolved otherwise it is not.
>
> see here the results in the two cases:
>
> with references to h: elements
>
> *****************
> Resolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_2/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> loaded schema
> *****************
>
> or without
> *****************
> Unresolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_2/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> *****************
>
>
>
> In the actual schemas we are using we have two different version, a
> light and a strict version. The light version which refers imported
> elements in the main schema is correctly resolved, in the strict,
> where the imported elements are referred from other included xsd files
> and not in the main one, the import resolution does not succeed.
> Do you have any hint on what could be the reason? Do we need to
> perform a recursive import resolution ove all the resources in the
> resourceSet ?
> Notice that all works in cases of include instead of import.
>
>
> We also tried various URI Mapping like
>
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./h.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));
>
>
> or
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.w3.org/HTML/1998/html4/"),URI.createURI("./h.xsd"));
>
>
> but none solves the problem. Which is the correct URI mapping for a
> case like our:
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
>
>
> Notice that, in the for cycle over the resources of the resourceSet,
> the imported resources correctly inherit the absolute path from the
> main resource.
> In case you need the complete schema we are using I can send it.
> Running xsdMainExample load and validate on it gives the same
> Unresolved import problems.
>
>
>
> Any help is greatly appreciated,
>
> thanks in advance
>
> Tommaso
>
>
>
Re: import resolution and namespaces [message #72477 is a reply to message #72456] Wed, 20 June 2007 17:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: t.agnoloni.gmail.com

it works,
imports are now correctly resolved. However we are still experiencing some
odd behaviour which I presume is due to the policy described in the
documentation

"An unresolved instance is synthesized to hold the namespace and name if
an existing instance cannot be found"


Our aim is to extract ElementDeclaration and TypeDefinition from the main
schema to build related automata.

For example here we look for the definition of element "p" defined in
h.xsd of complex type "inlinefac" defined in globali.xsd

Running the same code of my previous post with the addition of your code

for (Object content : xsdSchema.getContents())
{
if (content instanceof XSDImport)
{
XSDImport xsdImport = (XSDImport)content;
xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
}
}



1) for nirstrict.xsd [main schema file]


Resolved schema ./h.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
IMPORT: location --> ./h.xsd
Resolved schema ./globali.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd

ELEMENT from xsdResource.getSchema().getElementDeclarations();

org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
[xsd:element: null]) (name: p, targetNamespace:
http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element: null)
(name: inlinefac, targetNamespace: http://www.normeinrete.it/nir/2.2/)
(variety: atomic, final: null, lexicalFinal: null, validFacets: null)

TYPE from xsdResource.getSchema().getTypeDefinitions();

org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)


i.e. the element p is of simpleType inlinefac while inlinefac is
actually a complexType



2) for h.xsd [imported schema file]

Resolved schema ./nirstrict.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/h.xsd
IMPORT: namespace --> http://www.normeinrete.it/nir/2.2/
IMPORT: location --> ./nirstrict.xsd

ELEMENT from xsdResource.getSchema().getElementDeclarations();

org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
[xsd:element: null]) (name: p, targetNamespace:
http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)

TYPE from xsdResource.getSchema().getTypeDefinitions();

org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)

i.e. correct result p is of complexType inlinefac which is actually a
complexType


I assume that for some reason in the 1st case the forced
resolveTypeDefinition() gets the empty default value which does not
correspond to the correct one.

How can we get the correct existing instance of the ComplexType starting
from the main schema ?
Do we have to specify localName different from the empty string in

xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");

, or call other methods like

resolveAttributeDeclaration()
resolveAttributeGroupDefinition() and so on ?



These are the xsd example

_____________________

nirstrict.xsd
_____________________

<xsd:schema
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:h="http://www.w3.org/HTML/1998/html4"
targetNamespace="http://www.normeinrete.it/nir/2.2/"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

<xsd:import namespace="http://www.w3.org/HTML/1998/html4"
schemaLocation="./h.xsd"/>
<xsd:include schemaLocation="./globali.xsd"/>

<xsd:element name="Legge" type="xsd:string" />


</xsd:schema>

_______________

h.xsd
_______________


<xsd:schema targetNamespace="http://www.w3.org/HTML/1998/html4"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:h="http://www.w3.org/HTML/1998/html4" elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:import namespace="http://www.normeinrete.it/nir/2.2/"
schemaLocation="./nirstrict.xsd"/>

<xsd:element name="p" type="inlinefac" />

</xsd:schema>


_______________

globali.xsd
_______________


<xsd:schema
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:h="http://www.w3.org/HTML/1998/html4"
targetNamespace="http://www.normeinrete.it/nir/2.2/"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

<xsd:import namespace="http://www.w3.org/HTML/1998/html4"
schemaLocation="./h.xsd"/>

<xsd:attributeGroup name="link">
<xsd:attribute ref="xlink:type" />
<xsd:attribute ref="xlink:href" />
</xsd:attributeGroup>

<xsd:attributeGroup name="nome">
<xsd:attribute name="nome" type="NIRnome" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="nomefac">
<xsd:attribute name="nome" type="NIRnome"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="tempi">
<xsd:attribute name="iniziovigore" type="uri"/>
<xsd:attribute name="finevigore" type="uri"/>
<xsd:attribute name="inizioefficacia" type="uri"/>
<xsd:attribute name="fineefficacia" type="uri"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="vigenza">
<xsd:attributeGroup ref="tempi"/>
<xsd:attribute name="rel" type="uri"/>
<xsd:attribute name="status" type="status"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="implicita">
<xsd:attribute name="implicita" type="sino" default="no" />
</xsd:attributeGroup>

<xsd:attributeGroup name="css">
<xsd:attribute ref="h:style" />
<xsd:attribute ref="h:class" />
<xsd:attribute ref="h:title" />
</xsd:attributeGroup>

<xsd:attributeGroup name="idreq">
<xsd:attribute name="id" type="id" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="idfac">
<xsd:attribute name="id" type="id"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="idnorma">
<xsd:attribute name="id" type="anytoken"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="globalireq">
<xsd:attributeGroup ref="css"/>
<xsd:attributeGroup ref="idreq"/>
<xsd:attributeGroup ref="vigenza"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="globalifac">
<xsd:attributeGroup ref="css"/>
<xsd:attributeGroup ref="idfac"/>
<xsd:attributeGroup ref="vigenza"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="globalinorma">
<xsd:attributeGroup ref="css"/>
<xsd:attributeGroup ref="idnorma"/>
<xsd:attributeGroup ref="vigenza"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="data">
<xsd:attribute name="norm" type="NIRdate" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="dove">
<xsd:attribute name="codice" type="NIRdove" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="codice">
<xsd:attribute name="codice" type="NIRcodice" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="val">
<xsd:attribute name="valore" type="anystring" use="required"/>
</xsd:attributeGroup>

<xsd:annotation>
<xsd:documentation>
============================================================ =========

Entita': content model comuni ai vari tipi di elementi

============================================================ =========
</xsd:documentation>
</xsd:annotation>

<xsd:group name="liste">
<xsd:choice>
<xsd:element ref="h:ul"/>
<xsd:element ref="h:ol"/>
<xsd:element ref="h:dl"/>
</xsd:choice>
</xsd:group>

<xsd:group name="genvuoti">
<xsd:choice>
<xsd:element ref="vuoto"/>
<xsd:element ref="ndr"/>
</xsd:choice>
</xsd:group>

<xsd:group name="geninline">
<xsd:sequence>
<xsd:element ref="inlinea"/>
</xsd:sequence>
</xsd:group>

<xsd:group name="genblocchi">
<xsd:sequence>
<xsd:element ref="blocco"/>
</xsd:sequence>
</xsd:group>

<xsd:group name="genstruct">
<xsd:choice>
<xsd:element ref="contenitore"/>
<xsd:element ref="gerarchia"/>
<xsd:element ref="articolato"/>
</xsd:choice>
</xsd:group>

<xsd:group name="txtvuoti">
<xsd:choice>
<xsd:element ref="h:br"/>
<xsd:element ref="h:hr"/>
<xsd:element ref="h:img"/>
</xsd:choice>
</xsd:group>

<xsd:group name="txtinline">
<xsd:choice>
<xsd:element ref="h:span"/>
<xsd:element ref="h:i"/>
<xsd:element ref="h:u"/>
<xsd:element ref="h:b"/>
<xsd:element ref="h:sup"/>
<xsd:element ref="h:sub"/>
<xsd:element ref="h:a"/>
</xsd:choice>
</xsd:group>

<xsd:group name="txtblocchi">
<xsd:choice>
<xsd:element ref="h:div"/>
<xsd:element ref="h:p"/>
<xsd:element ref="h:form"/>
<xsd:element ref="h:table"/>
<xsd:element ref="h:object"/>
<xsd:group ref="liste" />
</xsd:choice>
</xsd:group>

<xsd:group name="nrminline">
<xsd:choice>
<xsd:element ref="rif"/>
<xsd:element ref="irif"/>
<xsd:element ref="mrif"/>
<xsd:element ref="mod"/>
<xsd:element ref="def"/>
<xsd:element ref="atto"/>
<xsd:element ref="soggetto"/>
<xsd:element ref="luogo"/>
<xsd:element ref="ente"/>
<xsd:element ref="data"/>
<xsd:element ref="importo"/>
</xsd:choice>
</xsd:group>

<xsd:group name="nrmstruct">
<xsd:choice>
<xsd:element ref="intestazione"/>
<xsd:element ref="formulainiziale"/>
<xsd:element ref="preambolo"/>
<xsd:element ref="formulafinale"/>
<xsd:element ref="conclusione"/>
<xsd:element ref="annessi"/>
</xsd:choice>
</xsd:group>

<xsd:group name="allvuoti">
<xsd:choice>
<xsd:group ref="genvuoti" />
<xsd:group ref="txtvuoti" />
</xsd:choice>
</xsd:group>

<xsd:group name="allinline">
<xsd:choice>
<xsd:group ref="geninline" />
<xsd:group ref="txtinline" />
<xsd:group ref="nrminline" />
</xsd:choice>
</xsd:group>

<xsd:group name="allblocchi">
<xsd:choice>
<xsd:group ref="genblocchi" />
<xsd:group ref="txtblocchi" />
</xsd:choice>
</xsd:group>

<xsd:group name="allstruct">
<xsd:choice>
<xsd:group ref="genstruct" />
<xsd:group ref="nrmstruct" />
</xsd:choice>
</xsd:group>

<xsd:group name="elinline">
<xsd:choice>
<xsd:group ref="allinline" />
<xsd:group ref="allvuoti" />
</xsd:choice>
</xsd:group>

<xsd:group name="strutture">
<xsd:sequence>
<xsd:group ref="allstruct" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:group>


<xsd:complexType name="inline" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
<xsd:group ref="elinline" />
</xsd:choice>
</xsd:complexType>

<xsd:complexType name="blocchi" >
<xsd:sequence minOccurs="1" maxOccurs="unbounded" >
<xsd:group ref="allblocchi" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ParaLevel" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
<xsd:group ref="elinline" />
<xsd:group ref="allblocchi" />
</xsd:choice>
<xsd:attributeGroup ref="globalifac"/>
</xsd:complexType>

<xsd:complexType name="ParaLevelReq" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
<xsd:group ref="elinline" />
<xsd:group ref="allblocchi" />
</xsd:choice>
<xsd:attributeGroup ref="globalireq"/>
</xsd:complexType>

<xsd:complexType name="valore" >
<xsd:attributeGroup ref="val"/>
</xsd:complexType>

<xsd:complexType name="empty" >
</xsd:complexType>

<xsd:complexType name="emptyfac" >
<xsd:attributeGroup ref="globalifac"/>
</xsd:complexType>

<xsd:complexType name="emptyreq" >
<xsd:attributeGroup ref="globalireq"/>
</xsd:complexType>


<xsd:complexType name="inlinefac" mixed="true">
<xsd:complexContent>
<xsd:extension base="inline">
<xsd:attributeGroup ref="globalifac"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>


<xsd:complexType name="inlinereq" mixed="true">
<xsd:complexContent>
<xsd:extension base="inline">
<xsd:attributeGroup ref="globalireq"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="blocchireq" >
<xsd:complexContent>
<xsd:extension base="blocchi">
<xsd:attributeGroup ref="globalireq"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="blocchifac" >
<xsd:complexContent>
<xsd:extension base="blocchi">
<xsd:attributeGroup ref="globalifac"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
Re: import resolution and namespaces [message #72505 is a reply to message #72477] Wed, 20 June 2007 21:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------000502040701020001030200
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Tommaso,

What URI are you using to load the document? The reference resolves
fine for me when I load it in the editor like this:




Tommaso wrote:
> it works,
> imports are now correctly resolved. However we are still experiencing
> some odd behaviour which I presume is due to the policy described in
> the documentation
>
> "An unresolved instance is synthesized to hold the namespace and name
> if an existing instance cannot be found"
>
>
> Our aim is to extract ElementDeclaration and TypeDefinition from the
> main schema to build related automata.
>
> For example here we look for the definition of element "p" defined in
> h.xsd of complex type "inlinefac" defined in globali.xsd
>
> Running the same code of my previous post with the addition of your code
>
> for (Object content : xsdSchema.getContents())
> {
> if (content instanceof XSDImport)
> {
> XSDImport xsdImport = (XSDImport)content;
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
> }
> }
>
>
>
> 1) for nirstrict.xsd [main schema file]
>
>
> Resolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> Resolved schema ./globali.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
>
> ELEMENT from xsdResource.getSchema().getElementDeclarations();
>
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
> [xsd:element: null]) (name: p, targetNamespace:
> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element:
> null) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (variety: atomic, final: null,
> lexicalFinal: null, validFacets: null)
>
> TYPE from xsdResource.getSchema().getTypeDefinitions();
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
>
>
> i.e. the element p is of simpleType inlinefac while inlinefac is
> actually a complexType
>
>
> 2) for h.xsd [imported schema file]
>
> Resolved schema ./nirstrict.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/h.xsd
> IMPORT: namespace --> http://www.normeinrete.it/nir/2.2/
> IMPORT: location --> ./nirstrict.xsd
>
> ELEMENT from xsdResource.getSchema().getElementDeclarations();
>
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
> [xsd:element: null]) (name: p, targetNamespace:
> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
>
> TYPE from xsdResource.getSchema().getTypeDefinitions();
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
>
> i.e. correct result p is of complexType inlinefac which is actually
> a complexType
>
>
> I assume that for some reason in the 1st case the forced
> resolveTypeDefinition() gets the empty default value which does not
> correspond to the correct one.
>
> How can we get the correct existing instance of the ComplexType
> starting from the main schema ?
> Do we have to specify localName different from the empty string in
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>
> , or call other methods like
>
> resolveAttributeDeclaration()
> resolveAttributeGroupDefinition() and so on ?
>
>
>
> These are the xsd example
>
> _____________________
>
> nirstrict.xsd
> _____________________
>
> <xsd:schema xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> targetNamespace="http://www.normeinrete.it/nir/2.2/"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
> <xsd:include schemaLocation="./globali.xsd"/>
>
> <xsd:element name="Legge" type="xsd:string" />
>
>
> </xsd:schema>
>
> _______________
>
> h.xsd
> _______________
>
>
> <xsd:schema targetNamespace="http://www.w3.org/HTML/1998/html4"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:import namespace="http://www.normeinrete.it/nir/2.2/"
> schemaLocation="./nirstrict.xsd"/>
>
> <xsd:element name="p" type="inlinefac" />
>
> </xsd:schema>
>
>
> _______________
>
> globali.xsd
> _______________
>
>
> <xsd:schema xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> targetNamespace="http://www.normeinrete.it/nir/2.2/"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
>
> <xsd:attributeGroup name="link">
> <xsd:attribute ref="xlink:type" />
> <xsd:attribute ref="xlink:href" />
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="nome">
> <xsd:attribute name="nome" type="NIRnome" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="nomefac">
> <xsd:attribute name="nome" type="NIRnome"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="tempi">
> <xsd:attribute name="iniziovigore" type="uri"/>
> <xsd:attribute name="finevigore" type="uri"/>
> <xsd:attribute name="inizioefficacia" type="uri"/>
> <xsd:attribute name="fineefficacia" type="uri"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="vigenza">
> <xsd:attributeGroup ref="tempi"/>
> <xsd:attribute name="rel" type="uri"/>
> <xsd:attribute name="status" type="status"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="implicita">
> <xsd:attribute name="implicita" type="sino" default="no" />
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="css">
> <xsd:attribute ref="h:style" />
> <xsd:attribute ref="h:class" />
> <xsd:attribute ref="h:title" />
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="idreq">
> <xsd:attribute name="id" type="id" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="idfac">
> <xsd:attribute name="id" type="id"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="idnorma">
> <xsd:attribute name="id" type="anytoken"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="globalireq">
> <xsd:attributeGroup ref="css"/>
> <xsd:attributeGroup ref="idreq"/>
> <xsd:attributeGroup ref="vigenza"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="globalifac">
> <xsd:attributeGroup ref="css"/>
> <xsd:attributeGroup ref="idfac"/>
> <xsd:attributeGroup ref="vigenza"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="globalinorma">
> <xsd:attributeGroup ref="css"/>
> <xsd:attributeGroup ref="idnorma"/>
> <xsd:attributeGroup ref="vigenza"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="data">
> <xsd:attribute name="norm" type="NIRdate" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="dove">
> <xsd:attribute name="codice" type="NIRdove" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="codice">
> <xsd:attribute name="codice" type="NIRcodice" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="val">
> <xsd:attribute name="valore" type="anystring" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:annotation>
> <xsd:documentation>
>
> ============================================================ =========
>
> Entita': content model comuni ai vari tipi di elementi
>
>
> ============================================================ =========
> </xsd:documentation>
> </xsd:annotation>
>
> <xsd:group name="liste">
> <xsd:choice>
> <xsd:element ref="h:ul"/>
> <xsd:element ref="h:ol"/>
> <xsd:element ref="h:dl"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="genvuoti">
> <xsd:choice>
> <xsd:element ref="vuoto"/>
> <xsd:element ref="ndr"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="geninline">
> <xsd:sequence>
> <xsd:element ref="inlinea"/>
> </xsd:sequence>
> </xsd:group>
>
> <xsd:group name="genblocchi">
> <xsd:sequence>
> <xsd:element ref="blocco"/>
> </xsd:sequence>
> </xsd:group>
>
> <xsd:group name="genstruct">
> <xsd:choice>
> <xsd:element ref="contenitore"/>
> <xsd:element ref="gerarchia"/>
> <xsd:element ref="articolato"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="txtvuoti">
> <xsd:choice>
> <xsd:element ref="h:br"/>
> <xsd:element ref="h:hr"/>
> <xsd:element ref="h:img"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="txtinline">
> <xsd:choice>
> <xsd:element ref="h:span"/>
> <xsd:element ref="h:i"/>
> <xsd:element ref="h:u"/>
> <xsd:element ref="h:b"/>
> <xsd:element ref="h:sup"/>
> <xsd:element ref="h:sub"/>
> <xsd:element ref="h:a"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="txtblocchi">
> <xsd:choice>
> <xsd:element ref="h:div"/>
> <xsd:element ref="h:p"/>
> <xsd:element ref="h:form"/>
> <xsd:element ref="h:table"/>
> <xsd:element ref="h:object"/>
> <xsd:group ref="liste" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="nrminline">
> <xsd:choice>
> <xsd:element ref="rif"/>
> <xsd:element ref="irif"/>
> <xsd:element ref="mrif"/>
> <xsd:element ref="mod"/>
> <xsd:element ref="def"/>
> <xsd:element ref="atto"/>
> <xsd:element ref="soggetto"/>
> <xsd:element ref="luogo"/>
> <xsd:element ref="ente"/>
> <xsd:element ref="data"/>
> <xsd:element ref="importo"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="nrmstruct">
> <xsd:choice>
> <xsd:element ref="intestazione"/>
> <xsd:element ref="formulainiziale"/>
> <xsd:element ref="preambolo"/>
> <xsd:element ref="formulafinale"/>
> <xsd:element ref="conclusione"/>
> <xsd:element ref="annessi"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allvuoti">
> <xsd:choice>
> <xsd:group ref="genvuoti" />
> <xsd:group ref="txtvuoti" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allinline">
> <xsd:choice>
> <xsd:group ref="geninline" />
> <xsd:group ref="txtinline" />
> <xsd:group ref="nrminline" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allblocchi">
> <xsd:choice>
> <xsd:group ref="genblocchi" />
> <xsd:group ref="txtblocchi" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allstruct">
> <xsd:choice>
> <xsd:group ref="genstruct" />
> <xsd:group ref="nrmstruct" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="elinline">
> <xsd:choice>
> <xsd:group ref="allinline" />
> <xsd:group ref="allvuoti" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="strutture">
> <xsd:sequence>
> <xsd:group ref="allstruct" minOccurs="1"
> maxOccurs="unbounded" />
> </xsd:sequence>
> </xsd:group>
>
>
> <xsd:complexType name="inline" mixed="true">
> <xsd:choice minOccurs="0" maxOccurs="unbounded" >
> <xsd:group ref="elinline" />
> </xsd:choice>
> </xsd:complexType>
>
> <xsd:complexType name="blocchi" >
> <xsd:sequence minOccurs="1" maxOccurs="unbounded" >
> <xsd:group ref="allblocchi" />
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="ParaLevel" mixed="true">
> <xsd:choice minOccurs="0" maxOccurs="unbounded" >
> <xsd:group ref="elinline" />
> <xsd:group ref="allblocchi" />
> </xsd:choice>
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:complexType>
>
> <xsd:complexType name="ParaLevelReq" mixed="true">
> <xsd:choice minOccurs="0" maxOccurs="unbounded" >
> <xsd:group ref="elinline" />
> <xsd:group ref="allblocchi" />
> </xsd:choice>
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:complexType>
>
> <xsd:complexType name="valore" >
> <xsd:attributeGroup ref="val"/>
> </xsd:complexType>
>
> <xsd:complexType name="empty" >
> </xsd:complexType>
>
> <xsd:complexType name="emptyfac" >
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:complexType>
>
> <xsd:complexType name="emptyreq" >
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:complexType>
>
>
> <xsd:complexType name="inlinefac" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="inline">
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
>
> <xsd:complexType name="inlinereq" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="inline">
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="blocchireq" >
> <xsd:complexContent>
> <xsd:extension base="blocchi">
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="blocchifac" >
> <xsd:complexContent>
> <xsd:extension base="blocchi">
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> </xsd:schema>
>
>
>
>
>
>
>
>


--------------000502040701020001030200
Content-Type: multipart/related;
boundary="------------060208010200000509080808"


--------------060208010200000509080808
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Tommaso,<br>
<br>
What URI are you using to load the document?
Re: import resolution and namespaces [message #72521 is a reply to message #72505] Wed, 20 June 2007 22:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: t.agnoloni.gmail.com

Yes, the editor loads and resolves correctly the schema. But we are using
the org.eclipse.xsd library (version 2.2.3 to keep compatibility with java
1.4) as standalone in order to create and query the automata of schema
elements for validation. The code with which we load the xsd is the
following:

where schemaUrl is the location of the main schema nirstrict.xsd or,
alternatively, of the imported schema h.xsd in case 1 and 2 of previous
post


/**
* * @param schemaURL
* @return
* @throws Exception
*/
public static XSDSchema loadSchemaUsingResourceSet(String schemaURL)
throws Exception{

System.out.println("--> Loading Schema Using Resource Set @ url "+schemaURL);

XSDResourceFactoryImpl resourceFactory = new XSDResourceFactoryImpl();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",resourceFactory);

//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// ////////////////////
//
// absolute Path of schemaURL
//
File file = new File(schemaURL);
if (file.isFile())
schemaURL =
URI.createFileURI(file.getCanonicalFile().toString()).toStri ng();

// Create a resource set and load the main schema file into it.
ResourceSet resourceSet = new ResourceSetImpl();
//
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./xlink.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/xlink.xsd "));//,URI.createURI("./xlink.xsd"));
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.w3.org/HTML/1998/html4/"),URI.createURI("./h.xsd"));//,URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));//,URI.createURI("./h.xsd"));

//resourceSet.getURIConverter().getURIMap().put(URI.createUR I( "./dsp.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/dsp.xsd "));//,URI.createURI("./dsp.xsd"));

System.err.println("URIMAP:
" +resourceSet.getURIConverter().getURIMap().entrySet().toStri ng());
resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
Boolean.TRUE);


XSDResourceImpl xsdSchemaResource = null;
try
{
xsdSchemaResource =
(XSDResourceImpl)resourceSet.getResource(URI.createURI(schem aURL),true);
}
catch(Exception e)
{
System.err.println("Exception caught in method 'load schema using
ResourceSet' message = " + e.getMessage() + " xsdSchemaResource: " +
xsdSchemaResource);
}


Resource resource = (Resource)xsdSchemaResource;
if (resource instanceof XSDResourceImpl)
{
XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
// Iterate over the schema's content's looking for directives.
XSDSchema xsdSchema = xsdResource.getSchema();



for (Iterator contents = xsdSchema.getContents().iterator();
contents.hasNext(); ){

XSDSchemaContent xsdSchemaContent = (XSDSchemaContent)contents.next();

if (xsdSchemaContent instanceof XSDImport)
{
XSDImport xsdImport = (XSDImport)xsdSchemaContent;

xsdImport.resolveModelGroupDefinition(xsdImport.getNamespace (), "");

xsdImport.resolveElementDeclaration(xsdImport.getNamespace() , "");

xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");

xsdImport.resolveComplexTypeDefinition(xsdImport.getNamespac e(), "");
}


if (xsdSchemaContent instanceof XSDSchemaDirective){
XSDSchemaDirective xsdSchemaDirective =
(XSDSchemaDirective)xsdSchemaContent;
if (xsdSchemaDirective.getResolvedSchema() == null){
System.err.println("Unresolved schema "+
xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());

if(xsdSchemaDirective instanceof XSDImport){
XSDImport xsdSchemaImport = (XSDImport)xsdSchemaDirective;
System.err.println(" IMPORT: namespace -->
"+xsdSchemaImport.getNamespace());
System.err.println(" IMPORT: location -->
"+xsdSchemaImport.getSchemaLocation());
}
}
else{
System.err.println("Resolved schema "+
xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
if(xsdSchemaDirective instanceof XSDImport){
XSDImport xsdSchemaImport = (XSDImport)xsdSchemaDirective;
System.err.println(" IMPORT: namespace -->
"+xsdSchemaImport.getNamespace());
System.err.println(" IMPORT: location -->
"+xsdSchemaImport.getSchemaLocation());
}
}
}
}



List allElements = xsdResource.getSchema().getElementDeclarations();
System.err.println("----------------------> elements found");
for(Iterator ite = allElements.iterator(); ite.hasNext();){
Object ob = ite.next();
System.err.println(ob.toString());
System.err.println(" Type
"+((XSDElementDeclaration)ob).getType().toString());
}

List allTypes = xsdResource.getSchema().getTypeDefinitions();
System.err.println("----------------------> types found");
for(Iterator ite = allTypes.iterator(); ite.hasNext();){
System.err.println(ite.next().toString());
}

return xsdResource.getSchema();
}
System.err.println("loadSchemaUsingResourceSet(" + schemaURL + ") did
not contain any schemas!");
return null;
}
Re: import resolution and namespaces [message #72539 is a reply to message #72521] Wed, 20 June 2007 22:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Tommaso,

There should be no need for URI mappings to make this work (assuming
files are really in the correct relative locations, i.e, all in the same
folder). What's the actual value of schemaURL at the point when you
call getResource?


Tommaso wrote:
> Yes, the editor loads and resolves correctly the schema. But we are
> using the org.eclipse.xsd library (version 2.2.3 to keep compatibility
> with java 1.4) as standalone in order to create and query the automata
> of schema elements for validation. The code with which we load the xsd
> is the following:
>
> where schemaUrl is the location of the main schema nirstrict.xsd or,
> alternatively, of the imported schema h.xsd in case 1 and 2 of
> previous post
>
>
> /**
> * * @param schemaURL
> * @return
> * @throws Exception
> */
> public static XSDSchema loadSchemaUsingResourceSet(String
> schemaURL) throws Exception{
>
> System.out.println("--> Loading Schema Using Resource Set @
> url "+schemaURL);
>
> XSDResourceFactoryImpl resourceFactory = new
> XSDResourceFactoryImpl();
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",resourceFactory);
>
>
>
> //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// ////////////////////
>
> //
> // absolute Path of schemaURL
> //
> File file = new File(schemaURL);
> if (file.isFile())
> schemaURL =
> URI.createFileURI(file.getCanonicalFile().toString()).toStri ng();
>
> // Create a resource set and load the main schema file into it.
> ResourceSet resourceSet = new ResourceSetImpl(); //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./xlink.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/xlink.xsd "));//,URI.createURI("./xlink.xsd"));
>
>
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.w3.org/HTML/1998/html4/"),URI.createURI("./h.xsd"));//,URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));//,URI.createURI("./h.xsd"));
>
>
> //resourceSet.getURIConverter().getURIMap().put(URI.createUR I( "./dsp.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/dsp.xsd "));//,URI.createURI("./dsp.xsd"));
>
>
> System.err.println("URIMAP:
> " +resourceSet.getURIConverter().getURIMap().entrySet().toStri ng());
>
> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
> Boolean.TRUE);
>
>
> XSDResourceImpl xsdSchemaResource = null;
> try
> {
> xsdSchemaResource =
> (XSDResourceImpl)resourceSet.getResource(URI.createURI(schem aURL),true);
> }
> catch(Exception e)
> {
> System.err.println("Exception caught in method 'load
> schema using ResourceSet' message = " + e.getMessage() + "
> xsdSchemaResource: " +
> xsdSchemaResource); }
>
>
> Resource resource = (Resource)xsdSchemaResource;
> if (resource instanceof XSDResourceImpl)
> {
> XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
> // Iterate over the schema's content's looking for
> directives.
> XSDSchema xsdSchema = xsdResource.getSchema();
>
>
>
> for (Iterator contents =
> xsdSchema.getContents().iterator(); contents.hasNext(); ){
>
> XSDSchemaContent xsdSchemaContent =
> (XSDSchemaContent)contents.next();
>
> if (xsdSchemaContent instanceof XSDImport)
> {
> XSDImport xsdImport = (XSDImport)xsdSchemaContent;
>
> xsdImport.resolveModelGroupDefinition(xsdImport.getNamespace (), "");
>
> xsdImport.resolveElementDeclaration(xsdImport.getNamespace() , "");
>
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>
> xsdImport.resolveComplexTypeDefinition(xsdImport.getNamespac e(), "");
> }
>
>
> if (xsdSchemaContent instanceof
> XSDSchemaDirective){
> XSDSchemaDirective xsdSchemaDirective =
> (XSDSchemaDirective)xsdSchemaContent;
> if (xsdSchemaDirective.getResolvedSchema() == null){
> System.err.println("Unresolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
>
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println(" IMPORT: namespace -->
> "+xsdSchemaImport.getNamespace());
> System.err.println(" IMPORT: location -->
> "+xsdSchemaImport.getSchemaLocation());
> }
> }
> else{
> System.err.println("Resolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println(" IMPORT: namespace -->
> "+xsdSchemaImport.getNamespace());
> System.err.println(" IMPORT: location -->
> "+xsdSchemaImport.getSchemaLocation());
> }
> } }
> }
>
>
>
> List allElements =
> xsdResource.getSchema().getElementDeclarations();
> System.err.println("----------------------> elements found");
> for(Iterator ite = allElements.iterator(); ite.hasNext();){
> Object ob = ite.next();
> System.err.println(ob.toString());
> System.err.println(" Type
> "+((XSDElementDeclaration)ob).getType().toString());
> }
> List allTypes =
> xsdResource.getSchema().getTypeDefinitions();
> System.err.println("----------------------> types found");
> for(Iterator ite = allTypes.iterator(); ite.hasNext();){
> System.err.println(ite.next().toString());
> }
>
> return xsdResource.getSchema();
> }
> System.err.println("loadSchemaUsingResourceSet(" + schemaURL +
> ") did not contain any schemas!");
> return null;
> }
>
Re: import resolution and namespaces [message #72557 is a reply to message #72539] Wed, 20 June 2007 22:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: t.agnoloni.gmail.com

Yes, adding or commenting the URI mapping does not have any effect as the
files are all in the same folder.

The value of the schemaURL when calling getResource is correctly set as
the absolute path of the xsd

file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd


The output follows; the problem here is that the element "p" of type
"inlinefac" turns out to be an XSDSympleType, while, listing
getTypeDefinitions(), "inlinefac" is actually a ComplexType.

The assignment of "p" as a SimpleType occurs when enforcing the import
resolution in

xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");

going inside this method with debugger shows that

XSDSchemaImpl.resolveTypeDefinition()

gives a null result and enforces

createUnresolvedTypeDefinition(namespace, localName);

which probably assumes an empty simpleType "inlinefac" with only name and
namespace set while the actual "inlinefac" type is complex.

How do I manage to associate "p" with its actual complexType ?



OUTPUT:
__________________________

URIMAP: [http://www.w3.org/HTML/1998/html4/->./h.xsd]
Resolved schema ./h.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
IMPORT: location --> ./h.xsd
Resolved schema ./globali.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
----------------------> elements found
org.eclipse.xsd.impl.XSDElementDeclarationImpl@113a53d (element:
[xsd:element: null]) (name: Legge, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@c5495e (element:
[xs:simpleType: null]) (name: string, targetNamespace:
http://www.w3.org/2001/XMLSchema) (variety: atomic, final: [],
lexicalFinal: null, validFacets: [length, minLength, maxLength, pattern,
enumeration, whiteSpace])
org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
[xsd:element: null]) (name: p, targetNamespace:
http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element: null)
(name: inlinefac, targetNamespace: http://www.normeinrete.it/nir/2.2/)
(variety: atomic, final: null, lexicalFinal: null, validFacets: null)
----------------------> types found
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@297ffb (element:
[xsd:complexType: null]) (name: blocchi, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: elementOnly,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
<unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@914f6a (element:
[xsd:complexType: null]) (name: blocchifac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: elementOnly,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
<unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f4cbee (element:
[xsd:complexType: null]) (name: blocchireq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: elementOnly,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
<unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@787d6a (element:
[xsd:complexType: null]) (name: empty, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@71dc3d (element:
[xsd:complexType: null]) (name: emptyfac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1326484 (element:
[xsd:complexType: null]) (name: emptyreq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16546ef (element:
[xsd:complexType: null]) (name: inline, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: mixed, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@18a49e0 (element:
[xsd:complexType: null]) (name: inlinereq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f82982 (element:
[xsd:complexType: null]) (name: ParaLevel, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: mixed, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16d2633 (element:
[xsd:complexType: null]) (name: ParaLevelReq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: mixed, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@e70e30 (element:
[xsd:complexType: null]) (name: valore, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
loaded schema
TARGET NAMESPACE: http://www.normeinrete.it/nir/2.2/
********** AUTOMA simple DI Legge ************
Component: - [0, -1]
State: 0 *
********** AUTOMA simple DI h:p ************
Component: - [0, -1]
State: 0 *
Creating Rules DONE
Re: import resolution and namespaces [message #72577 is a reply to message #72557] Thu, 21 June 2007 02:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------020207070201070405030301
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Tomamaso,

I think you are running into the problem fixed by 106098
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=106098> so it would be
good to try the latest 2.2.4 maintenance build.


tommaso wrote:
> Yes, adding or commenting the URI mapping does not have any effect as
> the files are all in the same folder.
>
> The value of the schemaURL when calling getResource is correctly set
> as the absolute path of the xsd
>
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
>
>
> The output follows; the problem here is that the element "p" of type
> "inlinefac" turns out to be an XSDSympleType, while, listing
> getTypeDefinitions(), "inlinefac" is actually a ComplexType.
> The assignment of "p" as a SimpleType occurs when enforcing the import
> resolution in
>
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>
> going inside this method with debugger shows that
> XSDSchemaImpl.resolveTypeDefinition()
>
> gives a null result and enforces
>
> createUnresolvedTypeDefinition(namespace, localName);
>
> which probably assumes an empty simpleType "inlinefac" with only name
> and namespace set while the actual "inlinefac" type is complex.
>
> How do I manage to associate "p" with its actual complexType ?
>
>
>
> OUTPUT:
> __________________________
>
> URIMAP: [http://www.w3.org/HTML/1998/html4/->./h.xsd]
> Resolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> Resolved schema ./globali.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
> ----------------------> elements found
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@113a53d (element:
> [xsd:element: null]) (name: Legge, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@c5495e (element:
> [xs:simpleType: null]) (name: string, targetNamespace:
> http://www.w3.org/2001/XMLSchema) (variety: atomic, final: [],
> lexicalFinal: null, validFacets: [length, minLength, maxLength,
> pattern, enumeration, whiteSpace])
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
> [xsd:element: null]) (name: p, targetNamespace:
> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element:
> null) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (variety: atomic, final: null,
> lexicalFinal: null, validFacets: null)
> ----------------------> types found
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@297ffb (element:
> [xsd:complexType: null]) (name: blocchi, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: elementOnly,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@914f6a (element:
> [xsd:complexType: null]) (name: blocchifac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f4cbee (element:
> [xsd:complexType: null]) (name: blocchireq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@787d6a (element:
> [xsd:complexType: null]) (name: empty, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@71dc3d (element:
> [xsd:complexType: null]) (name: emptyfac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1326484 (element:
> [xsd:complexType: null]) (name: emptyreq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16546ef (element:
> [xsd:complexType: null]) (name: inline, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@18a49e0 (element:
> [xsd:complexType: null]) (name: inlinereq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f82982 (element:
> [xsd:complexType: null]) (name: ParaLevel, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16d2633 (element:
> [xsd:complexType: null]) (name: ParaLevelReq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@e70e30 (element:
> [xsd:complexType: null]) (name: valore, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> loaded schema
> TARGET NAMESPACE: http://www.normeinrete.it/nir/2.2/
> ********** AUTOMA simple DI Legge ************
> Component: - [0, -1]
> State: 0 *
> ********** AUTOMA simple DI h:p ************
> Component: - [0, -1]
> State: 0 *
> Creating Rules DONE
>


--------------020207070201070405030301
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tomamaso,<br>
<br>
I think you are running into the problem fixed by <a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=106098">106098</a>
so it would be good to try the latest 2.2.4 maintenance build.<br>
<br>
<br>
tommaso wrote:
<blockquote
cite="mid:ae393ae25ff823af08524d193649f3bf$1@www.eclipse.org"
type="cite">Yes, adding or commenting the URI mapping does not have
any effect as the files are all in the same folder.
<br>
<br>
The value of the schemaURL
Re: import resolution and namespaces [message #72595 is a reply to message #72577] Thu, 21 June 2007 02:39 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------080007070100000700030604
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Tommaso,

Sorry for misspelling your name. It's late...


Ed Merks wrote:
> Tomamaso,
>
> I think you are running into the problem fixed by 106098
> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=106098> so it would be
> good to try the latest 2.2.4 maintenance build.
>
>
> tommaso wrote:
>> Yes, adding or commenting the URI mapping does not have any effect as
>> the files are all in the same folder.
>>
>> The value of the schemaURL when calling getResource is correctly set
>> as the absolute path of the xsd
>>
>> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>>
>>
>>
>> The output follows; the problem here is that the element "p" of type
>> "inlinefac" turns out to be an XSDSympleType, while, listing
>> getTypeDefinitions(), "inlinefac" is actually a ComplexType.
>> The assignment of "p" as a SimpleType occurs when enforcing the
>> import resolution in
>>
>> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>>
>> going inside this method with debugger shows that
>> XSDSchemaImpl.resolveTypeDefinition()
>>
>> gives a null result and enforces
>>
>> createUnresolvedTypeDefinition(namespace, localName);
>>
>> which probably assumes an empty simpleType "inlinefac" with only name
>> and namespace set while the actual "inlinefac" type is complex.
>>
>> How do I manage to associate "p" with its actual complexType ?
>>
>>
>>
>> OUTPUT:
>> __________________________
>>
>> URIMAP: [http://www.w3.org/HTML/1998/html4/->./h.xsd]
>> Resolved schema ./h.xsd in
>> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>>
>> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
>> IMPORT: location --> ./h.xsd
>> Resolved schema ./globali.xsd in
>> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>>
>> ----------------------> elements found
>> org.eclipse.xsd.impl.XSDElementDeclarationImpl@113a53d (element:
>> [xsd:element: null]) (name: Legge, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (value: null, constraint:
>> <unset>, form: qualified, lexicalValue: null) (nillable: <unset>,
>> disallowedSubstitutions: [], substitutionGroupExclusions: [],
>> abstract: <unset>, lexicalFinal: [], block: [])
>> Type
>> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@c5495e (element:
>> [xs:simpleType: null]) (name: string, targetNamespace:
>> http://www.w3.org/2001/XMLSchema) (variety: atomic, final: [],
>> lexicalFinal: null, validFacets: [length, minLength, maxLength,
>> pattern, enumeration, whiteSpace])
>> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
>> [xsd:element: null]) (name: p, targetNamespace:
>> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
>> form: qualified, lexicalValue: null) (nillable: <unset>,
>> disallowedSubstitutions: [], substitutionGroupExclusions: [],
>> abstract: <unset>, lexicalFinal: [], block: [])
>> Type
>> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element:
>> null) (name: inlinefac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (variety: atomic, final: null,
>> lexicalFinal: null, validFacets: null)
>> ----------------------> types found
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@297ffb (element:
>> [xsd:complexType: null]) (name: blocchi, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@914f6a (element:
>> [xsd:complexType: null]) (name: blocchifac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f4cbee (element:
>> [xsd:complexType: null]) (name: blocchireq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@787d6a (element:
>> [xsd:complexType: null]) (name: empty, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@71dc3d (element:
>> [xsd:complexType: null]) (name: emptyfac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1326484 (element:
>> [xsd:complexType: null]) (name: emptyreq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16546ef (element:
>> [xsd:complexType: null]) (name: inline, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
>> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@18a49e0 (element:
>> [xsd:complexType: null]) (name: inlinereq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f82982 (element:
>> [xsd:complexType: null]) (name: ParaLevel, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16d2633 (element:
>> [xsd:complexType: null]) (name: ParaLevelReq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@e70e30 (element:
>> [xsd:complexType: null]) (name: valore, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> loaded schema
>> TARGET NAMESPACE: http://www.normeinrete.it/nir/2.2/
>> ********** AUTOMA simple DI Legge ************
>> Component: - [0, -1]
>> State: 0 *
>> ********** AUTOMA simple DI h:p ************
>> Component: - [0, -1]
>> State: 0 *
>> Creating Rules DONE
>>
>


--------------080007070100000700030604
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tommaso,<br>
<br>
Sorry for misspelling your name.
Re: import resolution and namespaces [message #602397 is a reply to message #72435] Tue, 19 June 2007 18:54 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Tommaso,

Imports are resolved on demand, i.e., when a name from that namespace
needs to be resolved, so if there isn't such a need, it won't be
resolved. This type of approach would force the resolution:

for (Object content : xsdSchema.getContents())
{
if (content instanceof XSDImport)
{
XSDImport xsdImport = (XSDImport)content;
xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
}
}


Tommaso wrote:
> hi,
> we are having problems in the resolution of imported schemas.
>
> I enclose here an ultrasimplified version of the schema we are dealing
> with.
> nirstrict.xsd:
> _________________________________________________
>
> <xsd:schema xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> targetNamespace="http://www.normeinrete.it/nir/2.2/"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
>
> <!--<xsd:group name="elblocchi">
> <xsd:choice>
> <xsd:element ref="h:div"/>
> <xsd:element ref="h:p"/>
> <xsd:element ref="h:img"/>
> <xsd:element ref="h:table"/>
> </xsd:choice>
> </xsd:group>-->
>
> <xsd:element name="Legge" type="xsd:string" />
>
>
> </xsd:schema>
>
> _____________________________________________________
>
> h.xsd :
>
> <xsd:schema targetNamespace="http://www.w3.org/HTML/1998/html4"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:import namespace="http://www.normeinrete.it/nir/2.2/"
> schemaLocation="./nirstrict.xsd"/>
>
> <xsd:element name="p" type="xsd:string" />
>
> </xsd:schema>
>
> _____________________________________________________
>
>
>
> The problem is in the resolution of the imported schema h.xsd from the
> main schema nirstrict.xsd
>
>
> The code we are using is the following
>
>
>
> /**
> * * @param schemaURL
> * @return
> * @throws Exception
> */
> public static XSDSchema loadSchemaUsingResourceSet(String
> schemaURL) throws Exception{
>
> System.out.println("--> Loading Schema Using Resource
> Set @ url "+schemaURL);
>
> XSDResourceFactoryImpl resourceFactory = new
> XSDResourceFactoryImpl();
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",resourceFactory);
>
>
>
> //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// ////////////////////
>
> //
> // prende il path assoluto di schemaURL
> //
> File file = new File(schemaURL);
> if (file.isFile())
> schemaURL =
> URI.createFileURI(file.getCanonicalFile().toString()).toStri ng();
>
> // Create a resource set and load the main schema file into it.
> ResourceSet resourceSet = new ResourceSetImpl();
>
> //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./xlink.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/xlink.xsd "));//,URI.createURI("./xlink.xsd"));
>
> //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./h.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));//,URI.createURI("./h.xsd"));
>
> //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./dsp.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/dsp.xsd "));//,URI.createURI("./dsp.xsd"));
>
> //
>
> System.err.println("URIMAP:
> " +resourceSet.getURIConverter().getURIMap().entrySet().toStri ng());
>
>
>
> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
> Boolean.TRUE);
>
>
> XSDResourceImpl xsdSchemaResource = null;
> try
> {
> xsdSchemaResource =
> (XSDResourceImpl)resourceSet.getResource(URI.createURI(schem aURL),true);
> }
> catch(Exception e)
> {
> System.err.println("Exception caught in method 'load
> schema using ResourceSet' message = " + e.getMessage() + "
> xsdSchemaResource: " +
> xsdSchemaResource);
> }
>
> Resource resource = (Resource)xsdSchemaResource;
> if (resource instanceof XSDResourceImpl)
> {
> XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
> // Iterate over the schema's content's looking for
> directives.
> XSDSchema xsdSchema = xsdResource.getSchema();
> for (Iterator contents =
> xsdSchema.getContents().iterator(); contents.hasNext(); )
> {
> XSDSchemaContent xsdSchemaContent =
> (XSDSchemaContent)contents.next();
> if (xsdSchemaContent instanceof XSDSchemaDirective)
> { XSDSchemaDirective
> xsdSchemaDirective = (XSDSchemaDirective)xsdSchemaContent;
> if (xsdSchemaDirective.getResolvedSchema() == null){
>
> System.err.println("Unresolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
>
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println(" IMPORT:
> namespace --> "+xsdSchemaImport.getNamespace());
> System.err.println(" IMPORT:
> location --> "+xsdSchemaImport.getSchemaLocation());
> }
> } else {
> System.err.println("Resolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println("
> IMPORT: namespace --> "+xsdSchemaImport.getNamespace());
> System.err.println("
> IMPORT: location --> "+xsdSchemaImport.getSchemaLocation());
> }
> } }
> }
> return xsdResource.getSchema();
> }
> System.err.println("loadSchemaUsingResourceSet(" + schemaURL +
> ") did not contain any schemas!");
> return null;
> }
>
>
>
>
> What we noticed is that if elements of the imported xsd are referred
> in the main schema like here:
>
> <xsd:group name="elblocchi">
> <xsd:choice>
> <xsd:element ref="h:div"/>
> <xsd:element ref="h:p"/>
> <xsd:element ref="h:img"/>
> <xsd:element ref="h:table"/>
> </xsd:choice>
> </xsd:group>
>
>
>
> i.e. commenting out such block in nirstrict.xsd,
>
> the import is resolved otherwise it is not.
>
> see here the results in the two cases:
>
> with references to h: elements
>
> *****************
> Resolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_2/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> loaded schema
> *****************
>
> or without
> *****************
> Unresolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_2/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> *****************
>
>
>
> In the actual schemas we are using we have two different version, a
> light and a strict version. The light version which refers imported
> elements in the main schema is correctly resolved, in the strict,
> where the imported elements are referred from other included xsd files
> and not in the main one, the import resolution does not succeed.
> Do you have any hint on what could be the reason? Do we need to
> perform a recursive import resolution ove all the resources in the
> resourceSet ?
> Notice that all works in cases of include instead of import.
>
>
> We also tried various URI Mapping like
>
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./h.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));
>
>
> or
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.w3.org/HTML/1998/html4/"),URI.createURI("./h.xsd"));
>
>
> but none solves the problem. Which is the correct URI mapping for a
> case like our:
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
>
>
> Notice that, in the for cycle over the resources of the resourceSet,
> the imported resources correctly inherit the absolute path from the
> main resource.
> In case you need the complete schema we are using I can send it.
> Running xsdMainExample load and validate on it gives the same
> Unresolved import problems.
>
>
>
> Any help is greatly appreciated,
>
> thanks in advance
>
> Tommaso
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: import resolution and namespaces [message #602403 is a reply to message #72456] Wed, 20 June 2007 17:27 Go to previous message
Tommaso is currently offline TommasoFriend
Messages: 6
Registered: July 2009
Junior Member
it works,
imports are now correctly resolved. However we are still experiencing some
odd behaviour which I presume is due to the policy described in the
documentation

"An unresolved instance is synthesized to hold the namespace and name if
an existing instance cannot be found"


Our aim is to extract ElementDeclaration and TypeDefinition from the main
schema to build related automata.

For example here we look for the definition of element "p" defined in
h.xsd of complex type "inlinefac" defined in globali.xsd

Running the same code of my previous post with the addition of your code

for (Object content : xsdSchema.getContents())
{
if (content instanceof XSDImport)
{
XSDImport xsdImport = (XSDImport)content;
xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
}
}



1) for nirstrict.xsd [main schema file]


Resolved schema ./h.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
IMPORT: location --> ./h.xsd
Resolved schema ./globali.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd

ELEMENT from xsdResource.getSchema().getElementDeclarations();

org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
[xsd:element: null]) (name: p, targetNamespace:
http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element: null)
(name: inlinefac, targetNamespace: http://www.normeinrete.it/nir/2.2/)
(variety: atomic, final: null, lexicalFinal: null, validFacets: null)

TYPE from xsdResource.getSchema().getTypeDefinitions();

org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)


i.e. the element p is of simpleType inlinefac while inlinefac is
actually a complexType



2) for h.xsd [imported schema file]

Resolved schema ./nirstrict.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/h.xsd
IMPORT: namespace --> http://www.normeinrete.it/nir/2.2/
IMPORT: location --> ./nirstrict.xsd

ELEMENT from xsdResource.getSchema().getElementDeclarations();

org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
[xsd:element: null]) (name: p, targetNamespace:
http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)

TYPE from xsdResource.getSchema().getTypeDefinitions();

org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)

i.e. correct result p is of complexType inlinefac which is actually a
complexType


I assume that for some reason in the 1st case the forced
resolveTypeDefinition() gets the empty default value which does not
correspond to the correct one.

How can we get the correct existing instance of the ComplexType starting
from the main schema ?
Do we have to specify localName different from the empty string in

xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");

, or call other methods like

resolveAttributeDeclaration()
resolveAttributeGroupDefinition() and so on ?



These are the xsd example

_____________________

nirstrict.xsd
_____________________

<xsd:schema
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:h="http://www.w3.org/HTML/1998/html4"
targetNamespace="http://www.normeinrete.it/nir/2.2/"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

<xsd:import namespace="http://www.w3.org/HTML/1998/html4"
schemaLocation="./h.xsd"/>
<xsd:include schemaLocation="./globali.xsd"/>

<xsd:element name="Legge" type="xsd:string" />


</xsd:schema>

_______________

h.xsd
_______________


<xsd:schema targetNamespace="http://www.w3.org/HTML/1998/html4"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:h="http://www.w3.org/HTML/1998/html4" elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:import namespace="http://www.normeinrete.it/nir/2.2/"
schemaLocation="./nirstrict.xsd"/>

<xsd:element name="p" type="inlinefac" />

</xsd:schema>


_______________

globali.xsd
_______________


<xsd:schema
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:h="http://www.w3.org/HTML/1998/html4"
targetNamespace="http://www.normeinrete.it/nir/2.2/"
xmlns="http://www.normeinrete.it/nir/2.2/"
xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

<xsd:import namespace="http://www.w3.org/HTML/1998/html4"
schemaLocation="./h.xsd"/>

<xsd:attributeGroup name="link">
<xsd:attribute ref="xlink:type" />
<xsd:attribute ref="xlink:href" />
</xsd:attributeGroup>

<xsd:attributeGroup name="nome">
<xsd:attribute name="nome" type="NIRnome" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="nomefac">
<xsd:attribute name="nome" type="NIRnome"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="tempi">
<xsd:attribute name="iniziovigore" type="uri"/>
<xsd:attribute name="finevigore" type="uri"/>
<xsd:attribute name="inizioefficacia" type="uri"/>
<xsd:attribute name="fineefficacia" type="uri"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="vigenza">
<xsd:attributeGroup ref="tempi"/>
<xsd:attribute name="rel" type="uri"/>
<xsd:attribute name="status" type="status"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="implicita">
<xsd:attribute name="implicita" type="sino" default="no" />
</xsd:attributeGroup>

<xsd:attributeGroup name="css">
<xsd:attribute ref="h:style" />
<xsd:attribute ref="h:class" />
<xsd:attribute ref="h:title" />
</xsd:attributeGroup>

<xsd:attributeGroup name="idreq">
<xsd:attribute name="id" type="id" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="idfac">
<xsd:attribute name="id" type="id"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="idnorma">
<xsd:attribute name="id" type="anytoken"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="globalireq">
<xsd:attributeGroup ref="css"/>
<xsd:attributeGroup ref="idreq"/>
<xsd:attributeGroup ref="vigenza"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="globalifac">
<xsd:attributeGroup ref="css"/>
<xsd:attributeGroup ref="idfac"/>
<xsd:attributeGroup ref="vigenza"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="globalinorma">
<xsd:attributeGroup ref="css"/>
<xsd:attributeGroup ref="idnorma"/>
<xsd:attributeGroup ref="vigenza"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="data">
<xsd:attribute name="norm" type="NIRdate" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="dove">
<xsd:attribute name="codice" type="NIRdove" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="codice">
<xsd:attribute name="codice" type="NIRcodice" use="required"/>
</xsd:attributeGroup>

<xsd:attributeGroup name="val">
<xsd:attribute name="valore" type="anystring" use="required"/>
</xsd:attributeGroup>

<xsd:annotation>
<xsd:documentation>
============================================================ =========

Entita': content model comuni ai vari tipi di elementi

============================================================ =========
</xsd:documentation>
</xsd:annotation>

<xsd:group name="liste">
<xsd:choice>
<xsd:element ref="h:ul"/>
<xsd:element ref="h:ol"/>
<xsd:element ref="h:dl"/>
</xsd:choice>
</xsd:group>

<xsd:group name="genvuoti">
<xsd:choice>
<xsd:element ref="vuoto"/>
<xsd:element ref="ndr"/>
</xsd:choice>
</xsd:group>

<xsd:group name="geninline">
<xsd:sequence>
<xsd:element ref="inlinea"/>
</xsd:sequence>
</xsd:group>

<xsd:group name="genblocchi">
<xsd:sequence>
<xsd:element ref="blocco"/>
</xsd:sequence>
</xsd:group>

<xsd:group name="genstruct">
<xsd:choice>
<xsd:element ref="contenitore"/>
<xsd:element ref="gerarchia"/>
<xsd:element ref="articolato"/>
</xsd:choice>
</xsd:group>

<xsd:group name="txtvuoti">
<xsd:choice>
<xsd:element ref="h:br"/>
<xsd:element ref="h:hr"/>
<xsd:element ref="h:img"/>
</xsd:choice>
</xsd:group>

<xsd:group name="txtinline">
<xsd:choice>
<xsd:element ref="h:span"/>
<xsd:element ref="h:i"/>
<xsd:element ref="h:u"/>
<xsd:element ref="h:b"/>
<xsd:element ref="h:sup"/>
<xsd:element ref="h:sub"/>
<xsd:element ref="h:a"/>
</xsd:choice>
</xsd:group>

<xsd:group name="txtblocchi">
<xsd:choice>
<xsd:element ref="h:div"/>
<xsd:element ref="h:p"/>
<xsd:element ref="h:form"/>
<xsd:element ref="h:table"/>
<xsd:element ref="h:object"/>
<xsd:group ref="liste" />
</xsd:choice>
</xsd:group>

<xsd:group name="nrminline">
<xsd:choice>
<xsd:element ref="rif"/>
<xsd:element ref="irif"/>
<xsd:element ref="mrif"/>
<xsd:element ref="mod"/>
<xsd:element ref="def"/>
<xsd:element ref="atto"/>
<xsd:element ref="soggetto"/>
<xsd:element ref="luogo"/>
<xsd:element ref="ente"/>
<xsd:element ref="data"/>
<xsd:element ref="importo"/>
</xsd:choice>
</xsd:group>

<xsd:group name="nrmstruct">
<xsd:choice>
<xsd:element ref="intestazione"/>
<xsd:element ref="formulainiziale"/>
<xsd:element ref="preambolo"/>
<xsd:element ref="formulafinale"/>
<xsd:element ref="conclusione"/>
<xsd:element ref="annessi"/>
</xsd:choice>
</xsd:group>

<xsd:group name="allvuoti">
<xsd:choice>
<xsd:group ref="genvuoti" />
<xsd:group ref="txtvuoti" />
</xsd:choice>
</xsd:group>

<xsd:group name="allinline">
<xsd:choice>
<xsd:group ref="geninline" />
<xsd:group ref="txtinline" />
<xsd:group ref="nrminline" />
</xsd:choice>
</xsd:group>

<xsd:group name="allblocchi">
<xsd:choice>
<xsd:group ref="genblocchi" />
<xsd:group ref="txtblocchi" />
</xsd:choice>
</xsd:group>

<xsd:group name="allstruct">
<xsd:choice>
<xsd:group ref="genstruct" />
<xsd:group ref="nrmstruct" />
</xsd:choice>
</xsd:group>

<xsd:group name="elinline">
<xsd:choice>
<xsd:group ref="allinline" />
<xsd:group ref="allvuoti" />
</xsd:choice>
</xsd:group>

<xsd:group name="strutture">
<xsd:sequence>
<xsd:group ref="allstruct" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:group>


<xsd:complexType name="inline" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
<xsd:group ref="elinline" />
</xsd:choice>
</xsd:complexType>

<xsd:complexType name="blocchi" >
<xsd:sequence minOccurs="1" maxOccurs="unbounded" >
<xsd:group ref="allblocchi" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ParaLevel" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
<xsd:group ref="elinline" />
<xsd:group ref="allblocchi" />
</xsd:choice>
<xsd:attributeGroup ref="globalifac"/>
</xsd:complexType>

<xsd:complexType name="ParaLevelReq" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded" >
<xsd:group ref="elinline" />
<xsd:group ref="allblocchi" />
</xsd:choice>
<xsd:attributeGroup ref="globalireq"/>
</xsd:complexType>

<xsd:complexType name="valore" >
<xsd:attributeGroup ref="val"/>
</xsd:complexType>

<xsd:complexType name="empty" >
</xsd:complexType>

<xsd:complexType name="emptyfac" >
<xsd:attributeGroup ref="globalifac"/>
</xsd:complexType>

<xsd:complexType name="emptyreq" >
<xsd:attributeGroup ref="globalireq"/>
</xsd:complexType>


<xsd:complexType name="inlinefac" mixed="true">
<xsd:complexContent>
<xsd:extension base="inline">
<xsd:attributeGroup ref="globalifac"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>


<xsd:complexType name="inlinereq" mixed="true">
<xsd:complexContent>
<xsd:extension base="inline">
<xsd:attributeGroup ref="globalireq"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="blocchireq" >
<xsd:complexContent>
<xsd:extension base="blocchi">
<xsd:attributeGroup ref="globalireq"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="blocchifac" >
<xsd:complexContent>
<xsd:extension base="blocchi">
<xsd:attributeGroup ref="globalifac"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
Re: import resolution and namespaces [message #602411 is a reply to message #72477] Wed, 20 June 2007 21:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000502040701020001030200
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Tommaso,

What URI are you using to load the document? The reference resolves
fine for me when I load it in the editor like this:




Tommaso wrote:
> it works,
> imports are now correctly resolved. However we are still experiencing
> some odd behaviour which I presume is due to the policy described in
> the documentation
>
> "An unresolved instance is synthesized to hold the namespace and name
> if an existing instance cannot be found"
>
>
> Our aim is to extract ElementDeclaration and TypeDefinition from the
> main schema to build related automata.
>
> For example here we look for the definition of element "p" defined in
> h.xsd of complex type "inlinefac" defined in globali.xsd
>
> Running the same code of my previous post with the addition of your code
>
> for (Object content : xsdSchema.getContents())
> {
> if (content instanceof XSDImport)
> {
> XSDImport xsdImport = (XSDImport)content;
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
> }
> }
>
>
>
> 1) for nirstrict.xsd [main schema file]
>
>
> Resolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> Resolved schema ./globali.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
>
> ELEMENT from xsdResource.getSchema().getElementDeclarations();
>
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
> [xsd:element: null]) (name: p, targetNamespace:
> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element:
> null) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (variety: atomic, final: null,
> lexicalFinal: null, validFacets: null)
>
> TYPE from xsdResource.getSchema().getTypeDefinitions();
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
>
>
> i.e. the element p is of simpleType inlinefac while inlinefac is
> actually a complexType
>
>
> 2) for h.xsd [imported schema file]
>
> Resolved schema ./nirstrict.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/h.xsd
> IMPORT: namespace --> http://www.normeinrete.it/nir/2.2/
> IMPORT: location --> ./nirstrict.xsd
>
> ELEMENT from xsdResource.getSchema().getElementDeclarations();
>
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
> [xsd:element: null]) (name: p, targetNamespace:
> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
>
> TYPE from xsdResource.getSchema().getTypeDefinitions();
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@19a32e0 (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
>
> i.e. correct result p is of complexType inlinefac which is actually
> a complexType
>
>
> I assume that for some reason in the 1st case the forced
> resolveTypeDefinition() gets the empty default value which does not
> correspond to the correct one.
>
> How can we get the correct existing instance of the ComplexType
> starting from the main schema ?
> Do we have to specify localName different from the empty string in
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>
> , or call other methods like
>
> resolveAttributeDeclaration()
> resolveAttributeGroupDefinition() and so on ?
>
>
>
> These are the xsd example
>
> _____________________
>
> nirstrict.xsd
> _____________________
>
> <xsd:schema xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> targetNamespace="http://www.normeinrete.it/nir/2.2/"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
> <xsd:include schemaLocation="./globali.xsd"/>
>
> <xsd:element name="Legge" type="xsd:string" />
>
>
> </xsd:schema>
>
> _______________
>
> h.xsd
> _______________
>
>
> <xsd:schema targetNamespace="http://www.w3.org/HTML/1998/html4"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:import namespace="http://www.normeinrete.it/nir/2.2/"
> schemaLocation="./nirstrict.xsd"/>
>
> <xsd:element name="p" type="inlinefac" />
>
> </xsd:schema>
>
>
> _______________
>
> globali.xsd
> _______________
>
>
> <xsd:schema xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:h="http://www.w3.org/HTML/1998/html4"
> targetNamespace="http://www.normeinrete.it/nir/2.2/"
> xmlns="http://www.normeinrete.it/nir/2.2/"
> xmlns:dsp="http://www.normeinrete.it/nir/disposizioni/2.2/"
> elementFormDefault="qualified"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>
> <xsd:import namespace="http://www.w3.org/HTML/1998/html4"
> schemaLocation="./h.xsd"/>
>
> <xsd:attributeGroup name="link">
> <xsd:attribute ref="xlink:type" />
> <xsd:attribute ref="xlink:href" />
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="nome">
> <xsd:attribute name="nome" type="NIRnome" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="nomefac">
> <xsd:attribute name="nome" type="NIRnome"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="tempi">
> <xsd:attribute name="iniziovigore" type="uri"/>
> <xsd:attribute name="finevigore" type="uri"/>
> <xsd:attribute name="inizioefficacia" type="uri"/>
> <xsd:attribute name="fineefficacia" type="uri"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="vigenza">
> <xsd:attributeGroup ref="tempi"/>
> <xsd:attribute name="rel" type="uri"/>
> <xsd:attribute name="status" type="status"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="implicita">
> <xsd:attribute name="implicita" type="sino" default="no" />
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="css">
> <xsd:attribute ref="h:style" />
> <xsd:attribute ref="h:class" />
> <xsd:attribute ref="h:title" />
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="idreq">
> <xsd:attribute name="id" type="id" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="idfac">
> <xsd:attribute name="id" type="id"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="idnorma">
> <xsd:attribute name="id" type="anytoken"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="globalireq">
> <xsd:attributeGroup ref="css"/>
> <xsd:attributeGroup ref="idreq"/>
> <xsd:attributeGroup ref="vigenza"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="globalifac">
> <xsd:attributeGroup ref="css"/>
> <xsd:attributeGroup ref="idfac"/>
> <xsd:attributeGroup ref="vigenza"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="globalinorma">
> <xsd:attributeGroup ref="css"/>
> <xsd:attributeGroup ref="idnorma"/>
> <xsd:attributeGroup ref="vigenza"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="data">
> <xsd:attribute name="norm" type="NIRdate" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="dove">
> <xsd:attribute name="codice" type="NIRdove" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="codice">
> <xsd:attribute name="codice" type="NIRcodice" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:attributeGroup name="val">
> <xsd:attribute name="valore" type="anystring" use="required"/>
> </xsd:attributeGroup>
>
> <xsd:annotation>
> <xsd:documentation>
>
> ============================================================ =========
>
> Entita': content model comuni ai vari tipi di elementi
>
>
> ============================================================ =========
> </xsd:documentation>
> </xsd:annotation>
>
> <xsd:group name="liste">
> <xsd:choice>
> <xsd:element ref="h:ul"/>
> <xsd:element ref="h:ol"/>
> <xsd:element ref="h:dl"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="genvuoti">
> <xsd:choice>
> <xsd:element ref="vuoto"/>
> <xsd:element ref="ndr"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="geninline">
> <xsd:sequence>
> <xsd:element ref="inlinea"/>
> </xsd:sequence>
> </xsd:group>
>
> <xsd:group name="genblocchi">
> <xsd:sequence>
> <xsd:element ref="blocco"/>
> </xsd:sequence>
> </xsd:group>
>
> <xsd:group name="genstruct">
> <xsd:choice>
> <xsd:element ref="contenitore"/>
> <xsd:element ref="gerarchia"/>
> <xsd:element ref="articolato"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="txtvuoti">
> <xsd:choice>
> <xsd:element ref="h:br"/>
> <xsd:element ref="h:hr"/>
> <xsd:element ref="h:img"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="txtinline">
> <xsd:choice>
> <xsd:element ref="h:span"/>
> <xsd:element ref="h:i"/>
> <xsd:element ref="h:u"/>
> <xsd:element ref="h:b"/>
> <xsd:element ref="h:sup"/>
> <xsd:element ref="h:sub"/>
> <xsd:element ref="h:a"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="txtblocchi">
> <xsd:choice>
> <xsd:element ref="h:div"/>
> <xsd:element ref="h:p"/>
> <xsd:element ref="h:form"/>
> <xsd:element ref="h:table"/>
> <xsd:element ref="h:object"/>
> <xsd:group ref="liste" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="nrminline">
> <xsd:choice>
> <xsd:element ref="rif"/>
> <xsd:element ref="irif"/>
> <xsd:element ref="mrif"/>
> <xsd:element ref="mod"/>
> <xsd:element ref="def"/>
> <xsd:element ref="atto"/>
> <xsd:element ref="soggetto"/>
> <xsd:element ref="luogo"/>
> <xsd:element ref="ente"/>
> <xsd:element ref="data"/>
> <xsd:element ref="importo"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="nrmstruct">
> <xsd:choice>
> <xsd:element ref="intestazione"/>
> <xsd:element ref="formulainiziale"/>
> <xsd:element ref="preambolo"/>
> <xsd:element ref="formulafinale"/>
> <xsd:element ref="conclusione"/>
> <xsd:element ref="annessi"/>
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allvuoti">
> <xsd:choice>
> <xsd:group ref="genvuoti" />
> <xsd:group ref="txtvuoti" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allinline">
> <xsd:choice>
> <xsd:group ref="geninline" />
> <xsd:group ref="txtinline" />
> <xsd:group ref="nrminline" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allblocchi">
> <xsd:choice>
> <xsd:group ref="genblocchi" />
> <xsd:group ref="txtblocchi" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="allstruct">
> <xsd:choice>
> <xsd:group ref="genstruct" />
> <xsd:group ref="nrmstruct" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="elinline">
> <xsd:choice>
> <xsd:group ref="allinline" />
> <xsd:group ref="allvuoti" />
> </xsd:choice>
> </xsd:group>
>
> <xsd:group name="strutture">
> <xsd:sequence>
> <xsd:group ref="allstruct" minOccurs="1"
> maxOccurs="unbounded" />
> </xsd:sequence>
> </xsd:group>
>
>
> <xsd:complexType name="inline" mixed="true">
> <xsd:choice minOccurs="0" maxOccurs="unbounded" >
> <xsd:group ref="elinline" />
> </xsd:choice>
> </xsd:complexType>
>
> <xsd:complexType name="blocchi" >
> <xsd:sequence minOccurs="1" maxOccurs="unbounded" >
> <xsd:group ref="allblocchi" />
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="ParaLevel" mixed="true">
> <xsd:choice minOccurs="0" maxOccurs="unbounded" >
> <xsd:group ref="elinline" />
> <xsd:group ref="allblocchi" />
> </xsd:choice>
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:complexType>
>
> <xsd:complexType name="ParaLevelReq" mixed="true">
> <xsd:choice minOccurs="0" maxOccurs="unbounded" >
> <xsd:group ref="elinline" />
> <xsd:group ref="allblocchi" />
> </xsd:choice>
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:complexType>
>
> <xsd:complexType name="valore" >
> <xsd:attributeGroup ref="val"/>
> </xsd:complexType>
>
> <xsd:complexType name="empty" >
> </xsd:complexType>
>
> <xsd:complexType name="emptyfac" >
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:complexType>
>
> <xsd:complexType name="emptyreq" >
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:complexType>
>
>
> <xsd:complexType name="inlinefac" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="inline">
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
>
> <xsd:complexType name="inlinereq" mixed="true">
> <xsd:complexContent>
> <xsd:extension base="inline">
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="blocchireq" >
> <xsd:complexContent>
> <xsd:extension base="blocchi">
> <xsd:attributeGroup ref="globalireq"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="blocchifac" >
> <xsd:complexContent>
> <xsd:extension base="blocchi">
> <xsd:attributeGroup ref="globalifac"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> </xsd:schema>
>
>
>
>
>
>
>
>


--------------000502040701020001030200
Content-Type: multipart/related;
boundary="------------060208010200000509080808"


--------------060208010200000509080808
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Tommaso,<br>
<br>
What URI are you using to load the document?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: import resolution and namespaces [message #602417 is a reply to message #72505] Wed, 20 June 2007 22:11 Go to previous message
Tommaso is currently offline TommasoFriend
Messages: 6
Registered: July 2009
Junior Member
Yes, the editor loads and resolves correctly the schema. But we are using
the org.eclipse.xsd library (version 2.2.3 to keep compatibility with java
1.4) as standalone in order to create and query the automata of schema
elements for validation. The code with which we load the xsd is the
following:

where schemaUrl is the location of the main schema nirstrict.xsd or,
alternatively, of the imported schema h.xsd in case 1 and 2 of previous
post


/**
* * @param schemaURL
* @return
* @throws Exception
*/
public static XSDSchema loadSchemaUsingResourceSet(String schemaURL)
throws Exception{

System.out.println("--> Loading Schema Using Resource Set @ url "+schemaURL);

XSDResourceFactoryImpl resourceFactory = new XSDResourceFactoryImpl();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",resourceFactory);

//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// ////////////////////
//
// absolute Path of schemaURL
//
File file = new File(schemaURL);
if (file.isFile())
schemaURL =
URI.createFileURI(file.getCanonicalFile().toString()).toStri ng();

// Create a resource set and load the main schema file into it.
ResourceSet resourceSet = new ResourceSetImpl();
//
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./xlink.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/xlink.xsd "));//,URI.createURI("./xlink.xsd"));
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.w3.org/HTML/1998/html4/"),URI.createURI("./h.xsd"));//,URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));//,URI.createURI("./h.xsd"));

//resourceSet.getURIConverter().getURIMap().put(URI.createUR I( "./dsp.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/dsp.xsd "));//,URI.createURI("./dsp.xsd"));

System.err.println("URIMAP:
" +resourceSet.getURIConverter().getURIMap().entrySet().toStri ng());
resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
Boolean.TRUE);


XSDResourceImpl xsdSchemaResource = null;
try
{
xsdSchemaResource =
(XSDResourceImpl)resourceSet.getResource(URI.createURI(schem aURL),true);
}
catch(Exception e)
{
System.err.println("Exception caught in method 'load schema using
ResourceSet' message = " + e.getMessage() + " xsdSchemaResource: " +
xsdSchemaResource);
}


Resource resource = (Resource)xsdSchemaResource;
if (resource instanceof XSDResourceImpl)
{
XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
// Iterate over the schema's content's looking for directives.
XSDSchema xsdSchema = xsdResource.getSchema();



for (Iterator contents = xsdSchema.getContents().iterator();
contents.hasNext(); ){

XSDSchemaContent xsdSchemaContent = (XSDSchemaContent)contents.next();

if (xsdSchemaContent instanceof XSDImport)
{
XSDImport xsdImport = (XSDImport)xsdSchemaContent;

xsdImport.resolveModelGroupDefinition(xsdImport.getNamespace (), "");

xsdImport.resolveElementDeclaration(xsdImport.getNamespace() , "");

xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");

xsdImport.resolveComplexTypeDefinition(xsdImport.getNamespac e(), "");
}


if (xsdSchemaContent instanceof XSDSchemaDirective){
XSDSchemaDirective xsdSchemaDirective =
(XSDSchemaDirective)xsdSchemaContent;
if (xsdSchemaDirective.getResolvedSchema() == null){
System.err.println("Unresolved schema "+
xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());

if(xsdSchemaDirective instanceof XSDImport){
XSDImport xsdSchemaImport = (XSDImport)xsdSchemaDirective;
System.err.println(" IMPORT: namespace -->
"+xsdSchemaImport.getNamespace());
System.err.println(" IMPORT: location -->
"+xsdSchemaImport.getSchemaLocation());
}
}
else{
System.err.println("Resolved schema "+
xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
if(xsdSchemaDirective instanceof XSDImport){
XSDImport xsdSchemaImport = (XSDImport)xsdSchemaDirective;
System.err.println(" IMPORT: namespace -->
"+xsdSchemaImport.getNamespace());
System.err.println(" IMPORT: location -->
"+xsdSchemaImport.getSchemaLocation());
}
}
}
}



List allElements = xsdResource.getSchema().getElementDeclarations();
System.err.println("----------------------> elements found");
for(Iterator ite = allElements.iterator(); ite.hasNext();){
Object ob = ite.next();
System.err.println(ob.toString());
System.err.println(" Type
"+((XSDElementDeclaration)ob).getType().toString());
}

List allTypes = xsdResource.getSchema().getTypeDefinitions();
System.err.println("----------------------> types found");
for(Iterator ite = allTypes.iterator(); ite.hasNext();){
System.err.println(ite.next().toString());
}

return xsdResource.getSchema();
}
System.err.println("loadSchemaUsingResourceSet(" + schemaURL + ") did
not contain any schemas!");
return null;
}
Re: import resolution and namespaces [message #602424 is a reply to message #72521] Wed, 20 June 2007 22:17 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Tommaso,

There should be no need for URI mappings to make this work (assuming
files are really in the correct relative locations, i.e, all in the same
folder). What's the actual value of schemaURL at the point when you
call getResource?


Tommaso wrote:
> Yes, the editor loads and resolves correctly the schema. But we are
> using the org.eclipse.xsd library (version 2.2.3 to keep compatibility
> with java 1.4) as standalone in order to create and query the automata
> of schema elements for validation. The code with which we load the xsd
> is the following:
>
> where schemaUrl is the location of the main schema nirstrict.xsd or,
> alternatively, of the imported schema h.xsd in case 1 and 2 of
> previous post
>
>
> /**
> * * @param schemaURL
> * @return
> * @throws Exception
> */
> public static XSDSchema loadSchemaUsingResourceSet(String
> schemaURL) throws Exception{
>
> System.out.println("--> Loading Schema Using Resource Set @
> url "+schemaURL);
>
> XSDResourceFactoryImpl resourceFactory = new
> XSDResourceFactoryImpl();
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",resourceFactory);
>
>
>
> //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// ////////////////////
>
> //
> // absolute Path of schemaURL
> //
> File file = new File(schemaURL);
> if (file.isFile())
> schemaURL =
> URI.createFileURI(file.getCanonicalFile().toString()).toStri ng();
>
> // Create a resource set and load the main schema file into it.
> ResourceSet resourceSet = new ResourceSetImpl(); //
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "./xlink.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/xlink.xsd "));//,URI.createURI("./xlink.xsd"));
>
>
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.w3.org/HTML/1998/html4/"),URI.createURI("./h.xsd"));//,URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/h.xsd "));//,URI.createURI("./h.xsd"));
>
>
> //resourceSet.getURIConverter().getURIMap().put(URI.createUR I( "./dsp.xsd"),URI.createURI(" file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/NIR _XSD_completo/dsp.xsd "));//,URI.createURI("./dsp.xsd"));
>
>
> System.err.println("URIMAP:
> " +resourceSet.getURIConverter().getURIMap().entrySet().toStri ng());
>
> resourceSet.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_L OCATION,
> Boolean.TRUE);
>
>
> XSDResourceImpl xsdSchemaResource = null;
> try
> {
> xsdSchemaResource =
> (XSDResourceImpl)resourceSet.getResource(URI.createURI(schem aURL),true);
> }
> catch(Exception e)
> {
> System.err.println("Exception caught in method 'load
> schema using ResourceSet' message = " + e.getMessage() + "
> xsdSchemaResource: " +
> xsdSchemaResource); }
>
>
> Resource resource = (Resource)xsdSchemaResource;
> if (resource instanceof XSDResourceImpl)
> {
> XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
> // Iterate over the schema's content's looking for
> directives.
> XSDSchema xsdSchema = xsdResource.getSchema();
>
>
>
> for (Iterator contents =
> xsdSchema.getContents().iterator(); contents.hasNext(); ){
>
> XSDSchemaContent xsdSchemaContent =
> (XSDSchemaContent)contents.next();
>
> if (xsdSchemaContent instanceof XSDImport)
> {
> XSDImport xsdImport = (XSDImport)xsdSchemaContent;
>
> xsdImport.resolveModelGroupDefinition(xsdImport.getNamespace (), "");
>
> xsdImport.resolveElementDeclaration(xsdImport.getNamespace() , "");
>
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>
> xsdImport.resolveComplexTypeDefinition(xsdImport.getNamespac e(), "");
> }
>
>
> if (xsdSchemaContent instanceof
> XSDSchemaDirective){
> XSDSchemaDirective xsdSchemaDirective =
> (XSDSchemaDirective)xsdSchemaContent;
> if (xsdSchemaDirective.getResolvedSchema() == null){
> System.err.println("Unresolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
>
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println(" IMPORT: namespace -->
> "+xsdSchemaImport.getNamespace());
> System.err.println(" IMPORT: location -->
> "+xsdSchemaImport.getSchemaLocation());
> }
> }
> else{
> System.err.println("Resolved schema "+
> xsdSchemaDirective.getSchemaLocation() +" in " + xsdResource.getURI());
> if(xsdSchemaDirective instanceof XSDImport){
> XSDImport xsdSchemaImport =
> (XSDImport)xsdSchemaDirective;
> System.err.println(" IMPORT: namespace -->
> "+xsdSchemaImport.getNamespace());
> System.err.println(" IMPORT: location -->
> "+xsdSchemaImport.getSchemaLocation());
> }
> } }
> }
>
>
>
> List allElements =
> xsdResource.getSchema().getElementDeclarations();
> System.err.println("----------------------> elements found");
> for(Iterator ite = allElements.iterator(); ite.hasNext();){
> Object ob = ite.next();
> System.err.println(ob.toString());
> System.err.println(" Type
> "+((XSDElementDeclaration)ob).getType().toString());
> }
> List allTypes =
> xsdResource.getSchema().getTypeDefinitions();
> System.err.println("----------------------> types found");
> for(Iterator ite = allTypes.iterator(); ite.hasNext();){
> System.err.println(ite.next().toString());
> }
>
> return xsdResource.getSchema();
> }
> System.err.println("loadSchemaUsingResourceSet(" + schemaURL +
> ") did not contain any schemas!");
> return null;
> }
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: import resolution and namespaces [message #602432 is a reply to message #72539] Wed, 20 June 2007 22:38 Go to previous message
Eclipse UserFriend
Originally posted by: t.agnoloni.gmail.com

Yes, adding or commenting the URI mapping does not have any effect as the
files are all in the same folder.

The value of the schemaURL when calling getResource is correctly set as
the absolute path of the xsd

file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd


The output follows; the problem here is that the element "p" of type
"inlinefac" turns out to be an XSDSympleType, while, listing
getTypeDefinitions(), "inlinefac" is actually a ComplexType.

The assignment of "p" as a SimpleType occurs when enforcing the import
resolution in

xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");

going inside this method with debugger shows that

XSDSchemaImpl.resolveTypeDefinition()

gives a null result and enforces

createUnresolvedTypeDefinition(namespace, localName);

which probably assumes an empty simpleType "inlinefac" with only name and
namespace set while the actual "inlinefac" type is complex.

How do I manage to associate "p" with its actual complexType ?



OUTPUT:
__________________________

URIMAP: [http://www.w3.org/HTML/1998/html4/->./h.xsd]
Resolved schema ./h.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
IMPORT: location --> ./h.xsd
Resolved schema ./globali.xsd in
file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
----------------------> elements found
org.eclipse.xsd.impl.XSDElementDeclarationImpl@113a53d (element:
[xsd:element: null]) (name: Legge, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@c5495e (element:
[xs:simpleType: null]) (name: string, targetNamespace:
http://www.w3.org/2001/XMLSchema) (variety: atomic, final: [],
lexicalFinal: null, validFacets: [length, minLength, maxLength, pattern,
enumeration, whiteSpace])
org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
[xsd:element: null]) (name: p, targetNamespace:
http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
form: qualified, lexicalValue: null) (nillable: <unset>,
disallowedSubstitutions: [], substitutionGroupExclusions: [], abstract:
<unset>, lexicalFinal: [], block: [])
Type
org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element: null)
(name: inlinefac, targetNamespace: http://www.normeinrete.it/nir/2.2/)
(variety: atomic, final: null, lexicalFinal: null, validFacets: null)
----------------------> types found
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@297ffb (element:
[xsd:complexType: null]) (name: blocchi, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: elementOnly,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
<unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@914f6a (element:
[xsd:complexType: null]) (name: blocchifac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: elementOnly,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
<unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f4cbee (element:
[xsd:complexType: null]) (name: blocchireq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: elementOnly,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
<unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@787d6a (element:
[xsd:complexType: null]) (name: empty, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@71dc3d (element:
[xsd:complexType: null]) (name: emptyfac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1326484 (element:
[xsd:complexType: null]) (name: emptyreq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16546ef (element:
[xsd:complexType: null]) (name: inline, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: mixed, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
[xsd:complexType: null]) (name: inlinefac, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@18a49e0 (element:
[xsd:complexType: null]) (name: inlinereq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension, final:
[], abstract: <unset>, contentTypeCategory: mixed,
prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f82982 (element:
[xsd:complexType: null]) (name: ParaLevel, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: mixed, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16d2633 (element:
[xsd:complexType: null]) (name: ParaLevelReq, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: mixed, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: true)
org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@e70e30 (element:
[xsd:complexType: null]) (name: valore, targetNamespace:
http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final: [],
abstract: <unset>, contentTypeCategory: empty, prohibitedSubstitutions:
[], lexicalFinal: null, block: null, mixed: <unset>)
loaded schema
TARGET NAMESPACE: http://www.normeinrete.it/nir/2.2/
********** AUTOMA simple DI Legge ************
Component: - [0, -1]
State: 0 *
********** AUTOMA simple DI h:p ************
Component: - [0, -1]
State: 0 *
Creating Rules DONE
Re: import resolution and namespaces [message #602438 is a reply to message #72557] Thu, 21 June 2007 02:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020207070201070405030301
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Tomamaso,

I think you are running into the problem fixed by 106098
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=106098> so it would be
good to try the latest 2.2.4 maintenance build.


tommaso wrote:
> Yes, adding or commenting the URI mapping does not have any effect as
> the files are all in the same folder.
>
> The value of the schemaURL when calling getResource is correctly set
> as the absolute path of the xsd
>
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
>
>
> The output follows; the problem here is that the element "p" of type
> "inlinefac" turns out to be an XSDSympleType, while, listing
> getTypeDefinitions(), "inlinefac" is actually a ComplexType.
> The assignment of "p" as a SimpleType occurs when enforcing the import
> resolution in
>
> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>
> going inside this method with debugger shows that
> XSDSchemaImpl.resolveTypeDefinition()
>
> gives a null result and enforces
>
> createUnresolvedTypeDefinition(namespace, localName);
>
> which probably assumes an empty simpleType "inlinefac" with only name
> and namespace set while the actual "inlinefac" type is complex.
>
> How do I manage to associate "p" with its actual complexType ?
>
>
>
> OUTPUT:
> __________________________
>
> URIMAP: [http://www.w3.org/HTML/1998/html4/->./h.xsd]
> Resolved schema ./h.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
> IMPORT: location --> ./h.xsd
> Resolved schema ./globali.xsd in
> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>
> ----------------------> elements found
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@113a53d (element:
> [xsd:element: null]) (name: Legge, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@c5495e (element:
> [xs:simpleType: null]) (name: string, targetNamespace:
> http://www.w3.org/2001/XMLSchema) (variety: atomic, final: [],
> lexicalFinal: null, validFacets: [length, minLength, maxLength,
> pattern, enumeration, whiteSpace])
> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
> [xsd:element: null]) (name: p, targetNamespace:
> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
> form: qualified, lexicalValue: null) (nillable: <unset>,
> disallowedSubstitutions: [], substitutionGroupExclusions: [],
> abstract: <unset>, lexicalFinal: [], block: [])
> Type
> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element:
> null) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (variety: atomic, final: null,
> lexicalFinal: null, validFacets: null)
> ----------------------> types found
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@297ffb (element:
> [xsd:complexType: null]) (name: blocchi, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: elementOnly,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@914f6a (element:
> [xsd:complexType: null]) (name: blocchifac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f4cbee (element:
> [xsd:complexType: null]) (name: blocchireq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@787d6a (element:
> [xsd:complexType: null]) (name: empty, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@71dc3d (element:
> [xsd:complexType: null]) (name: emptyfac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1326484 (element:
> [xsd:complexType: null]) (name: emptyreq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16546ef (element:
> [xsd:complexType: null]) (name: inline, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@18a49e0 (element:
> [xsd:complexType: null]) (name: inlinereq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
> final: [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f82982 (element:
> [xsd:complexType: null]) (name: ParaLevel, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16d2633 (element:
> [xsd:complexType: null]) (name: ParaLevelReq, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: mixed,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> true)
> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@e70e30 (element:
> [xsd:complexType: null]) (name: valore, targetNamespace:
> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>, final:
> [], abstract: <unset>, contentTypeCategory: empty,
> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
> <unset>)
> loaded schema
> TARGET NAMESPACE: http://www.normeinrete.it/nir/2.2/
> ********** AUTOMA simple DI Legge ************
> Component: - [0, -1]
> State: 0 *
> ********** AUTOMA simple DI h:p ************
> Component: - [0, -1]
> State: 0 *
> Creating Rules DONE
>


--------------020207070201070405030301
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tomamaso,<br>
<br>
I think you are running into the problem fixed by <a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=106098">106098</a>
so it would be good to try the latest 2.2.4 maintenance build.<br>
<br>
<br>
tommaso wrote:
<blockquote
cite="mid:ae393ae25ff823af08524d193649f3bf$1@www.eclipse.org"
type="cite">Yes, adding or commenting the URI mapping does not have
any effect as the files are all in the same folder.
<br>
<br>
The value of the schemaURL


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: import resolution and namespaces [message #602443 is a reply to message #72577] Thu, 21 June 2007 02:39 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080007070100000700030604
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Tommaso,

Sorry for misspelling your name. It's late...


Ed Merks wrote:
> Tomamaso,
>
> I think you are running into the problem fixed by 106098
> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=106098> so it would be
> good to try the latest 2.2.4 maintenance build.
>
>
> tommaso wrote:
>> Yes, adding or commenting the URI mapping does not have any effect as
>> the files are all in the same folder.
>>
>> The value of the schemaURL when calling getResource is correctly set
>> as the absolute path of the xsd
>>
>> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>>
>>
>>
>> The output follows; the problem here is that the element "p" of type
>> "inlinefac" turns out to be an XSDSympleType, while, listing
>> getTypeDefinitions(), "inlinefac" is actually a ComplexType.
>> The assignment of "p" as a SimpleType occurs when enforcing the
>> import resolution in
>>
>> xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), "");
>>
>> going inside this method with debugger shows that
>> XSDSchemaImpl.resolveTypeDefinition()
>>
>> gives a null result and enforces
>>
>> createUnresolvedTypeDefinition(namespace, localName);
>>
>> which probably assumes an empty simpleType "inlinefac" with only name
>> and namespace set while the actual "inlinefac" type is complex.
>>
>> How do I manage to associate "p" with its actual complexType ?
>>
>>
>>
>> OUTPUT:
>> __________________________
>>
>> URIMAP: [http://www.w3.org/HTML/1998/html4/->./h.xsd]
>> Resolved schema ./h.xsd in
>> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>>
>> IMPORT: namespace --> http://www.w3.org/HTML/1998/html4
>> IMPORT: location --> ./h.xsd
>> Resolved schema ./globali.xsd in
>> file:/home/tommaso/schemaWorkspace/xmLegesEditor/xsdData/XSD _Test_5/nirstrict.xsd
>>
>> ----------------------> elements found
>> org.eclipse.xsd.impl.XSDElementDeclarationImpl@113a53d (element:
>> [xsd:element: null]) (name: Legge, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (value: null, constraint:
>> <unset>, form: qualified, lexicalValue: null) (nillable: <unset>,
>> disallowedSubstitutions: [], substitutionGroupExclusions: [],
>> abstract: <unset>, lexicalFinal: [], block: [])
>> Type
>> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@c5495e (element:
>> [xs:simpleType: null]) (name: string, targetNamespace:
>> http://www.w3.org/2001/XMLSchema) (variety: atomic, final: [],
>> lexicalFinal: null, validFacets: [length, minLength, maxLength,
>> pattern, enumeration, whiteSpace])
>> org.eclipse.xsd.impl.XSDElementDeclarationImpl@53fb57 (element:
>> [xsd:element: null]) (name: p, targetNamespace:
>> http://www.w3.org/HTML/1998/html4) (value: null, constraint: <unset>,
>> form: qualified, lexicalValue: null) (nillable: <unset>,
>> disallowedSubstitutions: [], substitutionGroupExclusions: [],
>> abstract: <unset>, lexicalFinal: [], block: [])
>> Type
>> org.eclipse.xsd.impl.XSDSimpleTypeDefinitionImpl@19a32e0 (element:
>> null) (name: inlinefac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (variety: atomic, final: null,
>> lexicalFinal: null, validFacets: null)
>> ----------------------> types found
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@297ffb (element:
>> [xsd:complexType: null]) (name: blocchi, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@914f6a (element:
>> [xsd:complexType: null]) (name: blocchifac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f4cbee (element:
>> [xsd:complexType: null]) (name: blocchireq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: elementOnly,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@787d6a (element:
>> [xsd:complexType: null]) (name: empty, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@71dc3d (element:
>> [xsd:complexType: null]) (name: emptyfac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1326484 (element:
>> [xsd:complexType: null]) (name: emptyreq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16546ef (element:
>> [xsd:complexType: null]) (name: inline, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1428ea (element:
>> [xsd:complexType: null]) (name: inlinefac, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@18a49e0 (element:
>> [xsd:complexType: null]) (name: inlinereq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: extension,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@1f82982 (element:
>> [xsd:complexType: null]) (name: ParaLevel, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@16d2633 (element:
>> [xsd:complexType: null]) (name: ParaLevelReq, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: mixed,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> true)
>> org.eclipse.xsd.impl.XSDComplexTypeDefinitionImpl@e70e30 (element:
>> [xsd:complexType: null]) (name: valore, targetNamespace:
>> http://www.normeinrete.it/nir/2.2/) (derivationMethod: <unset>,
>> final: [], abstract: <unset>, contentTypeCategory: empty,
>> prohibitedSubstitutions: [], lexicalFinal: null, block: null, mixed:
>> <unset>)
>> loaded schema
>> TARGET NAMESPACE: http://www.normeinrete.it/nir/2.2/
>> ********** AUTOMA simple DI Legge ************
>> Component: - [0, -1]
>> State: 0 *
>> ********** AUTOMA simple DI h:p ************
>> Component: - [0, -1]
>> State: 0 *
>> Creating Rules DONE
>>
>


--------------080007070100000700030604
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tommaso,<br>
<br>
Sorry for misspelling your name.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:import resolution and namespaces
Next Topic:Automata from a XSD schema
Goto Forum:
  


Current Time: Thu Mar 28 21:40:22 GMT 2024

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

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

Back to the top