private void handleFragmentedCharacters() throws XMLStreamException, SAXException { buffer.setLength(0); // Append characters of first character event buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); // Consume all character while(true) { switch(fastInfosetStreamReader.peekNext()) { case XMLStreamConstants.START_ELEMENT : processBufferedText(true); return; case XMLStreamConstants.END_ELEMENT : processBufferedText(false); return; case XMLStreamConstants.CHARACTERS : case XMLStreamConstants.CDATA : case XMLStreamConstants.SPACE : // Append characters of second and subsequent character events fastInfosetStreamReader.next(); buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); break; default: fastInfosetStreamReader.next(); } } }
/** Skips any white space (isWhiteSpace() returns true), COMMENT, * or PROCESSING_INSTRUCTION, * until a START_ELEMENT or END_ELEMENT is reached. * If other than white space characters, COMMENT, PROCESSING_INSTRUCTION, START_ELEMENT, END_ELEMENT * are encountered, an exception is thrown. This method should * be used when processing element-only content seperated by white space. * This method should * be used when processing element-only content because * the parser is not able to recognize ignorable whitespace if * then DTD is missing or not interpreted. * @return the event type of the element read * @throws XMLStreamException if the current event is not white space */ public final int nextTag() throws XMLStreamException { next(); return nextTag(true); } /** if the current tag has already read, such as in the case EventReader's
/** Skips any white space (isWhiteSpace() returns true), COMMENT, * or PROCESSING_INSTRUCTION, * until a START_ELEMENT or END_ELEMENT is reached. * If other than white space characters, COMMENT, PROCESSING_INSTRUCTION, START_ELEMENT, END_ELEMENT * are encountered, an exception is thrown. This method should * be used when processing element-only content seperated by white space. * This method should * be used when processing element-only content because * the parser is not able to recognize ignorable whitespace if * then DTD is missing or not interpreted. * @return the event type of the element read * @throws XMLStreamException if the current event is not white space */ public final int nextTag() throws XMLStreamException { next(); return nextTag(true); } /** if the current tag has already read, such as in the case EventReader's
private void handleFragmentedCharacters() throws XMLStreamException, SAXException { buffer.setLength(0); // Append characters of first character event buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); // Consume all character while(true) { switch(fastInfosetStreamReader.peekNext()) { case XMLStreamConstants.START_ELEMENT : processBufferedText(true); return; case XMLStreamConstants.END_ELEMENT : processBufferedText(false); return; case XMLStreamConstants.CHARACTERS : case XMLStreamConstants.CDATA : case XMLStreamConstants.SPACE : // Append characters of second and subsequent character events fastInfosetStreamReader.next(); buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); break; default: fastInfosetStreamReader.next(); } } }
/** Skips any white space (isWhiteSpace() returns true), COMMENT, * or PROCESSING_INSTRUCTION, * until a START_ELEMENT or END_ELEMENT is reached. * If other than white space characters, COMMENT, PROCESSING_INSTRUCTION, START_ELEMENT, END_ELEMENT * are encountered, an exception is thrown. This method should * be used when processing element-only content seperated by white space. * This method should * be used when processing element-only content because * the parser is not able to recognize ignorable whitespace if * then DTD is missing or not interpreted. * @return the event type of the element read * @throws XMLStreamException if the current event is not white space */ public final int nextTag() throws XMLStreamException { next(); return nextTag(true); } /** if the current tag has already read, such as in the case EventReader's
/** if the current tag has already read, such as in the case EventReader's * peek() has been called, the current cursor should not move before the loop */ public final int nextTag(boolean currentTagRead) throws XMLStreamException { int eventType = getEventType(); if (!currentTagRead) { eventType = next(); } while((eventType == CHARACTERS && isWhiteSpace()) // skip whitespace || (eventType == CDATA && isWhiteSpace()) || eventType == SPACE || eventType == PROCESSING_INSTRUCTION || eventType == COMMENT) { eventType = next(); } if (eventType != START_ELEMENT && eventType != END_ELEMENT) { throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.expectedStartOrEnd"), getLocation()); } return eventType; }
/** if the current tag has already read, such as in the case EventReader's * peek() has been called, the current cursor should not move before the loop */ public final int nextTag(boolean currentTagRead) throws XMLStreamException { int eventType = getEventType(); if (!currentTagRead) { eventType = next(); } while((eventType == CHARACTERS && isWhiteSpace()) // skip whitespace || (eventType == CDATA && isWhiteSpace()) || eventType == SPACE || eventType == PROCESSING_INSTRUCTION || eventType == COMMENT) { eventType = next(); } if (eventType != START_ELEMENT && eventType != END_ELEMENT) { throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.expectedStartOrEnd"), getLocation()); } return eventType; }
/** if the current tag has already read, such as in the case EventReader's * peek() has been called, the current cursor should not move before the loop */ public final int nextTag(boolean currentTagRead) throws XMLStreamException { int eventType = getEventType(); if (!currentTagRead) { eventType = next(); } while((eventType == CHARACTERS && isWhiteSpace()) // skip whitespace || (eventType == CDATA && isWhiteSpace()) || eventType == SPACE || eventType == PROCESSING_INSTRUCTION || eventType == COMMENT) { eventType = next(); } if (eventType != START_ELEMENT && eventType != END_ELEMENT) { throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.expectedStartOrEnd"), getLocation()); } return eventType; }
/** Reads the content of a text-only element. Precondition: * the current event is START_ELEMENT. Postcondition: * The current event is the corresponding END_ELEMENT. * @throws XMLStreamException if the current event is not a START_ELEMENT or if * a non text element is encountered */ public final String getElementText() throws XMLStreamException { if(getEventType() != START_ELEMENT) { throw new XMLStreamException( CommonResourceBundle.getInstance().getString("message.mustBeOnSTARTELEMENT"), getLocation()); } //current is StartElement, move to the next next(); return getElementText(true); } /**
/** Reads the content of a text-only element. Precondition: * the current event is START_ELEMENT. Postcondition: * The current event is the corresponding END_ELEMENT. * @throws XMLStreamException if the current event is not a START_ELEMENT or if * a non text element is encountered */ public final String getElementText() throws XMLStreamException { if(getEventType() != START_ELEMENT) { throw new XMLStreamException( CommonResourceBundle.getInstance().getString("message.mustBeOnSTARTELEMENT"), getLocation()); } //current is StartElement, move to the next next(); return getElementText(true); } /**
/** Reads the content of a text-only element. Precondition: * the current event is START_ELEMENT. Postcondition: * The current event is the corresponding END_ELEMENT. * @throws XMLStreamException if the current event is not a START_ELEMENT or if * a non text element is encountered */ public final String getElementText() throws XMLStreamException { if(getEventType() != START_ELEMENT) { throw new XMLStreamException( CommonResourceBundle.getInstance().getString("message.mustBeOnSTARTELEMENT"), getLocation()); } //current is StartElement, move to the next next(); return getElementText(true); } /**
private void handleFragmentedCharacters() throws XMLStreamException, SAXException { buffer.setLength(0); // Append characters of first character event buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); // Consume all character while(true) { switch(fastInfosetStreamReader.peekNext()) { case XMLStreamConstants.START_ELEMENT : processBufferedText(true); return; case XMLStreamConstants.END_ELEMENT : processBufferedText(false); return; case XMLStreamConstants.CHARACTERS : case XMLStreamConstants.CDATA : case XMLStreamConstants.SPACE : // Append characters of second and subsequent character events fastInfosetStreamReader.next(); buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); break; default: fastInfosetStreamReader.next(); } } }
private void handleFragmentedCharacters() throws XMLStreamException, SAXException { buffer.setLength(0); // Append characters of first character event buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); // Consume all character while(true) { switch(fastInfosetStreamReader.peekNext()) { case XMLStreamConstants.START_ELEMENT : processBufferedText(true); return; case XMLStreamConstants.END_ELEMENT : processBufferedText(false); return; case XMLStreamConstants.CHARACTERS : case XMLStreamConstants.CDATA : case XMLStreamConstants.SPACE : // Append characters of second and subsequent character events fastInfosetStreamReader.next(); buffer.append(fastInfosetStreamReader.getTextCharacters(), fastInfosetStreamReader.getTextStart(), fastInfosetStreamReader.getTextLength()); break; default: fastInfosetStreamReader.next(); } } }
CommonResourceBundle.getInstance().getString("message.unexpectedEventType")+ getEventTypeString(eventType), getLocation()); eventType = next();
CommonResourceBundle.getInstance().getString("message.unexpectedEventType")+ getEventTypeString(eventType), getLocation()); eventType = next();
CommonResourceBundle.getInstance().getString("message.unexpectedEventType")+ getEventTypeString(eventType), getLocation()); eventType = next();