1 16 17 package org.apache.xerces.impl.dv.dtd; 18 19 import org.apache.xerces.impl.dv.*; 20 import org.apache.xerces.util.XML11Char; 21 22 45 public class XML11IDDatatypeValidator extends IDDatatypeValidator { 46 47 public XML11IDDatatypeValidator() { 49 super(); 50 } 51 52 62 public void validate(String content, ValidationContext context) throws InvalidDatatypeValueException { 63 64 if(context.useNamespaces()) { 66 if (!XML11Char.isXML11ValidNCName(content)) { 67 throw new InvalidDatatypeValueException("IDInvalidWithNamespaces", new Object []{content}); 68 } 69 } 70 else { 71 if (!XML11Char.isXML11ValidName(content)) { 72 throw new InvalidDatatypeValueException("IDInvalid", new Object []{content}); 73 } 74 } 75 76 if (context.isIdDeclared(content)) { 77 throw new InvalidDatatypeValueException("IDNotUnique", new Object []{content}); 78 } 79 80 context.addId(content); 81 } 82 83 } 84 85 | Popular Tags |