Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » How to check if a simple type is a restriction of a base type ?
How to check if a simple type is a restriction of a base type ? [message #59258] Wed, 20 April 2005 15:21 Go to next message
Eclipse UserFriend
Originally posted by: ediouf.genigraph.fr

Hi every body,

I would like to check if a simple type : "mySimpleType" is a restriction
of a base type : "integer" for exemple?

How can i do it?

Thanks for your reply ?
Re: How to check if a simple type is a restriction of a base type ? [message #59307 is a reply to message #59258] Wed, 20 April 2005 18:54 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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

Elhadji,

This method in XSDUtil does something similar to what you want to do:

/**
* Returns whether the simple type definition is the
* <a href="http://www.w3.org/TR/xmlschema-2/#dt-ID">ID</a>.
* @param xsdSimpleTypeDefinition a simple type definition.
* @return whether the simple type definition is
*/
public static boolean isOrIsDerivedFromID(XSDSimpleTypeDefinition
xsdSimpleTypeDefinition)
{
while (xsdSimpleTypeDefinition != null)
{
if (isURType(xsdSimpleTypeDefinition))
{
return false;
}

if
(isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTarge tNamespace())
&&
"ID".equals(xsdSimpleTypeDefinition.getName()))
{
return true;
}

xsdSimpleTypeDefinition =
xsdSimpleTypeDefinition.getBaseTypeDefinition();
}

return false;
}

You'll want to be careful going up the type hierarchy that you don't
loop forever on the anyType.


Elhadji wrote:

> Hi every body,
>
> I would like to check if a simple type : "mySimpleType" is a
> restriction of a base type : "integer" for exemple?
>
> How can i do it?
>
> Thanks for your reply ?
>


--------------040202060308050208060008
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">
Elhadji,<br>
<br>
This method in XSDUtil does something similar to what you want to do:<br>
<blockquote><small>
Re: How to check if a simple type is a restriction of a base type ? [message #594790 is a reply to message #59258] Wed, 20 April 2005 18:54 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.
--------------040202060308050208060008
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Elhadji,

This method in XSDUtil does something similar to what you want to do:

/**
* Returns whether the simple type definition is the
* <a href="http://www.w3.org/TR/xmlschema-2/#dt-ID">ID</a>.
* @param xsdSimpleTypeDefinition a simple type definition.
* @return whether the simple type definition is
*/
public static boolean isOrIsDerivedFromID(XSDSimpleTypeDefinition
xsdSimpleTypeDefinition)
{
while (xsdSimpleTypeDefinition != null)
{
if (isURType(xsdSimpleTypeDefinition))
{
return false;
}

if
(isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTarge tNamespace())
&&
"ID".equals(xsdSimpleTypeDefinition.getName()))
{
return true;
}

xsdSimpleTypeDefinition =
xsdSimpleTypeDefinition.getBaseTypeDefinition();
}

return false;
}

You'll want to be careful going up the type hierarchy that you don't
loop forever on the anyType.


Elhadji wrote:

> Hi every body,
>
> I would like to check if a simple type : "mySimpleType" is a
> restriction of a base type : "integer" for exemple?
>
> How can i do it?
>
> Thanks for your reply ?
>


--------------040202060308050208060008
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">
Elhadji,<br>
<br>
This method in XSDUtil does something similar to what you want to do:<br>
<blockquote><small>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to check if a simple type is a restriction of a base type ?
Next Topic:EStructuralFeature for the XSDSchema
Goto Forum:
  


Current Time: Thu Mar 28 15:04:46 GMT 2024

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

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

Back to the top