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

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

    [ 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