AnonymousQNameRule.java

00001 
00025 package org.objectweb.jonas_lib.deployment.rules;
00026 
00027 import javax.xml.namespace.QName;
00028 
00029 import org.objectweb.jonas_lib.deployment.xml.Qname;
00030 
00031 
00036 public class AnonymousQNameRule extends QNameRule {
00037 
00051     public void body(String namespace, String name, String text) {
00052 
00053         // Check that there the value of the element is not null
00054         if (text == null) {
00055             throw new IllegalArgumentException("No QName found in the body of the tag " + name);
00056         }
00057 
00058         // Extract namespace and localpart
00059         int colonIndex = text.lastIndexOf(":");
00060         if (colonIndex == -1) {
00061             throw new IllegalArgumentException("QName must be on the form namespace:localpart for element " + name);
00062         }
00063         String namespaceURI = text.substring(0, colonIndex);
00064         String localPart = text.substring(colonIndex + 1, text.length());
00065 
00066         // Build QName
00067         QName qName = new QName(namespaceURI, localPart);
00068 
00069         // Add this QName to the element at the top of the stack
00070         Qname qNameObject = (Qname) digester.peek();
00071         qNameObject.setName(name);
00072         qNameObject.setQName(qName);
00073 
00074     }
00075 
00076 }

Generated on Tue Feb 15 15:05:50 2005 for JOnAS by  doxygen 1.3.9.1