Mercurial > hg > mpdl-group
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:408254cf2f1d |
---|---|
1 package de.mpg.mpiwg.berlin.mpdl.escidoc; | |
2 | |
3 public class Context { | |
4 private String organizationalUnit = "/oum/organizational-unit/escidoc:ex3"; | |
5 private String name = "MPDL-XML-Test"; | |
6 private String description = "MPDL-XML-Test"; | |
7 private String type = "MpdlType"; | |
8 | |
9 public Context(String organizationalUnit, String name, String description, String type) { | |
10 this.organizationalUnit = organizationalUnit; | |
11 this.name = name; | |
12 this.description = description; | |
13 this.type = type; | |
14 } | |
15 | |
16 public String toXmlString() { | |
17 StringBuilder str = new StringBuilder(); | |
18 str.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); | |
19 str.append("<context:context\n"); | |
20 str.append(" xmlns=\"http://www.escidoc.de/schemas/context/0.7\"\n"); | |
21 str.append(" xmlns:context=\"http://www.escidoc.de/schemas/context/0.7\"\n"); | |
22 str.append(" xmlns:prop=\"http://escidoc.de/core/01/properties/\"\n"); | |
23 str.append(" xmlns:srel=\"http://escidoc.de/core/01/structural-relations/\"\n"); | |
24 str.append(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"); | |
25 str.append(" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">\n"); | |
26 str.append(" <context:properties>\n"); | |
27 str.append(" <prop:name>" + name + "</prop:name>\n"); | |
28 str.append(" <prop:description>" + description + "</prop:description>\n"); | |
29 str.append(" <prop:type>" + type + "</prop:type>\n"); | |
30 if (organizationalUnit != null) { | |
31 str.append(" <prop:organizational-units>\n"); | |
32 str.append(" <srel:organizational-unit\n"); | |
33 str.append(" xlink:href=\"" + organizationalUnit + "\" />\n"); | |
34 str.append(" </prop:organizational-units>\n"); | |
35 } | |
36 str.append(" </context:properties>\n"); | |
37 str.append("</context:context>\n"); | |
38 return str.toString(); | |
39 } | |
40 } |