Changeset 4537


Ignore:
Timestamp:
2003-06-10T14:04:25+12:00 (21 years ago)
Author:
mdewsnip
Message:

Added a new addElement which takes a language as well as a name. This replaces the old addElement, which just takes a name (and has been deprecated).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataSet.java

    r4504 r4537  
    179179     * @param name The name of this element as a <strong>String</strong>.
    180180     * @return An <strong>ElementWrapper</strong> around the newly created element or null if the element was not created.
     181     * @deprecated All elements should be created with a language.
    181182     */
    182183    public ElementWrapper addElement(String name) {
     
    194195    }
    195196
     197    public ElementWrapper addElement(String name, String language)
     198    {
     199    Text text = document.createTextNode(name);
     200    Element identifier = document.createElementNS("","Attribute");
     201    identifier.setAttribute("name","identifier");
     202    identifier.setAttribute("language", language);
     203    identifier.appendChild(text);
     204    Element element = document.createElementNS("","Element");
     205    element.setAttribute("name",name);
     206    element.appendChild(identifier);
     207    root.appendChild(element);
     208    return new ElementWrapper(element);
     209    }
     210   
    196211    /** Method to add a new metadata element to this metadata set, if and only if the element is not already present.
    197212     * @param others_element An <strong>Element</strong> we wish to add to this metadata set, that currently belongs to some other set.
Note: See TracChangeset for help on using the changeset viewer.