Example| key |
value |
default |
| VocabularyFile |
<location of the vocabulary file> |
./conf/lom-vocbulary.txt |
| DTDLocation |
<location of the dtd> |
http://www.multibook.de/xml/lom1.dtd |
| Validation |
true/false |
true |
| JaxpProperty |
<class name of the class implementing the
apropriate jaxp-Interface> |
|
import kom.lom.model.*;Step2:
import kom.lom.editor.*;
import kom.lom.exceptions.*;
//use default values
KOMLOMEngine engine = new KOMLOMEngine(null);
| method |
description |
| createLOM() |
creates an empty KOMLOMDataModel object |
| createLOM(KOMLOMDataModel lommod) |
returns a deep copy of the KOMLOMDataModel
object passed as parameter |
| createLOM(InputStream is) |
Create a LOM data model by parsing the input
stream. Note: The InputStream must contain a xmlL description acording to the LOM DTD found at http://www.multibook.de/xml/lom1.dtd Note2: The location for the DTD is taken from the KOMLOMEnvironemnt passed during creation of this object. |
KOMLOMDataModel emptyModel = engine.createLOM();Step3:
//create a File Handle for a xml file containing a LOM description;
//create an InputStream object for this handle
//and pass it as an agurment to the createLOM(InputStream is) method
String fileName = "./examples/ethernet.lom";
InputStream fi = new FileInputStream(fileName);
KOMLOMDataModel xmlModel = engine.createLOM(is);
KOMLOMDataElement root = emptyModel.getRootElement();
//generate a KOMLOMDataElement representing the general category
KOMLOMDataElement gen = root.getElement("general",true,null);
//generate a KOMLOMDataElement representing the technical category
//we could use the same method as with generating the general category, but we use the other way now
KOMLOMDataElement tech = engine.createDataElement("technical",null);
engine.addElement(tech);
//let's add a title element and a structure element to the general obejct
KOMLOMDataElement title = gen.getElement("title",true,null);
KOMLOMDataElement stru = gen.getElement("structure",true,null);
//the title element contains Langstring elements and the getElement method even works with arrays
KOMLOMDataElement titlelang = title.getElement("langstring",true,null);
//an instance of a langstring object contains two KOMLOMDataValue objects representing the language identifier and the value
//we will generate and set them now
KOMLOMDataValue val1 = titlelang.getValue("lang",true);
KOMLOMDataValue val2 = titlelang.getValue("data",true);
val1.setData("en");
val2.setData("this is an english test title");
//the structure element contains a vocabulary element, so we need to create parameters first
Object[] params = new Object[] { "GENERAL.STRUCTURE" };
KOMLOMDataElement struvoc = stru.getElement("structure",true,params);
//for setting and getting the values for the Structure element, we can use methods offered by an instance of a Vocbaulary element
((Vocabulary) struvoc).setEntryWithStringVocabulary("Sammlung","de");
//this will result in the following xml representation
//<structure><vocabulary><vocentry>0</vocentry></vocabulary></structure>
// calling ((Vocabulary) struvoc).setEntryWithStringVocabulary("Collection","en"); would do the same
String v = ((Vocabulary)struvoc).getEntryAsString("en");
//v contains the value "Collection"
| key |
value |
default |
| Language |
<language for the labels and text fields>
(String) |
none |
| ClassificationFolder |
<location of the classification files> |
"./classifications" |
| Categories |
<enumeration of the categories to display>
(java.util.Hashset) |
{ general, technical, educational, metametadata,
annotation, relation, lifecycle, classification } |
// We need some parameters to initalize the Panel
Hashtable h= new Hashtable().put("Language","en);
KOMLOMPanel editorPanel = engine.getEditorPanel(root,h);