Refine search
QName qname, XMLAttributes attributes) { this.element = element; this.qname = new QName(qname); if (attributes != null) { int length = attributes.getLength(); if (length > 0) { QName aqname = new QName(); XMLAttributes newattrs = new XMLAttributesImpl(); for (int i = 0; i < length; i++) { attributes.getName(i, aqname); String type = attributes.getType(i); String value = attributes.getValue(i); String nonNormalizedValue = attributes.getNonNormalizedValue(i); boolean specified = attributes.isSpecified(i); newattrs.addAttribute(aqname, type, value); newattrs.setNonNormalizedValue(i, nonNormalizedValue); newattrs.setSpecified(i, specified);
/** Element declaration. */ public void elementDecl(String ename, String model, Augmentations augs) throws XNIException { if (fDocumentHandler != null) { fAttributes.removeAllAttributes(); fAttributes.addAttribute(A_ENAME, "NMTOKEN", ename); fAttributes.setSpecified(0, true); fAttributes.addAttribute(A_MODEL, "CDATA", model); fAttributes.setSpecified(1, true); fDocumentHandler.emptyElement(E_ELEMENT_DECL, fAttributes, augs); } } // elementDecl(String,String,Augmentations)
/** Returns the value of the specified attribute, ignoring case. */ protected static String getValue(XMLAttributes attrs, String aname) { int length = attrs != null ? attrs.getLength() : 0; for (int i = 0; i < length; i++) { if (attrs.getQName(i).equalsIgnoreCase(aname)) { return attrs.getValue(i); } } return null; } // getValue(XMLAttributes,String):String
void extraCheckForSTUnionAssertsAttrs(XMLAttributes attributes) { XMLAttributes attrsImpl = (XMLAttributesImpl)attributes; for (int attrIdx = 0; attrIdx < attrsImpl.getLength(); attrIdx++) { Augmentations attrAugs = attrsImpl.getAugmentations(attrIdx); AttributePSVImpl attrPsvi = (AttributePSVImpl)attrAugs.getItem(Constants.ATTRIBUTE_PSVI); XSSimpleTypeDefinition attrSimpleType = (XSSimpleTypeDefinition) attrPsvi.getTypeDefinition(); List isAssertProcessingNeededForSTUnionAttrs = fXmlSchemaValidator.getIsAssertProcessingNeededForSTUnionAttrs(); if (attrSimpleType != null && attrSimpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION && ((XSSimpleType) attrSimpleType.getBaseType()).getVariety() != XSSimpleTypeDefinition.VARIETY_UNION) { if (XS11TypeHelper.isAtomicStrValueValidForSTUnion(attrSimpleType.getMemberTypes(), attrsImpl.getValue(attrIdx), attrPsvi.fValue, Constants.SCHEMA_VERSION_1_1)) { isAssertProcessingNeededForSTUnionAttrs.add(Boolean.valueOf(false)); } else { isAssertProcessingNeededForSTUnionAttrs.add(Boolean.valueOf(true)); } } else { isAssertProcessingNeededForSTUnionAttrs.add(Boolean.valueOf(true)); } } } // extraCheckForSTUnionAssertsAttrs
private XMLAttributes getAttributesForCTA(XMLAttributes attributes, Vector inheritableAttrList) { XMLAttributes ctaAttributes = new XMLAttributesImpl(); // copy attributes from the original list of attributes for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) { QName attrQName = new QName(); attributes.getName(attrIndx, attrQName); ctaAttributes.addAttribute(attrQName, attributes.getType(attrIndx), attributes.getValue(attrIndx)); } // add inherited attributes to the CTA attributes list for (int elemIndx = inheritableAttrList.size() - 1; elemIndx > -1; elemIndx--) { AttributePSVI inhAttrPsvi = (AttributePSVI) inheritableAttrList.elementAt(elemIndx); XSAttributeDeclaration inhrAttrDecl = inhAttrPsvi.getAttributeDeclaration(); // if an inherited attribute is not overridden by the current element, add it to the CTA attributes list if (!isInheritedAttributeOverridden(ctaAttributes, inhrAttrDecl)) { QName attrQName = new QName(); attrQName.setValues(null, inhrAttrDecl.getName(), inhrAttrDecl.getName(), inhrAttrDecl.getNamespace()); ctaAttributes.addAttribute(attrQName, null, inhAttrPsvi.getSchemaValue().getNormalizedValue()); } } return ctaAttributes; } // getAttributesForCTA
int attrCount = attributes.getLength(); for (int i = 0; i < attrCount; i++) { if (attributes.getQName(i) == attRawName) { specified = true; break; fTempQName.setValues(attPrefix, attLocalpart, attRawName, fTempAttDecl.name.uri); int newAttr = attributes.addAttribute(fTempQName, attType, attValue); int attrCount = attributes.getLength(); for (int i = 0; i < attrCount; i++) { String attrRawName = attributes.getQName(i); boolean declared = false; if (fPerformValidation) { String nonNormalizedValue = attributes.getNonNormalizedValue(i); if (nonNormalizedValue != null) { String entityName = getExternalEntityRefInAttrValue(nonNormalizedValue); attributes.setType(i, type); attributes.getAugmentations(i).putItem(Constants.ATTRIBUTE_DECLARED, Boolean.TRUE); String oldValue = attributes.getValue(i); String attrValue = oldValue; if (attributes.isSpecified(i) && type != XMLSymbols.fCDATASymbol) { changedByNormalization = normalizeAttrValue(attributes, i); attrValue = attributes.getValue(i); if (fPerformValidation && fGrammarBucket.getStandalone() && changedByNormalization
int attrCount = attributes.getLength (); boolean seenSchemaDefault = false; for (int i = 0; i < attrCount; i++) { attributes.getName (i, fAttrQName); Attr attr = createAttrNode (fAttrQName); String attrValue = attributes.getValue (i); AttributePSVI attrPSVI =(AttributePSVI) attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI); if (fStorePSVI && attrPSVI != null){ ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); boolean specified = attributes.isSpecified(i); boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED)); type = attributes.getType (i); id = "ID".equals (type); element.uri : null, element.rawname); Object type = null; int attrCount = attributes.getLength (); AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_PSVI); boolean id = false; boolean isDeclared = Boolean.TRUE.equals (attributes.getAugmentations (i).getItem (Constants.ATTRIBUTE_DECLARED)); type = attributes.getType (i);
private void moveAttributeToStyle(XMLAttributes attributes, String attrName, String formatStr) { String attrValue = attributes.getValue(attrName); if (!StringUtils.isEmpty(attrValue)) { String newStyle = String.format(formatStr, attrValue); int styleIdx = attributes.getIndex("style"); if (styleIdx != -1) { String style = attributes.getValue(styleIdx); newStyle = newStyle + style; attributes.setValue(styleIdx, newStyle); } else { attributes.addAttribute(new QName(null, "style", "style", null), "CDATA", newStyle); } } }
for (int attIndex = 0; attIndex < attributes.getLength(); attIndex++) { PSVIAttrNSImpl attrNode = new PSVIAttrNSImpl((PSVIDocumentImpl)fAssertDocument, attributes.getURI(attIndex), attributes.getQName(attIndex), attributes.getLocalName(attIndex)); attrNode.setNodeValue(attributes.getValue(attIndex)); AttributePSVImpl attrPSVI = (AttributePSVImpl) (attributes.getAugmentations(attIndex)).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { attrNode.setPSVI(attrPSVI); List assertionList = (List) augs.getItem(XSAssertConstants.assertList); if (assertionList != null) { fAssertRootStack.push(fCurrentAssertDomNode); if (((Boolean)augs.getItem(XSAssertConstants.isAttrHaveAsserts)).booleanValue()) { evaluateAssertsFromAttributes(element, attributes);
/** Start attribute list. */ public void startAttlist(String ename, Augmentations augs) throws XNIException { if (fDocumentHandler != null) { fAttributes.removeAllAttributes(); fAttributes.addAttribute(A_ENAME, "NMTOKEN", ename); fAttributes.setSpecified(0, true); fDocumentHandler.startElement(E_ATTLIST, fAttributes, augs); } } // startAttlist(String,Augmentations)
isSpecified = attributes.getValue(currDecl.fTargetNamespace, currDecl.fName) != null; new QName(null, currDecl.fName, currDecl.fName, currDecl.fTargetNamespace); String normalized = (defaultValue != null) ? defaultValue.stringValue() : ""; int attrIndex; attrIndex = attributes.addAttribute(attName, "CDATA", normalized); Augmentations augs = attributes.getAugmentations(attrIndex); AttributePSVImpl attrPSVI = new AttributePSVImpl(); augs.putItem(Constants.ATTRIBUTE_PSVI, attrPSVI);
public boolean isDeclared(int index) { if (index < 0 || index >= fAttributes.getLength()) { throw new ArrayIndexOutOfBoundsException(index); } return Boolean.TRUE.equals( fAttributes.getAugmentations(index).getItem( Constants.ATTRIBUTE_DECLARED)); }
private static void copyAttributes(final DomElement to, final XMLAttributes attrs) { final int length = attrs.getLength(); for (int i = 0; i < length; i++) { final String attrName = attrs.getLocalName(i).toLowerCase(Locale.ROOT); if (to.getAttributes().getNamedItem(attrName) == null) { to.setAttribute(attrName, attrs.getValue(i)); if (attrName.startsWith("on") && to.getScriptableObject() instanceof HTMLBodyElement) { final HTMLBodyElement jsBody = to.getScriptableObject(); jsBody.createEventHandlerFromAttribute(attrName, attrs.getValue(i)); } } } }
/** Synthesize namespace binding. */ protected void synthesizeBinding(XMLAttributes attrs, String ns) { String prefix = "xmlns"; String localpart = ns; String qname = prefix+':'+localpart; String uri = NamespaceBinder.NAMESPACES_URI; String atype = "CDATA"; String avalue = SYNTHESIZED_NAMESPACE_PREFX+fSynthesizedNamespaceCount++; // add attribute fQName.setValues(prefix, localpart, qname, uri); attrs.addAttribute(fQName, atype, avalue); // bind namespace XercesBridge.getInstance().NamespaceContext_declarePrefix(fNamespaceContext, ns, avalue); } // synthesizeBinding(XMLAttributes,String)
protected void rewriteAttribute( String attrName, XMLAttributes attributes ) { String uri = attributes.getValue(attrName); if (uri != null) { // attributes.setValue(attributes.getIndex(attrName), urlGenerator.createUrl(uri)); } } /**
@Override public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { String location = String.valueOf(xmlLocator.getLineNumber()); attributes.addAttribute(new QName(MunitCore.LINE_NUMBER_ELEMENT_ATTRIBUTE, null, MunitCore.LINE_NUMBER_ELEMENT_ATTRIBUTE, NAMESPACE), "CDATA", location); super.startElement(element, attributes, augs); }
if(ns != null && (ns.equals(SchemaConstants.NS_URI_XSD_2001) || ns.equals(SchemaConstants.NS_URI_XSD_1999) || ns.equals(SchemaConstants.NS_URI_XSD_2000))) int numatts = arg1.getLength(); for(int i = 0; i < numatts; i++) String nonNormalizedValue = arg1.getNonNormalizedValue(i); arg1.setValue(i, nonNormalizedValue);
/** * Rerturns the DTD determine-ID * * @param attributes * @param index * @return String * @throws XNIException */ public String getDTDDeterminedID(XMLAttributes attributes, int index) throws XNIException { if (attributes.getType(index).equals("ID")) { return attributes.getValue(index); } return null; }
public boolean isSpecified(int index) { if (index < 0 || index >= fAttributes.getLength()) { throw new ArrayIndexOutOfBoundsException(index); } return fAttributes.isSpecified(index); }