Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EDT:EDT approach to XML conversion

EGL

For EDT we will support converting all EGL logic parts (any part that can contain fields) to/from XML. This will include but is not limited to handlers, programs, libraries, external types, and records. Only fields will be supported for XML conversion, these fields can be properties (a getter and setter function represented as a field).

To control the conversion from/to XML we will use XML annotations that are similar to and in some cases identical to those used for JAXB in Java.

Java

For Java we will use JAXB to convert to/from XML. This requires that the Java contain the required XML annotation, ie a date field will need to contain an @XmlSchemaType(name="date"), or for field that will be represented as an attribute @XmlAttribute.

JavaScript

For each logic part we generate we will generate an function which will return the XML information about the fields on the logic part. The function will return objects that represent the EGL supported annotations. Then the JavaScript runtime will use the part instance along with the XML information to convert to/from XML.

The function will return egl.core.xml.XMLFieldInfo[]

egl.core.xml.XMLFieldInfo 
    getterFunction - function, if this field is null the field is accessed as a public field
    setterFunction - function, if this field is null the field is accessed as a public field
    xmlAnnotations - map
        keys: 
            "XMLStyle" - key for XmlAttribute or XmlElement
            All other annotations are stored under their simple name ie egl.core.xml.XmlSchemaType the key "XmlSchemaType".

JavaScript supported annotation classes
    egl.core.xml.XMLAttribute - see Java XmlAttribute
        name, namespace
    egl.core.xml.XMLElement - See Java XmlElement    
        name, namespace, nillable
    egl.core.xml.XMLArray - used to control xml array node names 
        string wrapped, string[] nodeNames
    egl.core.xml.XMLSchemaType - see Java XMLSchemaType
        name
    egl.core.xml.XMLRootElement - see Java XMLRootElement
        name, namespace, nillable
    egl.core.xml.XMLStructure - whether the complex type is choice, sequence, simpleContent, or unordered  



Back to the top