You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Ron Gavlin (JIRA)" <tu...@ws.apache.org> on 2007/09/26 20:58:50 UTC

[jira] Created: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

XMLHelper.load() IOException using schema that has both a substitution group and an extension
---------------------------------------------------------------------------------------------

                 Key: TUSCANY-1812
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Implementation
    Affects Versions: Java-SDO-Next
            Reporter: Ron Gavlin
            Priority: Critical


Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. Please comment if you have questions.

- Ron

package org.apache.tuscany.sdo.test;

import java.io.IOException;
import java.net.URL;

import junit.framework.TestCase;

import commonj.sdo.DataObject;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.helper.XSDHelper;
import commonj.sdo.impl.HelperProvider;

public final class SubstitutionWithExtensionValuesTestCase extends TestCase
{
  public void test() throws IOException
  {
    HelperContext hc = HelperProvider.getDefaultContext();
    URL url = getClass().getResource("/SubstitutionWithExtensionValues.xsd");
    XSDHelper xsdHelper = hc.getXSDHelper();
    xsdHelper.define(url.openStream(), url.toString());

    XMLHelper xmlHelper = hc.getXMLHelper();
    DataObject loadedObject = 
        xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues.xml")).getRootObject();
  }
}


SubstitutionWithExtensionValues.xsd

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.apache.org/tuscany/SubstitutionWithExtensionValues" 
        xmlns:sv="http://www.apache.org/tuscany/SubstitutionWithExtensionValues">
  <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
    
    http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.    
  -->
  <element name="results" type="sv:ResultsType"/>
  
  <element name="result" type="sv:ResultType"/>
  <element name="myResult" type="sv:MyResultType"/>
  
  <complexType name="ResultsType">
    <sequence>
      <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
      <element name="comment" type="string"/>
    </sequence>
  </complexType>
  
  <complexType name="ResultType">
    <sequence>
      <element name="name" type="string"/>
      <element name="value" type="string"/>
    </sequence>
  </complexType>
  <complexType name="MyResultType">
    <complexContent>
      <extension base="sv:ResultType"/>
    </complexContent>
  </complexType>
  
</schema>


SubstitutionWithExtensionValues.xml

<?xml version="1.0" encoding="ASCII"?>
<sv:results xmlns:sv="http://www.apache.org/tuscany/SubstitutionWithExtensionValues">
  <sv:result>
    <sv:name>name1</sv:name>
    <sv:value>value1</sv:value>
  </sv:result>
  <sv:myResult>
    <sv:name>myName1</sv:name>
    <sv:value>myValue1</sv:value>
  </sv:myResult>
  <sv:comment>comment1</sv:comment>
</sv:results>


STACKTRACE

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 16)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 16)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
	... 24 more


-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amita Vadhavkar updated TUSCANY-1812:
-------------------------------------

    Fix Version/s:     (was: Java-SDO-Next)
                   Java-SDO-1.1

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>             Fix For: Java-SDO-1.1
>
>         Attachments: tuscany-sdo.TUSCANY-1812_1830_1832.patch
>
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531630 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

Hi Ron,

I think that with Ed's suggestion we don't want to use the extendedMetaDataHolderCache. That is, you should not include my earlier suggested fix. Ed's approach is to force the objects themselves to compute and cache their own extendedMetaData. Then it doesn't matter what ExtendedMetaData instance is used to access it.

Frank.


> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531632 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

Oops, I just noticed one more thing. You shouldn't be calling ExtendedMetaData.INSTANCE.getName() in putPackage() but rather this.getName().

Frank.


> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530763 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Here's more info.

The problem indeed occurs during the invocation of BasicExtendedMetaData.createEStructuralFeatureExtendedMetaData() which instantiates the inner class BasicExtendedMetaData.EStructuralFeatureExtendedMetaDataImpl. This inner class relies on its outer class to access the registry. In the dynamic SDO case, the outer class is SDOExtendedMetaDataImpl which contains the correct registry. In the static SDO case, the outer class is EMF's BasicExtendedMetaData which contains the incorrect registry. I have pasted the two stack traces below for comparison. Later on, the getAffiliation() method is invoked which triggers the problem registry access in the outer class.

In order to fix the static SDO case, should "DocumentRoot" be handled as a special case? This would avoid going down the EMF-centric DynamicDataObjectImpl path evident in the stack trace. Or, is another more generic fix appropriate? 

Obviously, this is a pressing issue for us. If this is a problem you have time to address and think you can fix in a timely fashion, then I'll let you take it from here. Otherwise, if you or one of the other committers could provide me some direction for fixing the problem, I would appreciate it.

Thanks,

- Ron

STATIC SDO

Thread [main] (Suspended (breakpoint at line 2904 in BasicExtendedMetaData))	
	BasicExtendedMetaData.createEStructuralFeatureExtendedMetaData(EStructuralFeature) line: 2904	
	BasicExtendedMetaData.getExtendedMetaData(EStructuralFeature) line: 2896	
	BasicExtendedMetaData.getFeatureKind(EStructuralFeature) line: 407	
	BasicExtendedMetaData.getElements(EClass) line: 922	
	BasicExtendedMetaData.getAllElements(EClass) line: 869	
	FeatureMapUtil$BasicValidator.<init>(EClass, EStructuralFeature) line: 1394	
	FeatureMapUtil.getValidator(EClass, EStructuralFeature) line: 1533	
	BasicFeatureMap.<init>(InternalEObject, int) line: 47	
	AttributeImpl$InternalSettingDelegateSequence(EStructuralFeatureImpl$InternalSettingDelegateMany).createDynamicSetting(InternalEObject) line: 1602	
	AttributeImpl$InternalSettingDelegateSequence.createDynamicSetting(InternalEObject) line: 188	
	<unknown receiving type>(EStructuralFeatureImpl$InternalSettingDelegateMany).dynamicGet(InternalEObject, EStructuralFeature$Internal$DynamicValueHolder, int, boolean, boolean) line: 1627	
	DynamicDataObjectImpl.eDynamicGet(int, boolean, boolean) line: 146	
	DynamicDataObjectImpl(DataObjectImpl).eGet(int, boolean, boolean) line: 1463	
	DynamicDataObjectImpl(BasicEObjectImpl).eGet(EStructuralFeature, boolean, boolean) line: 595	
	DynamicDataObjectImpl(BasicEObjectImpl).eGet(EStructuralFeature, boolean) line: 587	
	DynamicDataObjectImpl(BasicEObjectImpl).eGet(EStructuralFeature) line: 582	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).processTopObject(EObject) line: 1272	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createDocumentRoot(String, String, String, EFactory, boolean) line: 1236	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createObjectByType(String, String, boolean) line: 1165	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).createTopObject(String, String) line: 1247	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).processElement(String, String, String) line: 883	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).startElement(String, String, String) line: 866	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler(XMLHandler).startElement(String, String, String, Attributes) line: 627	
	SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(String, String, String, Attributes) line: 401	
...


DYNAMIC SDO

Thread [main] (Suspended (breakpoint at line 2904 in BasicExtendedMetaData))	
	SDOExtendedMetaDataImpl(BasicExtendedMetaData).createEStructuralFeatureExtendedMetaData(EStructuralFeature) line: 2904	
	SDOExtendedMetaDataImpl(BasicExtendedMetaData).getExtendedMetaData(EStructuralFeature) line: 2896	
	SDOExtendedMetaDataImpl(BasicExtendedMetaData).setFeatureKind(EStructuralFeature, int) line: 446	
	SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).createFeature(EClass, String, EClassifier, XSDComponent, int, int) line: 1167	
	SDOXSDEcoreBuilder.createFeature(EClass, String, EClassifier, XSDComponent, int, int) line: 367	
	SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).createFeature(EClass, XSDElementDeclaration, String, XSDComponent, int, int) line: 1439	
	SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).getEStructuralFeature(XSDFeature) line: 1476	
	SDOXSDEcoreBuilder(BaseSDOXSDEcoreBuilder).generate(XSDSchema) line: 1517	
	XSDHelperImpl.define(InputSource, String) line: 246	
	XSDHelperImpl.define(InputStream, String) line: 224	
	SubstitutionWithExtensionValuesTestCase.test() line: 40	
...


> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531600 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Frank,

My solution was far from clean. So, I'll give this solution a try and see if it works.

Thanks,

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Gavlin updated TUSCANY-1812:
--------------------------------

    Patch Info: [Patch Available]

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>             Fix For: Java-SDO-Next
>
>         Attachments: tuscany-sdo.TUSCANY-1812_1830_1832.patch
>
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542557 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Kelvin,

Thanks for reviewing and applying this patch for me.

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>             Fix For: Java-SDO-Next
>
>         Attachments: tuscany-sdo.TUSCANY-1812_1830_1832.patch
>
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531539 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

I posted a question on the EMF newsgroup regarding this topic and here is a link to Ed Merk's response. (http://www.eclipse.org/newsportal/article.php?id=27562&group=eclipse.tools.emf#27562). Any thoughts?

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531089 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Makes sense. 

I have made some headway on the BasicFeatureMap/BasicValidator refactoring. 

However, I am struggling with how to make the SDOExtendedMetaDataImpl in the XMLHandler available to invoker of BasicExtendedMetaData.createEStructuralFeatureExtendedMetaDataImpl(). Line 1272 below currently triggers the createES...() invocation. Would it make sense to modify extendedMetaData.getMixedFeature() (Line 1269 below) to aggressively trigger the createEStructural...() invocation(s) since it has access to extendedMetaData?

XMLHandler.processTopObject() 

1269        EStructuralFeature target = extendedMetaData.getMixedFeature(object.eClass());
        if (target != null)
        {
1272          FeatureMap otherFeatureMap = (FeatureMap)object.eGet(target);

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531039 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

No. That's why this is hard to get right. Lots of places that BasicExtendedMetaData.INSTANCE is used don't rely on the registry. Many of the methods being called on it could just as well have been static, so it's safe to call them on any instance. We only need to ensure that uses of ExtendedMetaData that use the registry or EcoreFactory/Package are using the SDO one. I realize this is kind of messy, but will require quite a few changes in EMF to clean it up completely. Unfortunately, EMF wasn't really designed to be decoupled this way, even though, aside from that, it really does give us a large percentantage of the SDO implementation for free.

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531034 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Frank, one more question. Do you think all references to ExtendedMetaData.INSTANCE within Tuscany (or even the pieces of EMF used by Tuscany) are problematic? 

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531012 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Hi Frank,

Yes, I think the combined approach is a good idea.

Do References need the validator goodness or is it just needed for Attributes?

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530551 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

Hi Ron, It looks like your myResult element is missing the substitutionGroup attribute:

  <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import java.net.URL;
> import junit.framework.TestCase;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.helper.XSDHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase
> {
>   public void test() throws IOException
>   {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     URL url = getClass().getResource("/SubstitutionWithExtensionValues.xsd");
>     XSDHelper xsdHelper = hc.getXSDHelper();
>     xsdHelper.define(url.openStream(), url.toString());
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = 
>         xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues.xml")).getRootObject();
>   }
> }
> SubstitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.apache.org/tuscany/SubstitutionWithExtensionValues" 
>         xmlns:sv="http://www.apache.org/tuscany/SubstitutionWithExtensionValues">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> SubstitutionWithExtensionValues.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sv:results xmlns:sv="http://www.apache.org/tuscany/SubstitutionWithExtensionValues">
>   <sv:result>
>     <sv:name>name1</sv:name>
>     <sv:value>value1</sv:value>
>   </sv:result>
>   <sv:myResult>
>     <sv:name>myName1</sv:name>
>     <sv:value>myValue1</sv:value>
>   </sv:myResult>
>   <sv:comment>comment1</sv:comment>
> </sv:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 16)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:51)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 16)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530789 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

After further investigation, what do you think of this approach.

1. Change AttributeImpl.InternalSettingDelegateSequence to be non-static

2. Create BasicFeatureMap and FeatureMapUtil.BasicValidator subclasses whose constructors accept an add'l ExtendedMetaData parameter. The BasicValidator subclass will look like its parent's constructor except it will reference the ExtendedMetaData parameter rather than ExtendedMetaData.INSTANCE.

3. Modify AttributeImpl.InternalSettingDelegateSequence.createDynamicSetting(InternalEObject owner) to handle feature style FEATURE_MAP directly rather than calling super(). It would instantiate the BasicFeatureMap subclass passing its getExtendedMetaData() which is the correct SDOExtendedMetaDataImpl.

Does this sound reasonable?

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530557 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Hi Frank,

Sorry 'bout that. Interestingly, with that correction, the originally posted dynamic test case runs fine. I reposted the description which now runs the test using static SDO and the problem returns. My internal application that is failing is using static SDO. 

This is a regression that appears to have been introduced with the SDOPackageRegistryDelegator. I have been looking at it a little while but no solution yet. It appears the EStructuralFeatureExtendedMetaData returned by BasicExtendedMetaData.getExtendedMetaData(EStructuralFeature) is loosing the SDOExtendedMetaDataImpl scope and eventually tries to get an EPackage from the wrong registry. This occurs during its attempt to get the Affiliation. Does that make sense? 

If you have time to look at it, that would be great. If not, I would appreciate any pointers you can provide. We are trying to migrate to a post-SDO 1.0 build from a pre-SDO 1.0 build and this is a showstopper.

Regards,

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531156 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Hi Frank,

Any thoughts related to my previous comment?

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530795 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

Hi Ron, I'll try to look at it this afternoon, and append my thoughts later today.

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531242 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

Hi Ron,

Your suggestion sounds reasonable if there's no cleaner way to handle it. This is probably another good question to ask on the EMF newsgroup. Ed Merks often has clever ideas for things like this.

Frank.

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531673 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Hi Frank,

Yes, this works very cleanly. Thanks to you (and Ed) for your help. I'll post a patch in the near future.

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531619 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Frank,

When I invoke ExtendedMetaData.INSTANCE.getName() on all the classifiers/structural features from within SDOExtendedMetaDataImpl.putPackage(), the extendedMetaDataHolderCache is always null which invalidates the pre-cache concept. What am I doing wrong?

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Resolved: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kelvin Goodson resolved TUSCANY-1812.
-------------------------------------

    Resolution: Fixed

Patch Applied (many thanks Ron)

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>             Fix For: Java-SDO-Next
>
>         Attachments: tuscany-sdo.TUSCANY-1812_1830_1832.patch
>
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530718 ] 

Ron Gavlin commented on TUSCANY-1812:
-------------------------------------

Frank,

Now that Tuscany is using the SDOPackageRegistryDelegator, don't references from Tuscany to EMF's ExtendedMetaData.INSTANCE become problematic in general since it's EPackage registry is different from the SDOPackageRegistry within the Tuscany HelperContext?

The problem in this case appears to be that the "myResult" global property's extendedMetaData is not an instance of SDOExtendedMetaDataImpl but rather EMF's BasicExtendedMetaData. The registry within EMF's BasicExtendedMetaData is the standard EPackageRegistryImpl which doesn't contain the SEVFactoryImpl registered types. 

I've seen some unusual behavior with the DataTypeImpl.getBaseTypes() using the SDO 1.0 code and I just noticed that this code uses ExtendedMetaData.INSTANCE as part of its implementation as well. I'll need to investigate more before I open a JIRA. However, I suspect these problems might be related. 

Am I making sense?

- Ron

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531024 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

Ron, I'm not sure of the answer to your question. Asking it on the EMF newsgroup should probably get you a quick answer.


> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530883 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

Hi Ron,

Well this certainly looks like a nasty oversight from the recent change we made to decouple SDO from the EMF global registry.

I was experimenting with another approach to fix it using an extendedMetaDataHolderCache, which avoids going directly to the objects. 

I added this constant in SDOXSDEcoreBuilderImpl:

  public static String SDO_ANNOTATION_URI = "http:///org/apache/tuscany/sdo/helper/SDOExtendedMetaData";

and then changed the constructor to call a 2 argument base constructor like this:

  public SDOExtendedMetaDataImpl(Registry registry) {
    super(SDO_ANNOTATION_URI, registry);
    ecoreFactory = new SDOEcoreFactory();
    demandMetaData = new SDODemandMetaData();
  }

I also needed to change the ANNOTATION_SOURCE constant in FactoryBase:

  //private static final String ANNOTATION_SOURCE = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
  private static final String ANNOTATION_SOURCE = SDOExtendedMetaDataImpl.SDO_ANNOTATION_URI;

With these changes, it seemed to fix the getAffiliation() problem, but it still has a problem with the validator.

Unfortunately, I don't have any more time to look at it right now. If you want to take it further, that would be great. Also, I'm not opposed to the approach you suggested, if that works out better. Maybe a combiniation of the two would be best.

Thanks,
Frank.

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Gavlin updated TUSCANY-1812:
--------------------------------

    Attachment: tuscany-sdo.TUSCANY-1812_1830_1832.patch

This is a patch for issues TUSCANY-1812, TUSCANY-1830, and TUSCANY-1832 which are all related.

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>             Fix For: Java-SDO-Next
>
>         Attachments: tuscany-sdo.TUSCANY-1812_1830_1832.patch
>
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531572 ] 

Frank Budinsky commented on TUSCANY-1812:
-----------------------------------------

I think the last suggestion sounds like the simplest sollution. Eagerly precache the "holder"s for static packages. We can do it right away when we register a static package. Maybe we could do it in SDOExtendedMetaDataImpl.putPackage() which is called by the Factory.register() method. We could simply add code to walk through the package and call ExtnededMetaData.getName() on all the classifiers and structural features.


> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-1812) XMLHelper.load() IOException using schema that has both a substitution group and an extension

Posted by "Ron Gavlin (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Gavlin updated TUSCANY-1812:
--------------------------------

    Description: 
Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.

- Ron

package org.apache.tuscany.sdo.test;

import java.io.IOException;

import junit.framework.TestCase;

import com.example.substitution.ev.SEVFactory;
import commonj.sdo.DataObject;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.impl.HelperProvider;

public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
  
  public void test() throws IOException {
    HelperContext hc = HelperProvider.getDefaultContext();
    SEVFactory.INSTANCE.register(hc);
    
    XMLHelper xmlHelper = hc.getXMLHelper();
    DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
  }
}

substitutionWithExtensionValues.xsd

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.example.com/substitutionEV" 
        xmlns:sv="http://www.example.com/substitutionEV">
  <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
    
    http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.    
  -->
  <element name="results" type="sv:ResultsType"/>
  
  <element name="result" type="sv:ResultType"/>
  <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
  
  <complexType name="ResultsType">
    <sequence>
      <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
      <element name="comment" type="string"/>
    </sequence>
  </complexType>
  
  <complexType name="ResultType">
    <sequence>
      <element name="name" type="string"/>
      <element name="value" type="string"/>
    </sequence>
  </complexType>
  <complexType name="MyResultType">
    <complexContent>
      <extension base="sv:ResultType"/>
    </complexContent>
  </complexType>
  
</schema>

substitutionWithExtensionValues1.xml

<?xml version="1.0" encoding="ASCII"?>
<sev:results xmlns:sev="http://www.example.com/substitutionEV">
  <sev:result>
    <sev:name>name1</sev:name>
    <sev:value>value1</sev:value>
  </sev:result>
  <sev:myResult>
    <sev:name>myName1</sev:name>
    <sev:value>myValue1</sev:value>
  </sev:myResult>
  <sev:comment>comment1</sev:comment>
</sev:results>


STACKTRACE

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
	... 24 more



  was:
Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. Please comment if you have questions.

- Ron

package org.apache.tuscany.sdo.test;

import java.io.IOException;
import java.net.URL;

import junit.framework.TestCase;

import commonj.sdo.DataObject;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.helper.XSDHelper;
import commonj.sdo.impl.HelperProvider;

public final class SubstitutionWithExtensionValuesTestCase extends TestCase
{
  public void test() throws IOException
  {
    HelperContext hc = HelperProvider.getDefaultContext();
    URL url = getClass().getResource("/SubstitutionWithExtensionValues.xsd");
    XSDHelper xsdHelper = hc.getXSDHelper();
    xsdHelper.define(url.openStream(), url.toString());

    XMLHelper xmlHelper = hc.getXMLHelper();
    DataObject loadedObject = 
        xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues.xml")).getRootObject();
  }
}


SubstitutionWithExtensionValues.xsd

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.apache.org/tuscany/SubstitutionWithExtensionValues" 
        xmlns:sv="http://www.apache.org/tuscany/SubstitutionWithExtensionValues">
  <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
    
    http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.    
  -->
  <element name="results" type="sv:ResultsType"/>
  
  <element name="result" type="sv:ResultType"/>
  <element name="myResult" type="sv:MyResultType"/>
  
  <complexType name="ResultsType">
    <sequence>
      <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
      <element name="comment" type="string"/>
    </sequence>
  </complexType>
  
  <complexType name="ResultType">
    <sequence>
      <element name="name" type="string"/>
      <element name="value" type="string"/>
    </sequence>
  </complexType>
  <complexType name="MyResultType">
    <complexContent>
      <extension base="sv:ResultType"/>
    </complexContent>
  </complexType>
  
</schema>


SubstitutionWithExtensionValues.xml

<?xml version="1.0" encoding="ASCII"?>
<sv:results xmlns:sv="http://www.apache.org/tuscany/SubstitutionWithExtensionValues">
  <sv:result>
    <sv:name>name1</sv:name>
    <sv:value>value1</sv:value>
  </sv:result>
  <sv:myResult>
    <sv:name>myName1</sv:name>
    <sv:value>myValue1</sv:value>
  </sv:myResult>
  <sv:comment>comment1</sv:comment>
</sv:results>


STACKTRACE

org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 16)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 16)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
	... 24 more



Description clean-up. 

> XMLHelper.load() IOException using schema that has both a substitution group and an extension
> ---------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1812
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1812
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-Next
>            Reporter: Ron Gavlin
>            Priority: Critical
>
> Below, please find a failing Java test case and its XSD and XML test resources. Also, please find the stacktrace from the failing Java test case. It is interesting to note that this test does not fail when using dynamic SDO. Please comment if you have questions.
> - Ron
> package org.apache.tuscany.sdo.test;
> import java.io.IOException;
> import junit.framework.TestCase;
> import com.example.substitution.ev.SEVFactory;
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.impl.HelperProvider;
> public final class SubstitutionWithExtensionValuesTestCase extends TestCase {
>   
>   public void test() throws IOException {
>     HelperContext hc = HelperProvider.getDefaultContext();
>     SEVFactory.INSTANCE.register(hc);
>     
>     XMLHelper xmlHelper = hc.getXMLHelper();
>     DataObject loadedObject = xmlHelper.load(getClass().getResourceAsStream("/substitutionWithExtensionValues1.xml")).getRootObject();
>   }
> }
> substitutionWithExtensionValues.xsd
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         targetNamespace="http://www.example.com/substitutionEV" 
>         xmlns:sv="http://www.example.com/substitutionEV">
>   <!--
>     Licensed to the Apache Software Foundation (ASF) under one
>     or more contributor license agreements.  See the NOTICE file
>     distributed with this work for additional information
>     regarding copyright ownership.  The ASF licenses this file
>     to you under the Apache License, Version 2.0 (the
>     "License"); you may not use this file except in compliance
>     with the License.  You may obtain a copy of the License at
>     
>     http://www.apache.org/licenses/LICENSE-2.0
>     
>     Unless required by applicable law or agreed to in writing,
>     software distributed under the License is distributed on an
>     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>     KIND, either express or implied.  See the License for the
>     specific language governing permissions and limitations
>     under the License.    
>   -->
>   <element name="results" type="sv:ResultsType"/>
>   
>   <element name="result" type="sv:ResultType"/>
>   <element name="myResult" type="sv:MyResultType" substitutionGroup="sv:result"/>
>   
>   <complexType name="ResultsType">
>     <sequence>
>       <element ref="sv:result" minOccurs="0" maxOccurs="unbounded"/>
>       <element name="comment" type="string"/>
>     </sequence>
>   </complexType>
>   
>   <complexType name="ResultType">
>     <sequence>
>       <element name="name" type="string"/>
>       <element name="value" type="string"/>
>     </sequence>
>   </complexType>
>   <complexType name="MyResultType">
>     <complexContent>
>       <extension base="sv:ResultType"/>
>     </complexContent>
>   </complexType>
>   
> </schema>
> substitutionWithExtensionValues1.xml
> <?xml version="1.0" encoding="ASCII"?>
> <sev:results xmlns:sev="http://www.example.com/substitutionEV">
>   <sev:result>
>     <sev:name>name1</sev:name>
>     <sev:value>value1</sev:value>
>   </sev:result>
>   <sev:myResult>
>     <sev:name>myName1</sev:name>
>     <sev:value>myValue1</sev:value>
>   </sev:myResult>
>   <sev:comment>comment1</sev:comment>
> </sev:results>
> STACKTRACE
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:278)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:666)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad(SDOXMLResourceImpl.java:585)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java:634)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:266)
> 	at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java:239)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:97)
> 	at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:79)
> 	at org.apache.tuscany.sdo.test.SubstitutionWithExtensionValuesTestCase.test(SubstitutionWithExtensionValuesTestCase.java:40)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:154)
> 	at junit.framework.TestCase.runBare(TestCase.java:127)
> 	at junit.framework.TestResult$1.protect(TestResult.java:106)
> 	at junit.framework.TestResult.runProtected(TestResult.java:124)
> 	at junit.framework.TestResult.run(TestResult.java:109)
> 	at junit.framework.TestCase.run(TestCase.java:118)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'myResult' not found. (http:///temp.xml, 7, 17)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.reportUnknownFeature(XMLHandler.java:1747)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleUnknownFeature(XMLHandler.java:1711)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleUnknownFeature(SDOXMLResourceImpl.java:367)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLHandler.java:1655)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:887)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:866)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:627)
> 	at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement(SDOXMLResourceImpl.java:401)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:330)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> 	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:268)
> 	... 24 more

-- 
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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org