@Override public StringToNonStringDerivedType setNamespaceResolver(NamespaceResolver resolver) { return new StringToNonStringDerivedType( (StringConverter) phaseOne.setNamespaceResolver(resolver), (DownCastingConverter) phaseTwo.setNamespaceResolver(resolver)); }
@Override public StringToNonStringDerivedType setNamespaceResolver(NamespaceResolver resolver) { return new StringToNonStringDerivedType( (StringConverter) phaseOne.setNamespaceResolver(resolver), (DownCastingConverter) phaseTwo.setNamespaceResolver(resolver)); }
/** * 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 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(); }
throw new UnsupportedOperationException("Cannot validate a QName without a namespace resolver"); converter = (StringConverter) converter.setNamespaceResolver(nsResolver); ConversionResult result = converter.convertString(value); if (result instanceof ValidationFailure) {
throw new UnsupportedOperationException("Cannot validate a QName without a namespace resolver"); converter = (StringConverter) converter.setNamespaceResolver(nsResolver); ConversionResult result = converter.convertString(value); if (result instanceof ValidationFailure) {
StringConverter sc = a1.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a1 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver); StringConverter sc = a0.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a0 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver);
StringConverter sc = a1.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a1 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver); StringConverter sc = a0.getItemType().getPrimitiveItemType().getStringConverter(rules); if (a0 instanceof QualifiedNameValue) { sc = (StringConverter) sc.setNamespaceResolver(nsResolver);