axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepal Jayasinghe (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2-2395) AxisMessage.getSchema() returns null when schema element is found in an imported schema
Date Mon, 11 Jun 2007 18:05:26 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-2395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Deepal Jayasinghe updated AXIS2-2395:
-------------------------------------

        Fix Version/s: 1.3
             Priority: Blocker  (was: Minor)
    Affects Version/s:     (was: 1.1.1)
                           (was: 1.2)
                       1.3

> AxisMessage.getSchema() returns null when schema element is found in an imported schema
> ---------------------------------------------------------------------------------------
>
>                 Key: AXIS2-2395
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2395
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.3
>         Environment: All
>            Reporter: Jeff Faath
>            Assignee: Deepal Jayasinghe
>            Priority: Blocker
>             Fix For: 1.3
>
>
> When calling getSchema() on an AxisMessage, 'null' is returned when the schema element
is found in an imported schema.  This is because the code does not check imported schema.
 I've devised a solution below which recursively traverses any imported schema.  The original
getSchema() method can be replaced by the two methods below:
> public XmlSchemaElement getSchemaElement() {
>   AxisService service = (AxisService) getParent().getParent();
>     ArrayList schemas = service.getSchema();
>     for (int i = 0; i < schemas.size(); i++) {
>       XmlSchema schema = (XmlSchema) schemas.get(i);
>       return getSchemaElement(schema);
>     }
>     return null;
> }
> private XmlSchemaElement getSchemaElement(XmlSchema schema) {
>   XmlSchemaElement returnElement = null;
>   if (schema != null) {
>     if (schema.getItems() != null) {
>       Iterator schemaItems = schema.getItems().getIterator();
>       while (schemaItems.hasNext()) {
>         Object item = schemaItems.next();
>         if (item instanceof XmlSchemaElement) {
>           XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) item;
>           if (xmlSchemaElement.getQName().equals(this.elementQname)) {
>             returnElement = xmlSchemaElement;
>           }
>         }
>        else if (item instanceof org.apache.ws.commons.schema.XmlSchemaImport) {
>          returnElement = getSchemaElement(((org.apache.ws.commons.schema.XmlSchemaImport)item).getSchema());
>        }
>        else if (item instanceof org.apache.ws.commons.schema.XmlSchemaInclude) {
>          returnElement = getSchemaElement(((org.apache.ws.commons.schema.XmlSchemaInclude)item).getSchema());
>        }
>        // We've found a matching element, no need to continue...
>        if (returnElement != null)
>          break;
>        }
>      }
>    }
>    return returnElement;
>  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message