Hi,

Currently there is no support Lang Alt values in XMP Schemas created
with the classes in com.lowagie.text.xml.xmp.

I created a little patch which creates initial support for Lang Alt
values. It creates the new Class com.lowagie.text.xml.xmp.LangAlt and
changes the XmpSchema class to support values of type LangAlt.

What do you think of this?

Regards,
Armin

Index: com/lowagie/text/xml/xmp/XmpSchema.java
===================================================================
RCS file: /cvsroot/itext/src/com/lowagie/text/xml/xmp/XmpSchema.java,v
retrieving revision 1.6
diff -u -r1.6 XmpSchema.java
--- com/lowagie/text/xml/xmp/XmpSchema.java     15 Sep 2006 23:37:37 -0000      
1.6
+++ com/lowagie/text/xml/xmp/XmpSchema.java     15 May 2007 09:02:51 -0000
@@ -126,6 +126,17 @@
        public synchronized Object setProperty(String key, XmpArray value) {
                return super.setProperty(key, value.toString());
        }
+       
+       /**
+        * @see java.util.Properties#setProperty(java.lang.String, 
java.lang.String)
+        * 
+        * @param key
+        * @param value
+        * @return the previous property (null if there wasn't one)
+        */
+       public synchronized Object setProperty(String key, LangAlt value) {
+               return super.setProperty(key, value.toString());
+       }
        /**
         * @param content
         * @return an escaped string
Index: com/lowagie/text/xml/xmp/LangAlt.java
===================================================================
RCS file: com/lowagie/text/xml/xmp/LangAlt.java
diff -N com/lowagie/text/xml/xmp/LangAlt.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ com/lowagie/text/xml/xmp/LangAlt.java       1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,41 @@
+package com.lowagie.text.xml.xmp;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+public class LangAlt extends Properties {
+
+       public static String DEFAULT = "x-default";
+       
+       public LangAlt(String defaultValue) {
+               super();
+               addLanguage(DEFAULT, defaultValue);
+       }
+       
+       public LangAlt() {
+               super();
+       }
+       
+       public void addLanguage(String language, String value) {
+               setProperty(language, XmpSchema.escape(value));
+       }
+       
+       protected void process(StringBuffer buf, Object lang) {
+               buf.append("<rdf:li xml:lang=\"");
+               buf.append(lang);
+               buf.append("\" >");
+               buf.append(get(lang));
+               buf.append("</rdf:li>");
+       }
+       
+       public String toString() {
+               StringBuffer sb = new StringBuffer();
+               sb.append("<rdf:Alt>");
+               for (Enumeration e = this.propertyNames(); e.hasMoreElements(); 
) {
+                       process(sb, e.nextElement());
+               }
+               sb.append("</rdf:Alt>");
+               return sb.toString();
+       }
+       
+}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to