You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Venkatakrishnan (JIRA)" <tu...@ws.apache.org> on 2006/05/29 16:53:31 UTC

[jira] Commented: (TUSCANY-419) Template XML for JavaScript components

    [ http://issues.apache.org/jira/browse/TUSCANY-419?page=comments#action_12413720 ] 

Venkatakrishnan commented on TUSCANY-419:
-----------------------------------------

Hi Ant,

I looked up XMLBeans and did find the code for this. To recap the requirements that I have assumed for this.  If anything is more to this, please add and I will work on them : -
	- given a schema definition in an wsdl file  or in an  xsd file   create an xml instance for a given type defined in the schema definition.
       
Now I have some question, could you or anybody else please clarify them.

SDO based Generator (the patch that has been submitted earlier)
-----------------------------------------------------------------------------------------
- This generator based on SDOs will generate an XML instance given a type.   However, in this, you could also create an instance of an 'element' which is not defined in the schema.  The reason is that this generation is based only the schema types definitions and not element definitions.   For example I defined a type as follows in the helloworld.wsdl and defined no element based on this type. 
		<complexType name="ComplexGreetings">
                <sequence>
                    <element name="greet1" type="xsd:string"/>
                    <element name="greet2" type="xsd:double"/>
                </sequence>
        	</complexType>
Then using the generator I managed to create an instance of this type called 'ComplexGreetings' as follows: -
<?xml version="1.0" encoding="ASCII"?>
<helloworldaxis:complexgreetings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:helloworldaxis="http://helloworldaxis.samples.tuscany.apache.org" xsi:type="helloworldaxis:ComplexGreetings">
  <helloworldaxis:greet1></helloworldaxis:greet1>
  <helloworldaxis:greet2>0.0</helloworldaxis:greet2>
</helloworldaxis:complexgreetings>

Question : Is this right and permissable?  Can an instance of an element not defined in an xml schema definition allowed to be created?


XMLBeans based Generator 
---------------------------------------
I looked up the code for this and have developed some wrapper implementation to work around a few things.  But most function is right there in XMLBeans itself. 
- There was no way to load wsdl files and parse the schema within.  I have fixed this in the wrapper.  Now you may either load wsdl file or an xsd file.  I played around a bit with the wsdl extension classes for this and it works.  

The 'xml declaration'  - <?xml version="1.0" encoding="ASCII"?>  is not generated in the output.  If this is required to be generated it is very simple to do so.
Question : Should this be done?

- The XML Beans based approach allows you to create ONLY elements that are defined in the xml schema definition of the XSD or WSDL file.  If you mentioned a schema type and wanted an xml instance for it, this would not work.   Not sure if this would be ok, I extended a bit and now I am able to create instances for given schema types, just as it used to work in the case of the SDO generator.   But then the ugly thing is that the output xml instance has its root element named as 'xml-fragment' and there is no way to change this unless we parse this all over.
I am not comfortable with this.  I feel it is only right that one is not allowed to create element types that are not defined in the schema.  Am I right?  If so shall I do away with this extension?



> Template XML for JavaScript components
> --------------------------------------
>
>          Key: TUSCANY-419
>          URL: http://issues.apache.org/jira/browse/TUSCANY-419
>      Project: Tuscany
>         Type: New Feature

>   Components: Java SCA JavaScript Container
>     Versions: Java-M2
>     Reporter: ant elder
>     Priority: Critical
>      Fix For: Java-M2
>  Attachments: tuscany-sca-plugins patch 24-May.txt, tuscany-sca-tools patch 24-May.txt
>
> Provide a template XML facility for JavaScript components

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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