1 package net.sf.saxon.value; 2 3 import net.sf.saxon.expr.XPathContext; 4 import net.sf.saxon.trans.XPathException; 5 import net.sf.saxon.type.BuiltInAtomicType; 6 import net.sf.saxon.type.ItemType; 7 import net.sf.saxon.type.Type; 8 import net.sf.saxon.type.ValidationException; 9 import net.sf.saxon.ConversionContext; 10 11 12 15 16 public final class NotationValue extends QNameValue { 17 18 25 26 public NotationValue(String prefix, String uri, String localName) throws XPathException { 27 super(prefix, uri, localName); 28 } 29 30 36 37 public AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, ConversionContext conversion) { 38 switch (requiredType.getPrimitiveType()) { 39 case Type.ATOMIC: 40 case Type.ITEM: 41 case Type.QNAME: 42 case Type.STRING: 43 case Type.UNTYPED_ATOMIC: 44 return super.convertPrimitive(requiredType, validate, conversion); 45 default: 46 ValidationException err = new ValidationException("Cannot convert NOTATION to " + 47 requiredType.getDisplayName()); 48 err.setErrorCode("FORG0001"); 50 return new ValidationErrorValue(err); 51 } 52 } 53 54 58 59 public ItemType getItemType() { 60 return Type.NOTATION_TYPE; 61 } 62 63 64 68 69 public String toString() { 70 return "NOTATION(" + getClarkName() + ')'; 71 } 72 73 } 74 75 93 | Popular Tags |