Example usage for org.jdom2 Element setAttribute

List of usage examples for org.jdom2 Element setAttribute

Introduction

In this page you can find the example usage for org.jdom2 Element setAttribute.

Prototype

public Element setAttribute(final Attribute attribute) 

Source Link

Document

This sets an attribute value for this element.

Usage

From source file:AL_gui.java

License:Apache License

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
    // TODO add your handling code here:
    try {/* w ww . ja  v  a2s .c om*/
        String nnetName = JOptionPane.showInputDialog(jButton3, "Enter a filename, excluding extention.",
                "ANNeML Wizard", JOptionPane.QUESTION_MESSAGE);
        if (nnetName == " ") {
            JOptionPane.showMessageDialog(null, "An input value must be entered.");
        }

        Element nnet = new Element("NNETWORK");
        nnet.setAttribute(new Attribute("noNamespaceSchemaLocation", "ANNeML.xsd",
                Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")));
        nnet.setAttribute(new Attribute("NNET_NAME", nnetName));
        Document doc = new Document(nnet);

        String subnnets = JOptionPane.showInputDialog(jButton3, "How many SUBNET(s)?", "ANNeML Wizard",
                JOptionPane.QUESTION_MESSAGE);
        if (subnnets == " ") {
            JOptionPane.showMessageDialog(null, "An input value must be entered.");
        }
        int numSubs = java.lang.Integer.parseInt(subnnets);
        int i = 0;
        do {
            Element subnet = new Element("SUBNET");
            String learningRate = JOptionPane.showInputDialog(jButton3, "SUBNET learning rate(eta)?",
                    "ANNeML Wizard", JOptionPane.QUESTION_MESSAGE);
            if (learningRate == " ") {
                JOptionPane.showMessageDialog(null, "An input value must be entered.");
            }
            subnet.setAttribute(new Attribute("NNET_V2", learningRate));
            subnet.setAttribute(new Attribute("SNET_NAME", nnetName + "-subnet" + String.valueOf(i + 1)));
            subnet.setAttribute(new Attribute("ADJUST_LOCK", "0"));

            String input_layers = JOptionPane.showInputDialog(jButton3,
                    "How many <<INPUT>> LAYERS(s) in this subnet?", "ANNeML Wizard",
                    JOptionPane.QUESTION_MESSAGE);
            if (input_layers == " ") {
                JOptionPane.showMessageDialog(null, "An input value must be entered.");
            }
            int numInLayers = java.lang.Integer.parseInt(input_layers);
            int x = 0;
            do {
                Element inLayer = new Element("LAYER");
                inLayer.setAttribute(new Attribute("LAYER_NAME", "INPUT"));
                String transferFunc = JOptionPane.showInputDialog(jButton3,
                        "Which transfer function for this LAYER? 1(hyberbolic tangent) or 2(logarithmic sigmoid)",
                        "ANNeML Wizard", JOptionPane.QUESTION_MESSAGE);
                if (transferFunc == " ") {
                    JOptionPane.showMessageDialog(null, "An input value must be entered.");
                }
                inLayer.setAttribute(new Attribute("TRANSFER_FUNCTION", transferFunc));
                String inNodes = JOptionPane.showInputDialog(jButton3,
                        "How many NEURODE(s) in this <<INPUT>> LAYER?", "ANNeML Wizard",
                        JOptionPane.QUESTION_MESSAGE);
                if (inNodes == " ") {
                    JOptionPane.showMessageDialog(null, "An input value must be entered.");
                }
                int numInNodes = java.lang.Integer.parseInt(inNodes);
                int y = 0;
                do {
                    Element node = new Element("NEURODE");
                    node.setAttribute(
                            new Attribute("N_ID", "IN" + String.valueOf(x + 1) + String.valueOf(y + 1)));
                    node.setAttribute(new Attribute("ACTIVE", "-1"));
                    node.setAttribute(new Attribute("ACTIVITY", "0.0"));
                    node.setAttribute(new Attribute("BIAS", "0.0"));
                    node.setAttribute(new Attribute("CNAME", "Input node#" + String.valueOf(y + 1)));
                    node.setAttribute(new Attribute("NNET_V4", "0.0"));
                    Element inSynapse = new Element("SYNAPSE");
                    inSynapse.setAttribute(new Attribute("WEIGHT", "1.00"));
                    inSynapse.setAttribute(new Attribute("ORG_NEURODE", "INPUT"));
                    node.addContent(inSynapse);
                    inLayer.addContent(node);
                    y++;
                } while (y < numInNodes);
                subnet.addContent(inLayer);
                x++;
            } while (x < numInLayers);

            String hidden_layers = JOptionPane.showInputDialog(jButton3,
                    "How many <<HIDDEN>> LAYERS(s) in this subnet?", "ANNeML Wizard",
                    JOptionPane.QUESTION_MESSAGE);
            if (hidden_layers == " ") {
                JOptionPane.showMessageDialog(null, "An input value must be entered.");
            }
            int numHLayers = java.lang.Integer.parseInt(hidden_layers);
            int z = 0;
            do {
                Element hLayer = new Element("LAYER");
                hLayer.setAttribute(new Attribute("LAYER_NAME", "HIDDEN"));
                String transferFunc = JOptionPane.showInputDialog(jButton3,
                        "Which transfer function for this LAYER? 1(hyberbolic tangent) or 2(logarithmic sigmoid)",
                        "ANNeML Wizard", JOptionPane.QUESTION_MESSAGE);
                if (transferFunc == " ") {
                    JOptionPane.showMessageDialog(null, "An input value must be entered.");
                }
                hLayer.setAttribute(new Attribute("TRANSFER_FUNCTION", transferFunc));
                String hNodes = JOptionPane.showInputDialog(jButton3,
                        "How many NEURODE(s) in this <<HIDDEN>> LAYER?", "ANNeML Wizard",
                        JOptionPane.QUESTION_MESSAGE);
                if (hNodes == " ") {
                    JOptionPane.showMessageDialog(null, "An input value must be entered.");
                }
                int numhNodes = java.lang.Integer.parseInt(hNodes);
                int a = 0;
                do {
                    Random rnd = new Random();
                    Element node = new Element("NEURODE");
                    node.setAttribute(
                            new Attribute("N_ID", "N" + String.valueOf(z + 1) + String.valueOf(a + 1)));
                    node.setAttribute(new Attribute("ACTIVE", "-1"));
                    node.setAttribute(new Attribute("ACTIVITY", "0.0"));
                    node.setAttribute(new Attribute("BIAS", getRandomValue(rnd, low, high, decpl)));
                    node.setAttribute(new Attribute("CNAME", "Hidden node#" + String.valueOf(a + 1)));
                    node.setAttribute(new Attribute("NNET_V4", "0.0"));
                    hLayer.addContent(node);
                    a++;
                } while (a < numhNodes);
                subnet.addContent(hLayer);
                z++;
            } while (z < numHLayers);

            String output_layers = JOptionPane.showInputDialog(jButton3,
                    "How many <<OUTPUT>> LAYERS(s) in this subnet?", "ANNeML Wizard",
                    JOptionPane.QUESTION_MESSAGE);
            if (hidden_layers == " ") {
                JOptionPane.showMessageDialog(null, "An input value must be entered.");
            }
            int numOLayers = java.lang.Integer.parseInt(output_layers);
            int b = 0;
            do {
                Element oLayer = new Element("LAYER");
                oLayer.setAttribute(new Attribute("LAYER_NAME", "OUTPUT"));
                String transferFunc = JOptionPane.showInputDialog(jButton3,
                        "Which transfer function for this LAYER? 1(hyberbolic tangent) or 2(logarithmic sigmoid)",
                        "ANNeML Wizard", JOptionPane.QUESTION_MESSAGE);
                if (transferFunc == " ") {
                    JOptionPane.showMessageDialog(null, "An input value must be entered.");
                }
                oLayer.setAttribute(new Attribute("TRANSFER_FUNCTION", transferFunc));
                String oNodes = JOptionPane.showInputDialog(jButton3,
                        "How many NEURODE(s) in this <<OUTPUT>> LAYER?", "ANNeML Wizard",
                        JOptionPane.QUESTION_MESSAGE);
                if (oNodes == " ") {
                    JOptionPane.showMessageDialog(null, "An input value must be entered.");
                }
                int numoNodes = java.lang.Integer.parseInt(oNodes);
                int d = 0;
                do {
                    Random rnd = new Random();
                    Element node = new Element("NEURODE");
                    node.setAttribute(
                            new Attribute("N_ID", "ON" + String.valueOf(b + 1) + String.valueOf(d + 1)));
                    node.setAttribute(new Attribute("ACTIVE", "-1"));
                    node.setAttribute(new Attribute("ACTIVITY", "0.0"));
                    node.setAttribute(new Attribute("BIAS", getRandomValue(rnd, low, high, decpl)));
                    node.setAttribute(new Attribute("CNAME", "Output node#" + String.valueOf(d + 1)));
                    node.setAttribute(new Attribute("NNET_V4", "0.0"));
                    oLayer.addContent(node);
                    d++;
                } while (d < numoNodes);
                subnet.addContent(oLayer);
                b++;
            } while (b < numOLayers);

            doc.getRootElement().addContent(subnet);
            i++;
        } while (i < numSubs);

        //generate fully interconnected SYNAPSE(s) for all NEURODE(s) within each SUBNET

        java.util.List subnets = XPath.newInstance("//SUBNET").selectNodes(doc);
        Iterator itSubslist = subnets.iterator();
        do {
            Element currentSnet = (Element) itSubslist.next();
            String snetName = currentSnet.getAttributeValue("SNET_NAME");
            //System.out.println(snetName);

            java.util.List Hnodes = XPath
                    .newInstance("//SUBNET[@SNET_NAME='" + snetName + "']/LAYER[@LAYER_NAME='HIDDEN']/NEURODE")
                    .selectNodes(doc);
            Iterator itHNodelist = Hnodes.iterator();
            do {
                Element node = (Element) itHNodelist.next();
                //System.out.println(node.getAttributeValue("N_ID"));
                java.util.List Inodes = XPath
                        .newInstance(
                                "//SUBNET[@SNET_NAME='" + snetName + "']/LAYER[@LAYER_NAME='INPUT']/NEURODE")
                        .selectNodes(doc);
                Iterator itNodelist = Inodes.iterator();
                do {
                    Element currentNode = (Element) itNodelist.next();
                    //System.out.println(currentNode.getAttributeValue("N_ID"));
                    Element hSynapse = new Element("SYNAPSE");
                    Random rnd = new Random();
                    hSynapse.setAttribute(new Attribute("WEIGHT", getRandomValue(rnd, low, high, decpl)));
                    hSynapse.setAttribute(new Attribute("ORG_NEURODE", currentNode.getAttributeValue("N_ID")));
                    node.addContent(hSynapse);
                } while (itNodelist.hasNext());
            } while (itHNodelist.hasNext());

            java.util.List Onodes = XPath
                    .newInstance("//SUBNET[@SNET_NAME='" + snetName + "']/LAYER[@LAYER_NAME='OUTPUT']/NEURODE")
                    .selectNodes(doc);
            Iterator itONodelist = Onodes.iterator();
            do {
                Element node = (Element) itONodelist.next();
                //System.out.println(node.getAttributeValue("N_ID"));
                java.util.List hnodes = XPath
                        .newInstance(
                                "//SUBNET[@SNET_NAME='" + snetName + "']/LAYER[@LAYER_NAME='HIDDEN']/NEURODE")
                        .selectNodes(doc);
                Iterator itNodelist = hnodes.iterator();
                do {
                    Element currentNode = (Element) itNodelist.next();
                    //System.out.println(currentNode.getAttributeValue("N_ID"));
                    Element hSynapse = new Element("SYNAPSE");
                    Random rnd = new Random();
                    hSynapse.setAttribute(new Attribute("WEIGHT", getRandomValue(rnd, low, high, decpl)));
                    hSynapse.setAttribute(new Attribute("ORG_NEURODE", currentNode.getAttributeValue("N_ID")));
                    node.addContent(hSynapse);
                } while (itNodelist.hasNext());
            } while (itONodelist.hasNext());

        } while (itSubslist.hasNext());

        // new XMLOutputter().output(doc, System.out);
        XMLOutputter xmlOutput = new XMLOutputter();

        // display nice nice
        xmlOutput.setFormat(Format.getPrettyFormat());
        xmlOutput.output(doc, System.out);
        xmlOutput.output(doc, new FileWriter(nnetName + ".xml"));

        System.out.println("File Saved!");

    } catch (Exception e) {
        System.out.println(e.getMessage());
    }

}

From source file:ac.simons.syndication.modules.atom.AtomModuleGenerator.java

License:BSD License

private void addLinks(final Element parent, final AtomContent content) {
    for (final Link link : content.getLinks()) {
        final Element e = new Element("link", ATOM_NS);

        if (!isBlank(link.getRel())) {
            e.setAttribute(new Attribute("rel", link.getRel()));
        }// w  w w .ja v a 2s .  co m
        if (!isBlank(link.getType())) {
            e.setAttribute(new Attribute("type", link.getType()));
        }
        if (!isBlank(link.getHref())) {
            e.setAttribute(new Attribute("href", link.getHref()));
        }
        if (!isBlank(link.getHreflang())) {
            e.setAttribute(new Attribute("hreflang", link.getHreflang()));
        }
        if (!isBlank(link.getTitle())) {
            e.setAttribute(new Attribute("title", link.getTitle()));
        }
        if (link.getLength() != 0) {
            e.setAttribute(new Attribute("length", Long.toString(link.getLength())));
        }
        parent.addContent(e);
    }
}

From source file:arquivo.ArquivoF.java

public String add(String confSenha, String loing, String senha, String nome) {
    if (confSenha.equals(senha) && !loing.equals("") && !nome.equals("") && !senha.equals("")) {
        if (0 != busca(nome, true, "funcinario").size() && buscaLong(loing).size() != 0)
            return "erro nome ja cadastrado";
        SAXBuilder builder = new SAXBuilder();
        try {/*from   w w w .  j  a  va  2  s.c  o  m*/
            Document doc = builder.build(arquivo);
            Element root = (Element) doc.getRootElement();

            Element funcionario = new Element("funcinario");

            Attribute nomeE = new Attribute("nome", nome);
            funcionario.setAttribute(nomeE);

            Element loingE = new Element("loing");
            loingE.setText(loing);
            funcionario.addContent(loingE);

            Element senhaE = new Element("senha");
            senhaE.setText(senha);
            funcionario.addContent(senhaE);

            root.addContent(funcionario);

            XMLOutputter xout = new XMLOutputter();
            OutputStream out = new FileOutputStream(arquivo);
            xout.output(doc, out);
            System.out.println("Documento alterado com sucesso!");

            return "cadastrado com suceso";
        } catch (Exception e) {

        }
    } else
        return "preemcha os compos corretamente";
    return "erro cadastral";
}

From source file:arquivo.ArquivoFilme.java

public String add(String nome, String faixa, String tipo) {
    if (0 != busca(nome, true, "filme").size())
        return "erro nome ja cadastrado";
    SAXBuilder builder = new SAXBuilder();
    try {/* w  w w  .  jav a 2s  . c  om*/
        Document doc = builder.build(arquivo);
        Element root = (Element) doc.getRootElement();

        Element filmeE = new Element("filme");

        Attribute nomeE = new Attribute("nome", nome);
        filmeE.setAttribute(nomeE);

        Attribute tipoE = new Attribute("tipo", tipo);
        filmeE.setAttribute(tipoE);

        Attribute faixaE = new Attribute("faixa", faixa);
        filmeE.setAttribute(faixaE);

        root.addContent(filmeE);

        XMLOutputter xout = new XMLOutputter();
        OutputStream out = new FileOutputStream(arquivo);
        xout.output(doc, out);
        System.out.println("Documento alterado com sucesso!");

        return "cadastrado com suceso";
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "erro cadastral";
}

From source file:arquivo.ArquivoFilme.java

public String addSesao(String nome, int numeroSala, int horaI, int mimI, int horaF, int mimF) {
    String retorno = "erro";
    if (!nome.equals("")) {
        if (this.confirnaSesao(numeroSala, horaI, mimI, horaF, mimF)) {
            SAXBuilder builder = new SAXBuilder();
            try {
                Document doc = builder.build(arquivo);
                Element root = (Element) doc.getRootElement();

                List<Element> filme = super.buscaInterna(root, true, nome, "filme");
                if (filme.size() == 0) {
                    return "erro filme n registrado";
                }//w w  w. j av  a  2 s  . com
                List<Element> salas = filme.get(0).getChildren("sala");

                Element secao = new Element("secao");
                secao.setAttribute(new Attribute("horaI", "" + horaI));
                secao.setAttribute(new Attribute("mimI", "" + mimI));
                secao.setAttribute(new Attribute("horaF", "" + horaF));
                secao.setAttribute(new Attribute("mimF", "" + mimF));

                boolean confirna = false;
                for (int i = 0; i < salas.size(); i++) {
                    if (salas.get(i).getAttributeValue("numeroSala").equals("" + numeroSala)) {
                        confirna = true;
                        salas.get(i).addContent(secao);
                        break;
                    }
                }
                if (!confirna) {
                    Element sala = new Element("sala");
                    sala.addContent(secao);
                    filme.get(0).addContent(sala);
                }

                XMLOutputter xout = new XMLOutputter();
                OutputStream out = new FileOutputStream(arquivo);
                xout.output(doc, out);
                System.out.println("Documento alterado com sucesso!");

                retorno = "cadastrado com suceso";
            } catch (Exception e) {

            }
        } else
            retorno = "nesse horario a sala estara ocupada";
    }
    return retorno;
}

From source file:by.epam.lw05.xml.ListToXml.java

private static Document listToDocument(List<Gun> guns) {
    Element root = new Element("arsenal", "tns", "http://www.example.com/Tarifes");
    root.addNamespaceDeclaration(Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"));
    Attribute attr = new Attribute("schemaLocation", "http://www.example.com/Tarifes myschema.xsd",
            Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"));
    root.setAttribute(attr);
    for (Gun gun : guns) {
        Element combatUnit = new Element("combatunit");

        combatUnit.setAttribute("serial", String.valueOf(gun.getSerial()));

        Element model = new Element("model");
        model.setText(gun.getModel());/*from w w  w. j a  v a  2  s  .  c  om*/
        combatUnit.addContent(model);

        Element handy = new Element("handy");
        handy.setText(gun.getHandy());
        combatUnit.addContent(handy);

        Element origin = new Element("origin");
        origin.setText(String.valueOf(gun.getOrigin()));
        combatUnit.addContent(origin);

        Element ttx = new Element("ttx");

        Element distance = new Element("distance");
        distance.setText(String.valueOf(gun.getDistance()));
        ttx.addContent(distance);

        Element optics = new Element("optics");
        optics.setText(String.valueOf(gun.isOptics()));
        ttx.addContent(optics);
        combatUnit.addContent(ttx);

        root.addContent(combatUnit);
    }
    return new Document(root);
}

From source file:ca.mcgill.cs.swevo.jayfx.model.AbstractElement.java

License:Open Source License

@Override
public Element getXML() {
    Element ret = new Element(IElement.class.getSimpleName());
    ret.setAttribute(new Attribute(IElement.ID, this.getId()));
    ret.addContent(this.getCategory().getXML());
    return ret;/*  ww w . j a  v a 2 s  . c  om*/
}

From source file:ca.nrc.cadc.ac.xml.AbstractReaderWriter.java

License:Open Source License

/**
 * Get a JDOM element from a Group object.
 *
 * @param group The UserRequest./* w  w  w. j  a  v a 2  s . c  o  m*/
 * @param deepCopy Return all Group elements.
 * @return A JDOM Group representation.
 * @throws WriterException
 */
protected final Element getElement(Group group, boolean deepCopy) throws WriterException {
    if (group == null) {
        throw new WriterException("null Group");
    }

    // Create the root group element.
    Element groupElement = new Element(GROUP);
    String groupURI = group.getID().toString();
    groupElement.setAttribute(new Attribute(URI, groupURI));

    // Group owner
    if (group.getOwner() != null) {
        Element ownerElement = new Element(OWNER);
        Element userElement = getElement(group.getOwner());
        ownerElement.addContent(userElement);
        groupElement.addContent(ownerElement);
    }

    if (deepCopy) {
        // Group description
        if (group.description != null) {
            Element descriptionElement = new Element(DESCRIPTION);
            descriptionElement.setText(group.description);
            groupElement.addContent(descriptionElement);
        }

        // lastModified
        if (group.lastModified != null) {
            Element lastModifiedElement = new Element(LAST_MODIFIED);
            DateFormat df = DateUtil.getDateFormat(DateUtil.IVOA_DATE_FORMAT, DateUtil.UTC);
            lastModifiedElement.setText(df.format(group.lastModified));
            groupElement.addContent(lastModifiedElement);
        }

        // Group properties
        if (!group.getProperties().isEmpty()) {
            Element propertiesElement = new Element(PROPERTIES);
            for (GroupProperty property : group.getProperties()) {
                propertiesElement.addContent(getElement(property));
            }
            groupElement.addContent(propertiesElement);
        }

        // Group groupMembers.
        if ((group.getGroupMembers() != null) && (!group.getGroupMembers().isEmpty())) {
            Element groupMembersElement = new Element(GROUP_MEMBERS);
            for (Group groupMember : group.getGroupMembers()) {
                groupMembersElement.addContent(getElement(groupMember, false));
            }
            groupElement.addContent(groupMembersElement);
        }

        // Group userMembers
        if ((group.getUserMembers() != null) && (!group.getUserMembers().isEmpty())) {
            Element userMembersElement = new Element(USER_MEMBERS);
            for (User userMember : group.getUserMembers()) {
                userMembersElement.addContent(getElement(userMember));
            }
            groupElement.addContent(userMembersElement);
        }

        // Group groupAdmins.
        if ((group.getGroupAdmins() != null) && (!group.getGroupAdmins().isEmpty())) {
            Element groupAdminsElement = new Element(GROUP_ADMINS);
            for (Group groupMember : group.getGroupAdmins()) {
                groupAdminsElement.addContent(getElement(groupMember, false));
            }
            groupElement.addContent(groupAdminsElement);
        }

        // Group userAdmins
        if ((group.getUserAdmins() != null) && (!group.getUserAdmins().isEmpty())) {
            Element userAdminsElement = new Element(USER_ADMINS);
            for (User userMember : group.getUserAdmins()) {
                userAdminsElement.addContent(getElement(userMember));
            }
            groupElement.addContent(userAdminsElement);
        }
    }

    return groupElement;
}

From source file:ca.nrc.cadc.vos.NodeWriter.java

License:Open Source License

/**
 * Build the properties Element of a Node.
 *
 * @param node Node./*  www .ja  v a2s.  co  m*/
 * @return properties Element.
 */
protected Element getPropertiesElement(Node node) {
    Element ret = new Element("properties", vosNamespace);
    for (NodeProperty nodeProperty : node.getProperties()) {
        Element property = new Element("property", vosNamespace);
        if (nodeProperty.isMarkedForDeletion())
            property.setAttribute(new Attribute("nil", "true", xsiNamespace));
        else
            property.setText(nodeProperty.getPropertyValue());
        property.setAttribute("uri", nodeProperty.getPropertyURI());
        property.setAttribute("readOnly", (nodeProperty.isReadOnly() ? "true" : "false"));
        ret.addContent(property);
    }
    return ret;
}

From source file:ca.nrc.cadc.vosi.TableSet.java

License:Open Source License

/**
 * @param cd/*from  w w  w .  j  a va 2 s . co m*/
 * @return
 */
private Element toXmlElement(ColumnDesc cd) {
    Element eleColumn = new Element("column");
    addChild(eleColumn, "name", cd.getColumnName());
    addChild(eleColumn, "description", cd.description);
    addChild(eleColumn, "unit", cd.unit);
    addChild(eleColumn, "ucd", cd.ucd);
    addChild(eleColumn, "utype", cd.utype);

    String datatype = cd.getDatatype();
    String[] parts = datatype.split(":");
    if (isTapType(parts)) {
        Element eleDt = addChild(eleColumn, "dataType", parts[1]);
        if (eleDt != null) {
            Attribute attType = new Attribute("type", vod.getPrefix() + ":TAPType", xsi);
            eleDt.setAttribute(attType);
            if (cd.getArraysize() != null && cd.getArraysize() > 0)
                eleDt.setAttribute("size", cd.getArraysize().toString());
        }
    } else if (isVOTableType(parts)) {
        Element eleDt = addChild(eleColumn, "dataType", parts[1]);
        if (eleDt != null) {
            Attribute attType = new Attribute("type", vod.getPrefix() + ":VOTableType", xsi);
            eleDt.setAttribute(attType);
            if (cd.getArraysize() != null && cd.getArraysize() > 0)
                eleDt.setAttribute("arraysize", cd.getArraysize().toString());
        }
    } else // custom type
    {
        log.warn("cannot convert " + cd + " to a legal VODataService column element, skipping");
        return null;
    }
    if (cd.indexed)
        addChild(eleColumn, "flag", "indexed");
    // TODO: flag=primary for primary keys? 

    return eleColumn;
}