1 16 package org.apache.commons.jxpath.ri.model.beans; 17 18 import org.apache.commons.jxpath.ri.QName; 19 import org.apache.commons.jxpath.ri.compiler.NodeTest; 20 import org.apache.commons.jxpath.ri.model.NodePointer; 21 22 29 public class LangAttributePointer extends NodePointer { 30 public LangAttributePointer(NodePointer parent) { 31 super(parent); 32 } 33 34 public QName getName() { 35 return new QName("xml", "lang"); 36 } 37 38 public String getNamespaceURI() { 39 return null; 40 } 41 42 public boolean isCollection() { 43 return false; 44 } 45 46 public int getLength() { 47 return 1; 48 } 49 50 public Object getBaseValue() { 51 return parent.getLocale().toString().replace('_', '-'); 52 } 53 54 public Object getImmediateNode() { 55 return getBaseValue(); 56 } 57 58 public boolean isLeaf() { 59 return true; 60 } 61 62 65 public void setValue(Object value) { 66 throw new UnsupportedOperationException ( 67 "Cannot change locale using the 'lang' attribute"); 68 } 69 70 72 public String asPath() { 73 StringBuffer buffer = new StringBuffer (); 74 if (parent != null) { 75 buffer.append(parent.asPath()); 76 if (buffer.length() == 0 77 || buffer.charAt(buffer.length() - 1) != '/') { 78 buffer.append('/'); 79 } 80 } 81 buffer.append("@xml:lang"); 82 return buffer.toString(); 83 } 84 85 public int hashCode() { 86 return 0; 87 } 88 89 public boolean equals(Object object) { 90 if (object == this) { 91 return true; 92 } 93 94 if (!(object instanceof LangAttributePointer)) { 95 return false; 96 } 97 98 return true; 99 } 100 101 public boolean testNode(NodeTest test) { 102 return false; 103 } 104 105 public int compareChildNodePointers( 106 NodePointer pointer1, 107 NodePointer pointer2) 108 { 109 return 0; 111 } 112 } | Popular Tags |