@SuppressWarnings("unchecked") private Iterator<Namespace> existingXmlNamespacesIterator(EndElement endElement) { return endElement.getNamespaces(); }
@SuppressWarnings("rawtypes") private void doWriteNamespace(Namespace namespace) throws XMLStreamException { int last = this.endElements.size() - 1; EndElement oldEndElement = this.endElements.get(last); Iterator oldNamespaces = oldEndElement.getNamespaces(); List<Namespace> newNamespaces = new ArrayList<>(); while (oldNamespaces.hasNext()) { Namespace oldNamespace = (Namespace) oldNamespaces.next(); newNamespaces.add(oldNamespace); } newNamespaces.add(namespace); EndElement newEndElement = this.eventFactory.createEndElement(oldEndElement.getName(), newNamespaces.iterator()); this.eventWriter.add(namespace); this.endElements.set(last, newEndElement); }
@Override @SuppressWarnings("rawtypes") public int getNamespaceCount() { Iterator namespaces; if (this.event.isStartElement()) { namespaces = this.event.asStartElement().getNamespaces(); } else if (this.event.isEndElement()) { namespaces = this.event.asEndElement().getNamespaces(); } else { throw new IllegalStateException(); } return countIterator(namespaces); }
@SuppressWarnings("rawtypes") private Namespace getNamespace(int index) { Iterator namespaces; if (this.event.isStartElement()) { namespaces = this.event.asStartElement().getNamespaces(); } else if (this.event.isEndElement()) { namespaces = this.event.asEndElement().getNamespaces(); } else { throw new IllegalStateException(); } int count = 0; while (namespaces.hasNext()) { Namespace namespace = (Namespace) namespaces.next(); if (count == index) { return namespace; } else { count++; } } throw new IllegalArgumentException(); }
private void handleEndElement(EndElement endElement) throws SAXException { if (getContentHandler() != null) { QName qName = endElement.getName(); if (hasNamespacesFeature()) { getContentHandler().endElement(qName.getNamespaceURI(), qName.getLocalPart(), toQualifiedName(qName)); for (Iterator i = endElement.getNamespaces(); i.hasNext();) { Namespace namespace = (Namespace) i.next(); endPrefixMapping(namespace.getPrefix()); } } else { getContentHandler().endElement("", "", toQualifiedName(qName)); } } }
@SuppressWarnings("rawtypes") private void doWriteNamespace(Namespace namespace) throws XMLStreamException { int last = this.endElements.size() - 1; EndElement oldEndElement = this.endElements.get(last); Iterator oldNamespaces = oldEndElement.getNamespaces(); List<Namespace> newNamespaces = new ArrayList<>(); while (oldNamespaces.hasNext()) { Namespace oldNamespace = (Namespace) oldNamespaces.next(); newNamespaces.add(oldNamespace); } newNamespaces.add(namespace); EndElement newEndElement = this.eventFactory.createEndElement(oldEndElement.getName(), newNamespaces.iterator()); this.eventWriter.add(namespace); this.endElements.set(last, newEndElement); }
@Override @SuppressWarnings("rawtypes") public int getNamespaceCount() { Iterator namespaces; if (this.event.isStartElement()) { namespaces = this.event.asStartElement().getNamespaces(); } else if (this.event.isEndElement()) { namespaces = this.event.asEndElement().getNamespaces(); } else { throw new IllegalStateException(); } return countIterator(namespaces); }
@SuppressWarnings("rawtypes") private Namespace getNamespace(int index) { Iterator namespaces; if (this.event.isStartElement()) { namespaces = this.event.asStartElement().getNamespaces(); } else if (this.event.isEndElement()) { namespaces = this.event.asEndElement().getNamespaces(); } else { throw new IllegalStateException(); } int count = 0; while (namespaces.hasNext()) { Namespace namespace = (Namespace) namespaces.next(); if (count == index) { return namespace; } else { count++; } } throw new IllegalArgumentException(); }
private void handleEndElement(EndElement endElement) throws SAXException { if (getContentHandler() != null) { QName qName = endElement.getName(); if (hasNamespacesFeature()) { getContentHandler().endElement(qName.getNamespaceURI(), qName.getLocalPart(), toQualifiedName(qName)); for (Iterator i = endElement.getNamespaces(); i.hasNext();) { Namespace namespace = (Namespace) i.next(); endPrefixMapping(namespace.getPrefix()); } } else { getContentHandler().endElement("", "", toQualifiedName(qName)); } } }
private void handleEndElement(EndElement event) throws SAXException { if(!seenText && predictor.expectText()) { visitor.text(""); } // fire endElement QName qName = event.getName(); tagName.uri = fixNull(qName.getNamespaceURI()); tagName.local = qName.getLocalPart(); visitor.endElement(tagName); // end namespace bindings for( Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) { String prefix = fixNull(i.next().getPrefix()); // be defensive visitor.endPrefixMapping(prefix); } seenText = false; }
public int getNamespaceCount() { Iterator namespaces; if (event.isStartElement()) { namespaces = event.asStartElement().getNamespaces(); } else if (event.isEndElement()) { namespaces = event.asEndElement().getNamespaces(); } else { throw new IllegalStateException(); } return countIterator(namespaces); }
private void writeNamespace(Namespace namespace) throws XMLStreamException { int last = endElements.size() - 1; EndElement oldEndElement = endElements.get(last); Iterator oldNamespaces = oldEndElement.getNamespaces(); List<Namespace> newNamespaces = new ArrayList<Namespace>(); while (oldNamespaces.hasNext()) { Namespace oldNamespace = (Namespace) oldNamespaces.next(); newNamespaces.add(oldNamespace); } newNamespaces.add(namespace); EndElement newEndElement = eventFactory.createEndElement(oldEndElement.getName(), newNamespaces.iterator()); eventWriter.add(namespace); endElements.set(last, newEndElement); } }
private Namespace getNamespace(int index) { Iterator namespaces; if (event.isStartElement()) { namespaces = event.asStartElement().getNamespaces(); } else if (event.isEndElement()) { namespaces = event.asEndElement().getNamespaces(); } else { throw new IllegalStateException(); } int count = 0; while (namespaces.hasNext()) { Namespace namespace = (Namespace) namespaces.next(); if (count == index) { return namespace; } else { count++; } } throw new IllegalArgumentException(); } }
private void handleEndElement(EndElement endElement) throws SAXException { if (getContentHandler() != null) { QName qName = endElement.getName(); if (hasNamespacesFeature()) { getContentHandler().endElement(qName.getNamespaceURI(), qName.getLocalPart(), toQualifiedName(qName)); for (Iterator i = endElement.getNamespaces(); i.hasNext();) { Namespace namespace = (Namespace) i.next(); endPrefixMapping(namespace.getPrefix()); } } else { getContentHandler().endElement("", "", toQualifiedName(qName)); } } }
private void handleEndElement(EndElement event) throws SAXException { if(!seenText && predictor.expectText()) { visitor.text(""); } // fire endElement QName qName = event.getName(); tagName.uri = fixNull(qName.getNamespaceURI()); tagName.local = qName.getLocalPart(); visitor.endElement(tagName); // end namespace bindings for( Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) { String prefix = fixNull(i.next().getPrefix()); // be defensive visitor.endPrefixMapping(prefix); } seenText = false; }
public EndElementEvent(EndElement that) { super(that); this.name = that.getName(); Iterator namespaces = that.getNamespaces(); if (namespaces != null && namespaces.hasNext()) { List nsList = new ArrayList(); do { Namespace ns = (Namespace) namespaces.next(); nsList.add(ns); } while (namespaces.hasNext()); } }
private void emitEE(EndElement ee) throws SAXException { handler.endElement(ee.getName().getNamespaceURI(), ee.getName().getLocalPart(), qnameToS(ee.getName())); @SuppressWarnings("unchecked") Iterator<Namespace> it = ee.getNamespaces(); while (it.hasNext()) emitNSGone(it.next()); }
private void emitEE(EndElement ee) throws SAXException { handler.endElement(ee.getName().getNamespaceURI(), ee.getName().getLocalPart(), qnameToS(ee.getName())); @SuppressWarnings("unchecked") Iterator<Namespace> it = ee.getNamespaces(); while (it.hasNext()) emitNSGone(it.next()); }
private void emitEE(EndElement ee) throws SAXException { handler.endElement(ee.getName().getNamespaceURI(), ee.getName().getLocalPart(), qnameToS(ee.getName())); @SuppressWarnings("unchecked") Iterator<Namespace> it = ee.getNamespaces(); while (it.hasNext()) emitNSGone(it.next()); }
@Override public int getNamespaceCount() { Iterator namespaces; if (event.isStartElement()) { namespaces = event.asStartElement().getNamespaces(); } else if (event.isEndElement()) { namespaces = event.asEndElement().getNamespaces(); } else { throw new IllegalStateException(); } return countIterator(namespaces); }