Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

How to set ShapeNode as value of Data (data.type) ?

0 votes

Hi all,

I want to create Data with value which is a ShapeNode instead of String content. How can I do it ?

Sample:

<data key="d0">
    <y:ShapeNode>
        <y:NodeLabel>Node Label</y:NodeLabel>
        <y:Shape type="circle"/>
        <y:Fill color="#00FF00" transparent="false"/>
        <y:Geometry height="10" width="10" x="0" y="0"/>
    </y:ShapeNode>
</data>

Currently I tried to generate pojo classes from ygraphml.xsd schema by jaxb (jxc) then use those classes to create graphml file. Look into the class DataType, I just see it support method to set String content only.

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "data.type", namespace = "http://graphml.graphdrawing.org/xmlns")
public class DataType
    extends DataExtensionType

....

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "data-extension.type", namespace = "http://graphml.graphdrawing.org/xmlns")
@XmlSeeAlso({
    DefaultType.class,
    DataType.class
})
public class DataExtensionType
    extends OriginalDataExtensionType

....

 

public class OriginalDataExtensionType {

    @XmlValue
    protected String content;

 

Therefore I cannot set ShapeNode as value of DataType.

in Help by (120 points)
recategorized by

1 Answer

0 votes

Well, the ygraphml.xsd is probably too complex for automated POJO generation with  JAXB. (It uses inheritance - a feature that is not supported by most XML tools.) I guess you will have to resort to a more traditional approach to XML creation like Java's org.w3c.dom API.

by [yWorks] (133k points)
Legal Disclosure | Privacy Policy
...