javax.xml.stream.EventFilter Java Examples
The following examples show how to use
javax.xml.stream.EventFilter.
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: Bug6976938Test.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void eventReaderTest(XMLInputFactory xif) { XMLEventReader eventReader = null; try { eventReader = xif.createXMLEventReader(this.getClass().getResourceAsStream(INPUT_FILE)); XMLEventReader filteredEventReader = xif.createFilteredReader(eventReader, new EventFilter() { public boolean accept(XMLEvent event) { if (!event.isStartElement()) { return false; } QName elementQName = event.asStartElement().getName(); if ((elementQName.getLocalPart().equals(ATTACHMENT_NAME.getLocalPart()) || elementQName.getLocalPart().equals("Attachment")) && elementQName.getNamespaceURI().equals(VF_GENERIC_TT_NAMESPACE)) { return true; } return false; } }); if (filteredEventReader.hasNext()) { System.out.println("containsAttachments() returns true"); } } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } finally { if (eventReader != null) { try { eventReader.close(); } catch (XMLStreamException xse) { // Ignored by intention } } } }
Example #2
Source File: PresetGeometries.java From lams with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unused") public void init(InputStream is) throws XMLStreamException, JAXBException { // StAX: EventFilter startElementFilter = new EventFilter() { @Override public boolean accept(XMLEvent event) { return event.isStartElement(); } }; XMLInputFactory staxFactory = StaxHelper.newXMLInputFactory(); XMLEventReader staxReader = staxFactory.createXMLEventReader(is); XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter); // ignore StartElement: /* XMLEvent evDoc = */ staxFiltRd.nextEvent(); // JAXB: JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); long cntElem = 0; while (staxFiltRd.peek() != null) { StartElement evRoot = (StartElement)staxFiltRd.peek(); String name = evRoot.getName().getLocalPart(); JAXBElement<CTCustomGeometry2D> el = unmarshaller.unmarshal(staxReader, CTCustomGeometry2D.class); CTCustomGeometry2D cus = el.getValue(); cntElem++; if(containsKey(name)) { LOG.log(POILogger.WARN, "Duplicate definition of " + name); } put(name, new CustomGeometry(cus)); } }
Example #3
Source File: EventFilterSupport.java From hottub with GNU General Public License v2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #4
Source File: EventFilterSupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #5
Source File: MyInputFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException { throw new UnsupportedOperationException("Not supported yet."); }
Example #6
Source File: XMLInputFactoryWrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException { return defaultImpl.createFilteredReader(reader, filter); }
Example #7
Source File: XMLInputFactoryImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException { return null; }
Example #8
Source File: StAXFilteredEvent.java From hottub with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }
Example #9
Source File: StAXFilteredEvent.java From hottub with GNU General Public License v2.0 | 4 votes |
public void setFilter(EventFilter filter) { _filter = filter; }
Example #10
Source File: StAXFilteredEvent.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void setFilter(EventFilter filter) { _filter = filter; }
Example #11
Source File: StAXFilteredEvent.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }
Example #12
Source File: StAXFilteredEvent.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void setFilter(EventFilter filter) { _filter = filter; }
Example #13
Source File: EventFilterSupport.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #14
Source File: StAXFilteredEvent.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }
Example #15
Source File: StAXFilteredEvent.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void setFilter(EventFilter filter) { _filter = filter; }
Example #16
Source File: EventFilterSupport.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #17
Source File: AbstractXMLInputFactory.java From jettison with Apache License 2.0 | 4 votes |
public XMLEventReader createFilteredReader(XMLEventReader arg0, EventFilter arg1) throws XMLStreamException { // TODO Auto-generated method stub return null; }
Example #18
Source File: StAXFilteredEvent.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }
Example #19
Source File: StAXFilteredEvent.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }
Example #20
Source File: EventFilterSupport.java From Bytecoder with Apache License 2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #21
Source File: EventFilterSupport.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #22
Source File: StAXFilteredEvent.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void setFilter(EventFilter filter) { _filter = filter; }
Example #23
Source File: StAXFilteredEvent.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }
Example #24
Source File: DrawSimpleShape.java From lams with GNU General Public License v2.0 | 4 votes |
protected static CustomGeometry getCustomGeometry(String name, Graphics2D graphics) { @SuppressWarnings("unchecked") Map<String, CustomGeometry> presets = (graphics == null) ? null : (Map<String, CustomGeometry>)graphics.getRenderingHint(Drawable.PRESET_GEOMETRY_CACHE); if (presets == null) { presets = new HashMap<String,CustomGeometry>(); if (graphics != null) { graphics.setRenderingHint(Drawable.PRESET_GEOMETRY_CACHE, presets); } String packageName = "org.apache.poi.sl.draw.binding"; InputStream presetIS = Drawable.class.getResourceAsStream("presetShapeDefinitions.xml"); // StAX: EventFilter startElementFilter = new EventFilter() { @Override public boolean accept(XMLEvent event) { return event.isStartElement(); } }; try { XMLInputFactory staxFactory = StaxHelper.newXMLInputFactory(); XMLEventReader staxReader = staxFactory.createXMLEventReader(presetIS); XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter); // Ignore StartElement: staxFiltRd.nextEvent(); // JAXB: JAXBContext jaxbContext = JAXBContext.newInstance(packageName); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); while (staxFiltRd.peek() != null) { StartElement evRoot = (StartElement)staxFiltRd.peek(); String cusName = evRoot.getName().getLocalPart(); // XMLEvent ev = staxReader.nextEvent(); JAXBElement<org.apache.poi.sl.draw.binding.CTCustomGeometry2D> el = unmarshaller.unmarshal(staxReader, CTCustomGeometry2D.class); CTCustomGeometry2D cusGeom = el.getValue(); presets.put(cusName, new CustomGeometry(cusGeom)); } staxFiltRd.close(); staxReader.close(); } catch (Exception e) { throw new RuntimeException("Unable to load preset geometries.", e); } finally { IOUtils.closeQuietly(presetIS); } } return presets.get(name); }
Example #25
Source File: EventFilterSupport.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #26
Source File: StAXFilteredEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void setFilter(EventFilter filter) { _filter = filter; }
Example #27
Source File: StAXFilteredEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }
Example #28
Source File: EventFilterSupport.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** Creates a new instance of EventFilterSupport */ public EventFilterSupport(XMLEventReader eventReader, EventFilter eventFilter) { setParent(eventReader); fEventFilter = eventFilter; }
Example #29
Source File: StAXFilteredEvent.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void setFilter(EventFilter filter) { _filter = filter; }
Example #30
Source File: StAXFilteredEvent.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public StAXFilteredEvent(XMLEventReader reader, EventFilter filter) throws XMLStreamException { eventReader = reader; _filter = filter; }