/** * Check whether the content of an attribute is namespace-sensitive * * * @param type the type annotation of the node * @param nodeNr the the node number of the elemente * @throws XPathException if an error occurs */ private void checkNotNamespaceSensitiveAttribute(SimpleType type, int nodeNr) throws XPathException { if (type.isNamespaceSensitive()) { if (type.isAtomicType()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } else { // For a union or list type, we need to check whether the actual value is namespace-sensitive AtomicSequence value = tree.getTypedValueOfAttribute(null, nodeNr); for (AtomicValue val : value) { if (val.getPrimitiveType().isNamespaceSensitive()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } } } } }
/** * Check whether the content of an element is namespace-sensitive * * * @param type the type annotation of the node * @param nodeNr the the node number of the elemente * @throws XPathException if an error occurs */ protected void checkNotNamespaceSensitiveElement(SchemaType type, int nodeNr) throws XPathException { if (type instanceof SimpleType && ((SimpleType) type).isNamespaceSensitive()) { if (type.isAtomicType()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } else { // For a union or list type, we need to check whether the actual value is namespace-sensitive AtomicSequence value = tree.getTypedValueOfElement(nodeNr); for (AtomicValue val : value) { if (val.getPrimitiveType().isNamespaceSensitive()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } } } } }
/** * Check whether the content of an attribute is namespace-sensitive * * * @param type the type annotation of the node * @param nodeNr the the node number of the elemente * @throws XPathException if an error occurs */ private void checkNotNamespaceSensitiveAttribute(SimpleType type, int nodeNr) throws XPathException { if (type.isNamespaceSensitive()) { if (type.isAtomicType()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } else { // For a union or list type, we need to check whether the actual value is namespace-sensitive AtomicSequence value = tree.getTypedValueOfAttribute(null, nodeNr); for (AtomicValue val : value) { if (val.getPrimitiveType().isNamespaceSensitive()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } } } } }
/** * Get the typed value corresponding to a given string value, assuming it is * valid against this type (and that the containing node is not nilled) * * @param value the string value * @param resolver a namespace resolver used to resolve any namespace prefixes appearing * in the content of values. Can supply null, in which case any namespace-sensitive content * will be rejected. * @param rules the conversion rules to be used * @return an iterator over the atomic sequence comprising the typed value. The objects * returned by this SequenceIterator will all be of type {@link AtomicValue} * @throws ValidationException This method should be called only if it is known that the value is * valid. If the value is not valid, there is no guarantee that this method will perform validation, * but if it does detect a validity error, then it MAY throw a ValidationException. */ /*@NotNull*/ public AtomicSequence getTypedValue(CharSequence value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException { // Fast path for common cases if (fingerprint == StandardNames.XS_STRING) { return StringValue.makeStringValue(value); } else if (fingerprint == StandardNames.XS_UNTYPED_ATOMIC) { return new UntypedAtomicValue(value); } StringConverter converter = getStringConverter(rules); if (isNamespaceSensitive()) { converter = (StringConverter) converter.setNamespaceResolver(resolver); } return converter.convertString(value).asAtomic(); }
/** * Check whether the content of an element is namespace-sensitive * * * @param type the type annotation of the node * @param nodeNr the the node number of the elemente * @throws XPathException if an error occurs */ protected void checkNotNamespaceSensitiveElement(SchemaType type, int nodeNr) throws XPathException { if (type instanceof SimpleType && ((SimpleType) type).isNamespaceSensitive()) { if (type.isAtomicType()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } else { // For a union or list type, we need to check whether the actual value is namespace-sensitive AtomicSequence value = tree.getTypedValueOfElement(nodeNr); for (AtomicValue val : value) { if (val.getPrimitiveType().isNamespaceSensitive()) { throw new CopyNamespaceSensitiveException( "Cannot copy QName or NOTATION values without copying namespaces"); } } } } }
/** * Get the typed value corresponding to a given string value, assuming it is * valid against this type (and that the containing node is not nilled) * * @param value the string value * @param resolver a namespace resolver used to resolve any namespace prefixes appearing * in the content of values. Can supply null, in which case any namespace-sensitive content * will be rejected. * @param rules the conversion rules to be used * @return an iterator over the atomic sequence comprising the typed value. The objects * returned by this SequenceIterator will all be of type {@link AtomicValue} * @throws ValidationException This method should be called only if it is known that the value is * valid. If the value is not valid, there is no guarantee that this method will perform validation, * but if it does detect a validity error, then it MAY throw a ValidationException. */ /*@NotNull*/ public AtomicSequence getTypedValue(CharSequence value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException { // Fast path for common cases if (fingerprint == StandardNames.XS_STRING) { return StringValue.makeStringValue(value); } else if (fingerprint == StandardNames.XS_UNTYPED_ATOMIC) { return new UntypedAtomicValue(value); } StringConverter converter = getStringConverter(rules); if (isNamespaceSensitive()) { converter = (StringConverter) converter.setNamespaceResolver(resolver); } return converter.convertString(value).asAtomic(); }
/** * Get the typed value of a node that is annotated with this schema type. * * @param node the node whose typed value is required * @return the typed value. * @since 8.5 */ public AtomicSequence atomize(NodeInfo node) throws XPathException { // Fast path for common cases CharSequence stringValue = node.getStringValueCS(); if (stringValue.length() == 0 && node.isNilled()) { return AtomicArray.EMPTY_ATOMIC_ARRAY; } if (fingerprint == StandardNames.XS_STRING) { return StringValue.makeStringValue(stringValue); } else if (fingerprint == StandardNames.XS_UNTYPED_ATOMIC) { return new UntypedAtomicValue(stringValue); } StringConverter converter = stringConverter; if (converter == null) { converter = getStringConverter(node.getConfiguration().getConversionRules()); if (isNamespaceSensitive()) { converter = (StringConverter) converter.setNamespaceResolver(new InscopeNamespaceResolver(node)); } } return converter.convertString(stringValue).asAtomic(); }
/** * Get the typed value of a node that is annotated with this schema type. * * @param node the node whose typed value is required * @return the typed value. * @since 8.5 */ public AtomicSequence atomize(NodeInfo node) throws XPathException { // Fast path for common cases CharSequence stringValue = node.getStringValueCS(); if (stringValue.length() == 0 && node.isNilled()) { return AtomicArray.EMPTY_ATOMIC_ARRAY; } if (fingerprint == StandardNames.XS_STRING) { return StringValue.makeStringValue(stringValue); } else if (fingerprint == StandardNames.XS_UNTYPED_ATOMIC) { return new UntypedAtomicValue(stringValue); } StringConverter converter = stringConverter; if (converter == null) { converter = getStringConverter(node.getConfiguration().getConversionRules()); if (isNamespaceSensitive()) { converter = (StringConverter) converter.setNamespaceResolver(new InscopeNamespaceResolver(node)); } } return converter.convertString(stringValue).asAtomic(); }
if (converter == null) { converter = getStringConverter(rules); if (isNamespaceSensitive()) { if (nsResolver == null) { throw new UnsupportedOperationException("Cannot validate a QName without a namespace resolver");
if (converter == null) { converter = getStringConverter(rules); if (isNamespaceSensitive()) { if (nsResolver == null) { throw new UnsupportedOperationException("Cannot validate a QName without a namespace resolver");
if (isNamespaceSensitive()) { if (nsResolver == null) { throw new UnsupportedOperationException("Cannot validate a QName without a namespace resolver");
if (isNamespaceSensitive()) { if (nsResolver == null) { throw new UnsupportedOperationException("Cannot validate a QName without a namespace resolver");
if (isNamespaceSensitive()) { try { NamespaceResolver resolver = new InscopeNamespaceResolver(node);
if (isNamespaceSensitive()) { try { NamespaceResolver resolver = new InscopeNamespaceResolver(node);