/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@link Namespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
@Override public boolean isNamespace() { return delegate.isNamespace(); }
@Override public boolean isNamespace() { return delegate.isNamespace(); }
@Override public boolean isNamespace() { return this.event.isNamespace(); }
@Override public boolean isNamespace() { return this.event.isNamespace(); }
} else if (event.isAttribute()) { return readAttribute(reader); } else if (event.isNamespace()) { return readNamespace(reader); } else {
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@link Namespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@link Namespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@linkNamespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@linkNamespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@linkNamespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@linkNamespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@linkNamespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
/** * Constructs a DOM4J Namespace from the provided event stream. The stream * must be positioned before a {@link Namespace}event. * * @param reader * The event stream from which to read the Namespace. * * @return The Namespace that was read from the stream. * * @throws XMLStreamException * If an error occured reading events from the stream, or the * stream was not positioned before a {@linkNamespace}event. */ public org.dom4j.Namespace readNamespace(XMLEventReader reader) throws XMLStreamException { XMLEvent event = reader.peek(); if (event.isNamespace()) { Namespace ns = (Namespace) reader.nextEvent(); return createNamespace(ns); } else { throw new XMLStreamException("Expected Namespace event, found: " + event); } }
private static void applyEvents(List<XMLEvent> events, SOAPElement el) throws SOAPException { if (events != null) { for (XMLEvent ev : events) { if (ev.isNamespace()) { el.addNamespaceDeclaration(((Namespace)ev).getPrefix(), ((Namespace)ev).getNamespaceURI()); } else if (ev.isAttribute()) { el.addAttribute(((Attribute)ev).getName(), ((Attribute)ev).getValue()); } } } }
private static void applyEvents(List<XMLEvent> events, SOAPElement el) throws SOAPException { if (events != null) { for (XMLEvent ev : events) { if (ev.isNamespace()) { el.addNamespaceDeclaration(((Namespace)ev).getPrefix(), ((Namespace)ev).getNamespaceURI()); } else if (ev.isAttribute()) { el.addAttribute(((Attribute)ev).getName(), ((Attribute)ev).getValue()); } } } }
/** * Consumes all StAX events and passes them on to the content handler */ public void parse(XMLEventReader xmlReader) throws XMLStreamException, SAXException { while (xmlReader.hasNext()) { XMLEvent e = xmlReader.nextEvent(); if (e.isStartDocument()) handler.startDocument(); else if (e.isEndDocument()) handler.endDocument(); else if (e.isStartElement()) emitSE(e.asStartElement()); else if (e.isEndElement()) emitEE(e.asEndElement()); else if (e.isProcessingInstruction()) emitPi((ProcessingInstruction) e); else if (e.isCharacters()) emitChars(e.asCharacters()); else if (e.isAttribute()) emitAttr((Attribute) e); else if (e.isEntityReference()) emitEnt((EntityDeclaration) e); else if (e.isNamespace()) emitNS((Namespace) e); else if (e instanceof Comment) emitComment((Comment) e); else if (e instanceof DTD) emitDTD((DTD) e); else { //System.err.println("Unknown / unhandled event type " + e); //throw new SAXException("Unknown / unhandled event type " + e); } } }
/** * Consumes all StAX events and passes them on to the content handler */ public void parse(XMLEventReader xmlReader) throws XMLStreamException, SAXException { while (xmlReader.hasNext()) { XMLEvent e = xmlReader.nextEvent(); if (e.isStartDocument()) handler.startDocument(); else if (e.isEndDocument()) handler.endDocument(); else if (e.isStartElement()) emitSE(e.asStartElement()); else if (e.isEndElement()) emitEE(e.asEndElement()); else if (e.isProcessingInstruction()) emitPi((ProcessingInstruction) e); else if (e.isCharacters()) emitChars(e.asCharacters()); else if (e.isAttribute()) emitAttr((Attribute) e); else if (e.isEntityReference()) emitEnt((EntityDeclaration) e); else if (e.isNamespace()) emitNS((Namespace) e); else if (e instanceof Comment) emitComment((Comment) e); else if (e instanceof DTD) emitDTD((DTD) e); else { //System.err.println("Unknown / unhandled event type " + e); //throw new SAXException("Unknown / unhandled event type " + e); } } }
/** * Consumes all StAX events and passes them on to the content handler */ public void parse(XMLEventReader xmlReader) throws XMLStreamException, SAXException { while (xmlReader.hasNext()) { XMLEvent e = xmlReader.nextEvent(); if (e.isStartDocument()) handler.startDocument(); else if (e.isEndDocument()) handler.endDocument(); else if (e.isStartElement()) emitSE(e.asStartElement()); else if (e.isEndElement()) emitEE(e.asEndElement()); else if (e.isProcessingInstruction()) emitPi((ProcessingInstruction) e); else if (e.isCharacters()) emitChars(e.asCharacters()); else if (e.isAttribute()) emitAttr((Attribute) e); else if (e.isEntityReference()) emitEnt((EntityDeclaration) e); else if (e.isNamespace()) emitNS((Namespace) e); else if (e instanceof Comment) emitComment((Comment) e); else if (e instanceof DTD) emitDTD((DTD) e); else { //System.err.println("Unknown / unhandled event type " + e); //throw new SAXException("Unknown / unhandled event type " + e); } } }
/** * Handle the next event * @return true if the end of the document has been reached. (ie, we are back at level 0) * @throws SAXException */ private void handleXMLEvent(XMLEvent e) throws SAXException { if (e.isStartDocument()) handler.startDocument(); else if (e.isEndDocument()) handler.endDocument(); else if (e.isStartElement()) emitSE(e.asStartElement()); else if (e.isEndElement()) emitEE(e.asEndElement()); else if (e.isProcessingInstruction()) emitPi((ProcessingInstruction) e); else if (e.isCharacters()) emitChars(e.asCharacters()); else if (e.isAttribute()) emitAttr((Attribute) e); else if (e.isEntityReference()) emitEnt((EntityDeclaration) e); else if (e.isNamespace()) emitNS((Namespace) e); else if (e instanceof Comment) emitComment((Comment) e); else if (e instanceof DTD) emitDTD((DTD) e); else { //System.err.println("Unknown / unhandled event type " + e); //throw new SAXException("Unknown / unhandled event type " + e); } }