private AttributeCollectionImpl copyAttributeCollection(AttributeCollection in) { AttributeCollectionImpl out = new AttributeCollectionImpl(getNamePool()); for (int i = 0; i < in.getLength(); i++) { out.addAttribute(in.getNameCode(i), in.getTypeAnnotation(i), in.getValue(i), in.getLocationId(i), in.getProperties(i)); } return out; }
public QName getAttributeName(int i) { try { AttributeCollection atts = provider.getAttributes(); return new QName(atts.getURI(i), atts.getLocalName(i), atts.getPrefix(i)); } catch (XPathException e) { pendingException = e; return new QName("http://saxon.sf.net/error", "error", ""); } }
/** * Construct an Attribute node for the n'th attribute of a given element * @param element The element containing the relevant attribute * @param index The index position of the attribute starting at zero */ public AttributeImpl(ElementImpl element, int index) { parent = element; this.index = index; AttributeCollection atts = element.getAttributeList(); this.nameCode = atts.getNameCode(index); this.value = atts.getValue(index); this.typeCode = atts.getTypeAnnotation(index); }
for (int a = 0; a < atts.getLength(); a++) { if (atts.getURI(a).isEmpty()) { String f = atts.getQName(a); if (f.equals("match")) { matchAtt = atts.getValue(a); } else if (f.equals("select")) { newValueAtt = atts.getValue(a); select = makeExpression(newValueAtt, a); } else if (f.equals("phase")) { String phaseAtt = Whitespace.trim(atts.getValue(a)); if ("start".equals(phaseAtt)) { postDescent = false; checkUnknownAttribute(atts.getNodeName(a)); } else if (atts.getURI(a).equals(NamespaceConstant.SAXON)) { if (atts.getLocalName(a).equals("capture")) { capture = processBooleanAttribute("saxon:capture", atts.getValue(a)); } else { checkUnknownAttribute(atts.getNodeName(a)); checkUnknownAttribute(atts.getNodeName(a));
public void prepareAttributes() throws XPathException { String selectAtt = null; AttributeCollection atts = getAttributeList(); for (int a = 0; a < atts.getLength(); a++) { String f = atts.getQName(a); if (f.equals("select")) { selectAtt = atts.getValue(a); select = makeExpression(selectAtt, a); } else { checkUnknownAttribute(atts.getNodeName(a)); } } }
private void processShadowAttributes(NodeName elemName, Location location, URI baseUri) throws XPathException { AttributeCollection atts = startTag.getAllAttributes(); for (int a=0; a<atts.getLength(); a++) { String local = atts.getLocalName(a); String uri = atts.getURI(a); if (local.startsWith("_") && (uri.isEmpty() || uri.equals(NamespaceConstant.SAXON)) && local.length() >= 2) { String value = atts.getValue(a); AttributeLocation attLocation = new AttributeLocation(elemName.getStructuredQName(), atts.getNodeName(a).getStructuredQName(), location); String newValue = processShadowAttribute(value, baseUri.toString(), attLocation); String plainName = local.substring(1); NodeName newName = uri.isEmpty() ? new NoNamespaceName(plainName) : new FingerprintedQName(atts.getPrefix(a), NamespaceConstant.SAXON, plainName); // if a corresponding attribute exists with no underscore, overwrite it. The attribute() // method ensures that the shadow attribute won't be passed down the pipeline. // Otherwise overwrite the shadow attribute itself. int index = atts.getIndex("", plainName); if (index == -1) { index = a; } ((AttributeCollectionImpl)atts).setAttribute( index, newName, BuiltInAtomicType.UNTYPED_ATOMIC, newValue, atts.getLocation(a), 0); } } }
/** * Delete this node (that is, detach it from its parent) */ public void delete() { DocumentImpl root = getPhysicalRoot(); super.delete(); if (root != null) { AxisIterator iter = iterateAxis(AxisInfo.DESCENDANT_OR_SELF, NodeKindTest.ELEMENT); while (true) { ElementImpl n = (ElementImpl) iter.next(); int atts = attributeList.getLength(); for (int index = 0; index < atts; index++) { if (attributeList.isId(index)) { root.deregisterID(attributeList.getValue(index)); } } if (n == null) { break; } root.deIndex(n); } } }
int num = atts.getLength(); int fp = atts.getFingerprint(i); String attURI = namePool.getURI(fp); inheritNamespaces = processBooleanAttribute("xsl:inherit-namespaces", atts.getValue(i)); } else if (forwardsCompatibleModeIsEnabled()) { Err.wrap(atts.getNodeName(i).getDisplayName(), Err.ATTRIBUTE), "XTSE0805"); attributeNames[numberOfAttributes] = new FingerprintedQName(atts.getPrefix(i), atts.getURI(i), atts.getLocalName(i), fp); Expression exp = makeAttributeValueTemplate(atts.getValue(i), i); attributeValues[numberOfAttributes] = exp; numberOfAttributes++;
public void prepareAttributes() throws XPathException { AttributeCollection atts = getAttributeList(); for (int a=0; a<atts.getLength(); a++) { int nc = atts.getNameCode(a); checkUnknownAttribute(nc); } }
for (int i = 0; i < atts.getLength(); i++) { out.attribute(atts.getNodeName(i), atts.getTypeAnnotation(i), atts.getValue(i), loc, atts.getProperties(i));
public void prepareAttributes() throws XPathException { AttributeCollection atts = getAttributeList(); for (int a = 0; a < atts.getLength(); a++) { checkUnknownAttribute(atts.getNodeName(a)); } }
public void prepareAttributes() throws XPathException { AttributeCollection atts = getAttributeList(); for (int a=0; a<atts.getLength(); a++) { int nc = atts.getNameCode(a); String f = getNamePool().getClarkName(nc); if (f==StandardNames.NAME) { nameAttribute = Whitespace.trim(atts.getValue(a)); } else { checkUnknownAttribute(nc); } } if (nameAttribute==null) { reportAbsence("name"); } }
index = attlist.getIndexByFingerprint(test.getFingerprint()); length = attlist.getLength(); advance();
/** * Get the value of a given attribute of this node * * @param uri the namespace URI of the attribute name, or "" if the attribute is not in a namepsace * @param localName the local part of the attribute name * @return the attribute value if it exists or null if not */ /*@Nullable*/ public String getAttributeValue(/*@NotNull*/ String uri, /*@NotNull*/ String localName) { return attributeList == null ? null : attributeList.getValue(uri, localName); }
/** * Get the type annotation * * @return the type annotation of the node, if any */ public SchemaType getSchemaType() { return ((ElementImpl) getRawParent()).getAttributeList().getTypeAnnotation(getSiblingPosition()); }
public String getAttributePrefix(int i) { try { return provider.getAttributes().getPrefix(i); } catch (XPathException e) { pendingException = e; return ""; } }
public String getAttributeLocalName(int i) { try { return provider.getAttributes().getLocalName(i); } catch (XPathException e) { pendingException = e; return "error"; } }
public String getAttributeNamespace(int i) { try { return provider.getAttributes().getURI(i); } catch (XPathException e) { pendingException = e; return "http://saxon.sf.net/error"; } }
/** * Determine whether this node has the is-idref property * * @return true if the node is an IDREF or IDREFS element or attribute */ public boolean isIdref() { AttributeCollection alist = ((ElementImpl) getRawParent()).getAttributeList(); if ((alist.getProperties(getSiblingPosition()) & ReceiverOptions.IS_IDREF) != 0) { return true; } try { return getSchemaType().isIdRefType(); } catch (MissingComponentException e) { return false; } }