Java Code Examples for javax.xml.stream.events.EndElement#getNamespaces()
The following examples show how to use
javax.xml.stream.events.EndElement#getNamespaces() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StaxEventXMLReader.java From spring-analysis-note with MIT License | 6 votes |
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)); } } }
Example 2
Source File: StAXEventConnector.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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; }
Example 3
Source File: StAXEventConnector.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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; }
Example 4
Source File: StaxEventXMLReader.java From java-technology-stack with MIT License | 6 votes |
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)); } } }
Example 5
Source File: StAXEventConnector.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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; }
Example 6
Source File: StAXEventConnector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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; }
Example 7
Source File: StAXEventConnector.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; }
Example 8
Source File: StaxEventXMLReader.java From lams with GNU General Public License v2.0 | 6 votes |
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)); } } }
Example 9
Source File: StAXEvent2SAX.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator i = event.getNamespaces(); i.hasNext();) { String prefix = (String)i.next(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 10
Source File: StAXEvent2SAX.java From Bytecoder with Apache License 2.0 | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) { String prefix = (i.next()).getPrefix(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 11
Source File: StAXEvent2SAX.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator i = event.getNamespaces(); i.hasNext();) { String prefix = (String)i.next(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 12
Source File: XMLEventStreamWriter.java From lams with GNU General Public License v2.0 | 5 votes |
@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<Namespace>(); 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); }
Example 13
Source File: StAXEvent2SAX.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator i = event.getNamespaces(); i.hasNext();) { String prefix = (String)i.next(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 14
Source File: StAXEvent2SAX.java From JDKSourceCode1.8 with MIT License | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator i = event.getNamespaces(); i.hasNext();) { String prefix = (String)i.next(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 15
Source File: StAXEvent2SAX.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator i = event.getNamespaces(); i.hasNext();) { String prefix = (String)i.next(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 16
Source File: XMLEventStreamWriter.java From java-technology-stack with MIT License | 5 votes |
@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); }
Example 17
Source File: StAXEvent2SAX.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator i = event.getNamespaces(); i.hasNext();) { String prefix = (String)i.next(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 18
Source File: StAXEvent2SAX.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private void handleEndElement(EndElement event) throws XMLStreamException { QName qName = event.getName(); //construct prefix:localName from qName String qname = ""; if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){ qname = qName.getPrefix() + ":"; } qname += qName.getLocalPart(); try { // fire endElement _sax.endElement( qName.getNamespaceURI(), qName.getLocalPart(), qname); // end namespace bindings for( Iterator i = event.getNamespaces(); i.hasNext();) { String prefix = (String)i.next(); if( prefix == null ) { // true for default namespace prefix = ""; } _sax.endPrefixMapping(prefix); } } catch (SAXException e) { throw new XMLStreamException(e); } }
Example 19
Source File: XMLEventStreamWriter.java From spring-analysis-note with MIT License | 5 votes |
@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); }
Example 20
Source File: JpaOrmXmlEventReader.java From lams with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unchecked") private Iterator<Namespace> existingXmlNamespacesIterator(EndElement endElement) { return endElement.getNamespaces(); }