/** * This method gets the index of an attribute given its qName. * @param qname the qualified name of the attribute, e.g. "prefix1:locName1" * @return the integer index of the attribute. * @see org.xml.sax.Attributes#getIndex(String) */ public final int getIndex(String qname) { int index; if (super.getLength() < MAX) { // if we haven't got too many attributes let the // super class look it up index = super.getIndex(qname); return index; } // we have too many attributes and the super class is slow // so find it quickly using our Hashtable. Integer i = (Integer)m_indexFromQName.get(qname); if (i == null) index = -1; else index = i.intValue(); return index; } /**
/** * This method gets the index of an attribute given its qName. * @param qname the qualified name of the attribute, e.g. "prefix1:locName1" * @return the integer index of the attribute. * @see org.xml.sax.Attributes#getIndex(String) */ public final int getIndex(String qname) { int index; if (super.getLength() < MAX) { // if we haven't got too many attributes let the // super class look it up index = super.getIndex(qname); return index; } // we have too many attributes and the super class is slow // so find it quickly using our Hashtable. Integer i = (Integer)m_indexFromQName.get(qname); if (i == null) index = -1; else index = i.intValue(); return index; } /**
index = super.getIndex(uri,localName); return index;
int idx = actual.getIndex(name); if(idx>=0) actual.removeAttribute(idx);
index = super.getIndex(uri,localName); return index;
private void processDoc(String name, PDFileSpecification spec, AttributesImpl attributes) throws TikaException, SAXException, IOException { if (spec instanceof PDSimpleFileSpecification) { attributes.addAttribute("", "class", "class", "CDATA", "linked"); attributes.addAttribute("", "id", "id", "CDATA", spec.getFile()); xhtml.startElement("div", attributes); xhtml.endElement("div"); } else if (spec instanceof PDComplexFileSpecification){ if (attributes.getIndex("source") < 0) { attributes.addAttribute("", "source", "source", "CDATA", "attachment"); } extractMultiOSPDEmbeddedFiles(name, (PDComplexFileSpecification)spec, attributes); } }
/** * Remove an attribute from the list. Do nothing if attribute does not exist. * * @param atts attributes * @param qName QName of the attribute to remove */ public static void removeAttribute(final AttributesImpl atts, final String qName) { final int i = atts.getIndex(qName); if (i != -1) { atts.removeAttribute(i); } }
public void setAttribute(String name, Object value) throws JellyTagException { // ### we'll assume that all attributes are in no namespace! // ### this is severely limiting! // ### - Tag attributes should allow for namespace aware int index = attributes.getIndex("", name); if (index >= 0) { attributes.removeAttribute(index); } // treat null values as no attribute if (value != null) { attributes.addAttribute("", name, name, "CDATA", value.toString()); } }
public void setAttribute(String name, Object value) throws JellyTagException { // ### we'll assume that all attributes are in no namespace! // ### this is severely limiting! // ### - Tag attributes should allow for namespace aware int index = attributes.getIndex("", name); if (index >= 0) { attributes.removeAttribute(index); } // treat null values as no attribute if (value != null) { attributes.addAttribute("", name, name, "CDATA", value.toString()); } }
private void setAttribute(AttributesImpl atts, String localName, String value) { int index; index = atts.getIndex("", localName); if (index < 0) { atts.addAttribute("", localName, localName, CDATA, value); } else { atts.setAttribute(index, "", localName, localName, CDATA, value); } }
public void setAttribute(String name, Object value) throws JellyTagException { // ### we'll assume that all attributes are in no namespace! // ### this is severely limiting! // ### - Tag attributes should allow for namespace aware int index = attributes.getIndex("", name); if (index >= 0) { attributes.removeAttribute(index); } // treat null values as no attribute if (value != null) { attributes.addAttribute("", name, name, "CDATA", value.toString()); } }
public void setAttribute(String name, Object value) throws JellyTagException { // ### we'll assume that all attributes are in no namespace! // ### this is severely limiting! // ### - Tag attributes should allow for namespace aware int index = attributes.getIndex("", name); if (index >= 0) { attributes.removeAttribute(index); } // treat null values as no attribute if (value != null) { attributes.addAttribute("", name, name, "CDATA", value.toString()); } }
private void processDoc(String name, PDFileSpecification spec, AttributesImpl attributes) throws TikaException, SAXException, IOException { if (spec instanceof PDSimpleFileSpecification) { attributes.addAttribute("", "class", "class", "CDATA", "linked"); attributes.addAttribute("", "id", "id", "CDATA", spec.getFile()); xhtml.startElement("div", attributes); xhtml.endElement("div"); } else if (spec instanceof PDComplexFileSpecification){ if (attributes.getIndex("source") < 0) { attributes.addAttribute("", "source", "source", "CDATA", "attachment"); } extractMultiOSPDEmbeddedFiles(name, (PDComplexFileSpecification)spec, attributes); } }
protected void addAttribute(String qname, String value) { int index = _attributes.getIndex(qname); if (index != -1) { _attributes.setAttribute(index, "", Util.getLocalName(qname), qname, "CDATA", value); } else { _attributes.addAttribute("", Util.getLocalName(qname), qname, "CDATA", value); } }
private void processDoc(String name, PDFileSpecification spec, AttributesImpl attributes) throws TikaException, SAXException, IOException { if (spec instanceof PDSimpleFileSpecification) { attributes.addAttribute("", "class", "class", "CDATA", "linked"); attributes.addAttribute("", "id", "id", "CDATA", spec.getFile()); xhtml.startElement("div", attributes); xhtml.endElement("div"); } else if (spec instanceof PDComplexFileSpecification){ if (attributes.getIndex("source") < 0) { attributes.addAttribute("", "source", "source", "CDATA", "attachment"); } extractMultiOSPDEmbeddedFiles(name, (PDComplexFileSpecification)spec, attributes); } }
private void processDoc(String name, PDFileSpecification spec, AttributesImpl attributes) throws TikaException, SAXException, IOException { if (spec instanceof PDSimpleFileSpecification) { attributes.addAttribute("", "class", "class", "CDATA", "linked"); attributes.addAttribute("", "id", "id", "CDATA", spec.getFile()); xhtml.startElement("div", attributes); xhtml.endElement("div"); } else if (spec instanceof PDComplexFileSpecification){ if (attributes.getIndex("source") < 0) { attributes.addAttribute("", "source", "source", "CDATA", "attachment"); } extractMultiOSPDEmbeddedFiles(name, (PDComplexFileSpecification)spec, attributes); } }
protected void addAttribute(String qname, String value) { int index = _attributes.getIndex(qname); if (index != -1) { _attributes.setAttribute(index, "", Util.getLocalName(qname), qname, "CDATA", value); } else { _attributes.addAttribute("", Util.getLocalName(qname), qname, "CDATA", value); } }
private void cleanUpTdElement(final SaxBuffer.StartElement startElement, final Stack<EndElementInfo> endElements) throws SAXException { final AttributesImpl allowedAttributes = getAllowedAttributes(startElement); // remove dummy rowSpan and colSpan attributes final String rowSpan = allowedAttributes.getValue(ATTR_ROWSPAN); if (SINGLE_COLROWSPAN.equals(rowSpan)) { allowedAttributes.removeAttribute(allowedAttributes.getIndex(ATTR_ROWSPAN)); } final String colSpan = allowedAttributes.getValue(ATTR_COLSPAN); if (SINGLE_COLROWSPAN.equals(colSpan)) { allowedAttributes.removeAttribute(allowedAttributes.getIndex(ATTR_COLSPAN)); } startElement(startElement.localName, allowedAttributes); endElements.push(new EndElementInfo(startElement.localName)); }
@Override protected void addAttributes(ChangeText txt, Attributes attributes) { AttributesImpl newAttrs = new AttributesImpl(attributes); String href = newAttrs.getValue("href"); if (href != null) { txt.addText(" " + getWithDestination().toLowerCase() + " " + href); newAttrs.removeAttribute(newAttrs.getIndex("href")); } super.addAttributes(txt, newAttrs); }
@Override public void startElement(final String uri, final String localName, final String qName, final Attributes atts) throws SAXException { final AttributesImpl attsBuf = new AttributesImpl(atts); for (final String a : new String[]{"class", "domains", "xtrf", "xtrc"}) { final int i = attsBuf.getIndex(a); if (i != -1) { attsBuf.removeAttribute(i); } } getContentHandler().startElement(uri, localName, qName, attsBuf); }