1 50 51 package com.lowagie.text.xml.xmp; 52 53 import java.util.Enumeration ; 54 import java.util.Properties ; 55 56 public class LangAlt extends Properties { 57 58 59 private static final long serialVersionUID = 4396971487200843099L; 60 61 62 public static final String DEFAULT = "x-default"; 63 64 65 public LangAlt(String defaultValue) { 66 super(); 67 addLanguage(DEFAULT, defaultValue); 68 } 69 70 71 public LangAlt() { 72 super(); 73 } 74 75 78 public void addLanguage(String language, String value) { 79 setProperty(language, XmpSchema.escape(value)); 80 } 81 82 85 protected void process(StringBuffer buf, Object lang) { 86 buf.append("<rdf:li xml:lang=\""); 87 buf.append(lang); 88 buf.append("\" >"); 89 buf.append(get(lang)); 90 buf.append("</rdf:li>"); 91 } 92 93 96 public String toString() { 97 StringBuffer sb = new StringBuffer (); 98 sb.append("<rdf:Alt>"); 99 for (Enumeration e = this.propertyNames(); e.hasMoreElements();) { 100 process(sb, e.nextElement()); 101 } 102 sb.append("</rdf:Alt>"); 103 return sb.toString(); 104 } 105 106 } | Popular Tags |