List of usage examples for javax.xml.stream.events StartElement asStartElement
public StartElement asStartElement();
From source file:org.jonross.coercion.v2.BinderSpec.java
/** *///ww w . j a va2 s.co m public void parse(Reader input) throws XMLStreamException { // Grab the first element in the binder file and verify that it's // our show; check for binder package name and class name. XMLEventReader reader = inputFactory.createXMLEventReader(input); StartElement start = nextStartElement(reader).asStartElement(); if (!start.getName().equals(CO_UNMARSHALLER)) throw new CoercionException( "Root element must be <" + CO_UNMARSHALLER.getLocalPart() + "> in namespace " + MY_NS); Attribute att = start.getAttributeByName(CO_PACKAGE_NAME); if (att != null) packageName = att.getValue(); att = start.getAttributeByName(CO_CLASS_NAME); if (att != null) className = att.getValue(); else throw new CoercionException("Root <unmarshaller> element is missing className attribute"); root = parse(reader, start.asStartElement()); }