1 16 17 package org.apache.xerces.impl.dv.dtd; 18 19 import org.apache.xerces.impl.dv.*; 20 import org.apache.xerces.util.XMLChar; 21 22 41 public class IDREFDatatypeValidator implements DatatypeValidator { 42 43 public IDREFDatatypeValidator() { 45 } 46 47 57 public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException { 58 59 if(context.useNamespaces()) { 61 if (!XMLChar.isValidNCName(content)) { 62 throw new InvalidDatatypeValueException("IDREFInvalidWithNamespaces", new Object []{content}); 63 } 64 } 65 else { 66 if (!XMLChar.isValidName(content)) { 67 throw new InvalidDatatypeValueException("IDREFInvalid", new Object []{content}); 68 } 69 } 70 71 context.addIdRef(content); 72 73 } 74 75 } 76 | Popular Tags |