/** * Notify an attribute. Attributes are notified after the startElement event, and before any * children. Namespaces and attributes may be intermingled. * * @param nameCode The name of the attribute * @param typeCode The type of the attribute * @param locationId the location of the node in the source, or of the instruction that created it * @param properties Bit significant value. The following bits are defined: * <dl> * <dd>DISABLE_ESCAPING</dd> <dt>Disable escaping for this attribute</dt> * <dd>NO_SPECIAL_CHARACTERS</dd> <dt>Attribute value contains no special characters</dt> * </dl> * @throws IllegalStateException: attempt to output an attribute when there is no open element * start tag */ public void attribute(NodeName nameCode, SimpleType typeCode, CharSequence value, Location locationId, int properties) throws XPathException { boolean documentLevel = level == 0 || isDocumentLevel[level - 1]; if (documentLevel || !inStartTag) { throw NoOpenStartTagException.makeNoOpenStartTagException( Type.ATTRIBUTE, nameCode.getDisplayName(), getPipelineConfiguration().getHostLanguage(), documentLevel, ExplicitLocation.UNKNOWN_LOCATION); } nextReceiver.attribute(nameCode, typeCode, value, locationId, properties); previousAtomic = false; }
public static NoOpenStartTagException makeNoOpenStartTagException( int nodeKind, String name, int hostLanguage, boolean parentIsDocument, boolean isSerializing) { String message; String errorCode; if (parentIsDocument) { if (isSerializing) { String kind = (nodeKind == Type.ATTRIBUTE ? "attribute" : "namespace"); String article = (nodeKind == Type.ATTRIBUTE ? "an " : "a "); if (hostLanguage == Configuration.XSLT ) { message = "Cannot have " + article + kind + " node (" + name + ") whose parent is a document node"; errorCode = "XTDE0420"; } else { message = "Cannot serialize a free-standing " + kind + " node (" + name + ')'; errorCode = "SENR0001"; } } else { String kind = (nodeKind == Type.ATTRIBUTE ? "an attribute" : "a namespace"); message = "Cannot create " + kind + " node (" + name + ") whose parent is a document node"; errorCode = (hostLanguage == Configuration.XSLT ? "XTDE0420" : "XPTY0004"); } } else { String kind = (nodeKind == Type.ATTRIBUTE ? "An attribute" : "A namespace"); message = kind + " node (" + name + ") cannot be created after the children of the containing element"; errorCode = (hostLanguage == Configuration.XSLT ? "XTDE0410" : "XQTY0024"); } NoOpenStartTagException err = new NoOpenStartTagException(message); err.setErrorCode(errorCode); return err; }
CopyOf.copyAttribute(source, getSchemaType(), validation, this, c2, false); } catch (NoOpenStartTagException err) { err.setXPathContext(context); throw dynamicError(this, err, c2); source.copy(out, NodeInfo.NO_NAMESPACES, false, locationId); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCode(err.getErrorCodeLocalPart()); throw dynamicError(this, e, context);
CopyOf.copyAttribute(source, (SimpleType) getSchemaType(), getValidationAction(), this, context, false); } catch (NoOpenStartTagException err) { err.setXPathContext(context); throw dynamicError(getLocation(), err, context); source.copy(out, 0, getLocation()); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCodeQName(err.getErrorCodeQName()); throw dynamicError(getLocation(), e, context);
copyAttribute(source, schemaType, validation, this, context, rejectDuplicateAttributes); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setLocator(this); e.setXPathContext(context); e.setErrorCode(err.getErrorCodeLocalPart()); throw dynamicError(this, e, context); source.copy(out, NodeInfo.NO_NAMESPACES, false, locationId); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCode(err.getErrorCodeLocalPart());
copyAttribute(item, (SimpleType) schemaType, validation, this, context, rejectDuplicateAttributes); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setLocation(getLocation()); e.setXPathContext(context); e.setErrorCodeQName(err.getErrorCodeQName()); throw dynamicError(getLocation(), e, context); item.copy(out, 0, getLocation()); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCodeQName(err.getErrorCodeQName()); throw dynamicError(getLocation(), e, context);
CopyOf.copyAttribute(source, getSchemaType(), validation, this, c2, false); } catch (NoOpenStartTagException err) { err.setXPathContext(context); throw dynamicError(this, err, c2); source.copy(out, NodeInfo.NO_NAMESPACES, false, locationId); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCode(err.getErrorCodeLocalPart()); throw dynamicError(this, e, context);
CopyOf.copyAttribute(source, (SimpleType) getSchemaType(), getValidationAction(), this, context, false); } catch (NoOpenStartTagException err) { err.setXPathContext(context); throw dynamicError(getLocation(), err, context); source.copy(out, 0, getLocation()); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCodeQName(err.getErrorCodeQName()); throw dynamicError(getLocation(), e, context);
copyAttribute(source, schemaType, validation, this, context, rejectDuplicateAttributes); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setLocator(this); e.setXPathContext(context); e.setErrorCode(err.getErrorCodeLocalPart()); throw dynamicError(this, e, context); source.copy(out, NodeInfo.NO_NAMESPACES, false, locationId); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCode(err.getErrorCodeLocalPart());
copyAttribute(item, (SimpleType) schemaType, validation, this, context, rejectDuplicateAttributes); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setLocation(getLocation()); e.setXPathContext(context); e.setErrorCodeQName(err.getErrorCodeQName()); throw dynamicError(getLocation(), e, context); item.copy(out, 0, getLocation()); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCodeQName(err.getErrorCodeQName()); throw dynamicError(getLocation(), e, context);
public void namespace(int namespaceCode, int properties) throws XPathException { if (!acceptAttributes) { throw NoOpenStartTagException.makeNoOpenStartTagException( Type.NAMESPACE, getNamePool().getPrefixFromNamespaceCode(namespaceCode), getPipelineConfiguration().getHostLanguage(), inDocument, false); } // avoid duplicates for (int n=0; n<countStack[depth - 1]; n++) { if (namespaces[namespacesSize - 1 - n] == namespaceCode) { return; } } addToStack(namespaceCode); countStack[depth - 1]++; }
CopyOf.copyAttribute(source, getSchemaType(), validation, this, c2, false); } catch (NoOpenStartTagException err) { err.setXPathContext(context); throw dynamicError(this, err, c2); source.copy(out, NodeInfo.NO_NAMESPACES, false, locationId); } catch (NoOpenStartTagException err) { XPathException e = new XPathException(err.getMessage()); e.setXPathContext(context); e.setErrorCode(err.getErrorCodeLocalPart()); throw dynamicError(this, e, context);
errorCode = (hostLanguage == Configuration.XSLT ? "XTDE0410" : "XQTY0024"); NoOpenStartTagException err = new NoOpenStartTagException(message); err.setErrorCode(errorCode); return err;
/** * Notify a namespace. Namespaces are notified <b>after</b> the startElement event, and before * any children for the element. The namespaces that are reported are only required * to include those that are different from the parent element; however, duplicates may be reported. * A namespace must not conflict with any namespaces already used for element or attribute names. * * @param namespaceBindings the prefix/uri pair * @throws IllegalStateException: attempt to output a namespace when there is no open element * start tag */ public void namespace(NamespaceBindingSet namespaceBindings, int properties) throws XPathException { boolean documentLevel = level == 0 || isDocumentLevel[level - 1]; if (documentLevel || !inStartTag) { //noinspection LoopStatementThatDoesntLoop for (NamespaceBinding ns : namespaceBindings) { // Throw an exception if there is an least one namespace binding in the set throw NoOpenStartTagException.makeNoOpenStartTagException( Type.NAMESPACE, ns.getPrefix(), getPipelineConfiguration().getHostLanguage(), documentLevel, ExplicitLocation.UNKNOWN_LOCATION); } } nextReceiver.namespace(namespaceBindings, properties); previousAtomic = false; }
StandardErrorListener.abbreviatePath(startElementLocationId.getSystemId()); NoOpenStartTagException err = new NoOpenStartTagException(message); err.setErrorCode(errorCode); return err;
public void namespace(int namespaceCode, int properties) throws XPathException { if (!acceptAttributes) { throw NoOpenStartTagException.makeNoOpenStartTagException( Type.NAMESPACE, getNamePool().getPrefixFromNamespaceCode(namespaceCode), getPipelineConfiguration().getHostLanguage(), inDocument, false); } // avoid duplicates for (int n=0; n<countStack[depth - 1]; n++) { if (namespaces[namespacesSize - 1 - n] == namespaceCode) { return; } } addToStack(namespaceCode); countStack[depth - 1]++; }
StandardErrorListener.abbreviatePath(startElementLocationId.getSystemId()); NoOpenStartTagException err = new NoOpenStartTagException(message); err.setErrorCode(errorCode); return err;
/** * Notify a namespace. Namespaces are notified <b>after</b> the startElement event, and before * any children for the element. The namespaces that are reported are only required * to include those that are different from the parent element; however, duplicates may be reported. * A namespace must not conflict with any namespaces already used for element or attribute names. * * @param namespaceBindings the prefix/uri pair * @throws IllegalStateException: attempt to output a namespace when there is no open element * start tag */ public void namespace(NamespaceBindingSet namespaceBindings, int properties) throws XPathException { boolean documentLevel = level == 0 || isDocumentLevel[level - 1]; if (documentLevel || !inStartTag) { //noinspection LoopStatementThatDoesntLoop for (NamespaceBinding ns : namespaceBindings) { // Throw an exception if there is an least one namespace binding in the set throw NoOpenStartTagException.makeNoOpenStartTagException( Type.NAMESPACE, ns.getPrefix(), getPipelineConfiguration().getHostLanguage(), documentLevel, ExplicitLocation.UNKNOWN_LOCATION); } } nextReceiver.namespace(namespaceBindings, properties); previousAtomic = false; }
public void namespace(NamespaceBindingSet namespaceBindings, int properties) throws XPathException { for (NamespaceBinding ns : namespaceBindings) { if (!acceptAttributes) { throw NoOpenStartTagException.makeNoOpenStartTagException( Type.NAMESPACE, ns.getPrefix(), getPipelineConfiguration().getHostLanguage(), inDocument, ExplicitLocation.UNKNOWN_LOCATION); } // avoid duplicates for (int n = 0; n < countStack[depth - 1]; n++) { if (namespaces[namespacesSize - 1 - n].equals(namespaceBindings)) { return; } } addToStack(ns); countStack[depth - 1]++; } }
XPathException err = NoOpenStartTagException.makeNoOpenStartTagException( Type.ATTRIBUTE, attName.getDisplayName(),