/** * Fires any pending SAX startElement event towards the * configured ContentHandler. * * @throws SAXException if thrown by the ContentHandler. */ private void flushStartTag() throws SAXException { if (this.startTagInProgress) { String tagName = (String) (this.elementStack.get(0)); this.contentHandler.startElement("", tagName, tagName, this.attributeList); this.attributeList.clear(); this.startTagInProgress = false; } }
/** * This method clears the accumulated attributes. * * @see org.xml.sax.helpers.AttributesImpl#clear() */ public final void clear() { int len = super.getLength(); super.clear(); if (MAX <= len) { // if we have had enough attributes and are // using the Hashtable, then clear the Hashtable too. m_indexFromQName.clear(); } }
/** * Copy an entire Attributes object. * * <p>It may be more efficient to reuse an existing object * rather than constantly allocating new ones.</p> * * @param atts The attributes to copy. */ public void setAttributes (Attributes atts) { clear(); length = atts.getLength(); if (length > 0) { data = new String[length*5]; for (int i = 0; i < length; i++) { data[i*5] = atts.getURI(i); data[i*5+1] = atts.getLocalName(i); data[i*5+2] = atts.getQName(i); data[i*5+3] = atts.getType(i); data[i*5+4] = atts.getValue(i); } } }
/** * This method clears the accumulated attributes. * * @see org.xml.sax.helpers.AttributesImpl#clear() */ public final void clear() { int len = super.getLength(); super.clear(); if (MAX <= len) { // if we have had enough attributes and are // using the Hashtable, then clear the Hashtable too. m_indexFromQName.clear(); } }
private void startElement() throws SAXException { if (!started) { writer.startElement("", "", (String)elementStack.peek(), attributes); attributes.clear(); started = true; } } }
final NamedNodeMap attributes = e.getAttributes(); atts.clear(); int len = attributes==null ? 0: attributes.getLength();
atts.clear(); for (int i = 0; i < length; i++) { String attQName = qAtts.getName(i);
public void endNode() { try { if (!children) { Element element = new DefaultElement((String)elementStack.pop()); for (int i = 0; i < attributes.getLength(); ++i) { element.addAttribute(attributes.getQName(i), attributes.getValue(i)); } writer.write(element); attributes.clear(); children = true; // node just closed is child of node on top of stack started = true; } else { startElement(); writer.endElement("", "", (String)elementStack.pop()); } } catch (SAXException e) { throw new StreamException(e); } catch (IOException e) { throw new StreamException(e); } }
final NamedNodeMap attributes = e.getAttributes(); atts.clear(); int len = attributes==null ? 0: attributes.getLength();
protected Attributes createAttributes(Element element, Attributes namespaceAttributes) throws SAXException { attributes.clear(); if (namespaceAttributes != null) { attributes.setAttributes(namespaceAttributes); } for (Iterator<Attribute> iter = element.attributeIterator(); iter.hasNext();) { Attribute attribute = iter.next(); attributes.addAttribute(attribute.getNamespaceURI(), attribute .getName(), attribute.getQualifiedName(), "CDATA", attribute.getValue()); } return attributes; }
protected boolean emitElement ( SaveCur c, ArrayList attrNames, ArrayList attrValues ) { _attributes.clear(); if (saveNamespacesFirst()) emitNamespacesHelper(); for ( int i = 0 ; i < attrNames.size() ; i++ ) { QName name = (QName) attrNames.get( i ); _attributes.addAttribute( name.getNamespaceURI(), name.getLocalPart(), getPrefixedName( name ), "CDATA", (String) attrValues.get( i ) ); } if (!saveNamespacesFirst()) emitNamespacesHelper(); QName elemName = c.getName(); try { _contentHandler.startElement( elemName.getNamespaceURI(), elemName.getLocalPart(), getPrefixedName( elemName ), _attributes ); } catch ( SAXException e ) { throw new SaverSAXException( e ); } return false; }
@Override public void clear() { qNames.clear(); super.clear(); }
@Override public void clear() { qNames.clear(); super.clear(); }
/** * Start an element with the current attribute settings. Clears the * attributes as well. */ protected void startElement(String name) throws SAXException { _handler.startElement("", name, name, _attrs); _attrs.clear(); }
void finishStartElement(ContentHandler contentHandler) throws SAXException { contentHandler.startElement(elementURI, elementLocalName, elementQName, attributes); elementNameStack.push(elementURI); elementNameStack.push(elementLocalName); elementNameStack.push(elementQName); elementURI = null; elementLocalName = null; elementQName = null; attributes.clear(); }
protected void addTag(String tagName, String value) throws SAXException { if (mySharedAttributes == null) { mySharedAttributes = new AttributesImpl(); } getHandler().startElement("", "", tagName, mySharedAttributes); mySharedAttributes.clear(); value = value == null ? "" : value; getHandler().characters(value.toCharArray(), 0, value.length()); getHandler().endElement("", "", tagName); }
private void startElement() throws SAXException { if (!started) { writer.startElement("", "", elementStack.peek(), attributes); attributes.clear(); started = true; } } }
private void startElement() throws SAXException { if (!started) { writer.startElement("", "", (String)elementStack.peek(), attributes); attributes.clear(); started = true; } } }