Mercurial > hg > mpdl-group
view software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/escidoc/Context.java @ 0:408254cf2f1d
Erstellung
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 24 Nov 2010 17:24:23 +0100 |
parents | |
children |
line wrap: on
line source
package de.mpg.mpiwg.berlin.mpdl.escidoc; public class Context { private String organizationalUnit = "/oum/organizational-unit/escidoc:ex3"; private String name = "MPDL-XML-Test"; private String description = "MPDL-XML-Test"; private String type = "MpdlType"; public Context(String organizationalUnit, String name, String description, String type) { this.organizationalUnit = organizationalUnit; this.name = name; this.description = description; this.type = type; } public String toXmlString() { StringBuilder str = new StringBuilder(); str.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); str.append("<context:context\n"); str.append(" xmlns=\"http://www.escidoc.de/schemas/context/0.7\"\n"); str.append(" xmlns:context=\"http://www.escidoc.de/schemas/context/0.7\"\n"); str.append(" xmlns:prop=\"http://escidoc.de/core/01/properties/\"\n"); str.append(" xmlns:srel=\"http://escidoc.de/core/01/structural-relations/\"\n"); str.append(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"); str.append(" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">\n"); str.append(" <context:properties>\n"); str.append(" <prop:name>" + name + "</prop:name>\n"); str.append(" <prop:description>" + description + "</prop:description>\n"); str.append(" <prop:type>" + type + "</prop:type>\n"); if (organizationalUnit != null) { str.append(" <prop:organizational-units>\n"); str.append(" <srel:organizational-unit\n"); str.append(" xlink:href=\"" + organizationalUnit + "\" />\n"); str.append(" </prop:organizational-units>\n"); } str.append(" </context:properties>\n"); str.append("</context:context>\n"); return str.toString(); } }