public String getElementText() throws XMLStreamException
{
StringBuffer buffer = new StringBuffer();
XMLEvent e = nextEvent();
if (!e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.mustBeOnSTART_ELEMENT"));
while(hasNext()) {
e = nextEvent();
if(e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.getElementTextExpectTextOnly"));
if(e.isCharacters())
buffer.append(((Characters) e).getData());
if(e.isEndElement())
return buffer.toString();
}
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.END_ELEMENTnotFound"));
}
java类javax.xml.stream.events.Characters的实例源码
StAXFilteredEvent.java 文件源码
项目:OpenJSharp
阅读 20
收藏 0
点赞 0
评论 0
ExternalAttachmentsUnmarshaller.java 文件源码
项目:OpenJSharp
阅读 25
收藏 0
点赞 0
评论 0
private void processCharacters(final Characters chars, final StartElement currentElement, final Map<URI, Policy> map)
throws PolicyException {
if (chars.isWhiteSpace()) {
return;
}
else {
final String data = chars.getData();
if ((currentElement != null) && URI.equals(currentElement.getName())) {
processUri(chars, map);
return;
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0092_CHARACTER_DATA_UNEXPECTED(currentElement, data, chars.getLocation())));
}
}
}
XmlPolicyModelUnmarshaller.java 文件源码
项目:OpenJSharp
阅读 24
收藏 0
点赞 0
评论 0
private StringBuilder processCharacters(final ModelNode.Type currentNodeType, final Characters characters,
final StringBuilder currentValueBuffer)
throws PolicyException {
if (characters.isWhiteSpace()) {
return currentValueBuffer;
} else {
final StringBuilder buffer = (currentValueBuffer == null) ? new StringBuilder() : currentValueBuffer;
final String data = characters.getData();
if (currentNodeType == ModelNode.Type.ASSERTION || currentNodeType == ModelNode.Type.ASSERTION_PARAMETER_NODE) {
return buffer.append(data);
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0009_UNEXPECTED_CDATA_ON_SOURCE_MODEL_NODE(currentNodeType, data)));
}
}
}
ExternalAttachmentsUnmarshaller.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
private void processCharacters(final Characters chars, final StartElement currentElement, final Map<URI, Policy> map)
throws PolicyException {
if (chars.isWhiteSpace()) {
return;
}
else {
final String data = chars.getData();
if ((currentElement != null) && URI.equals(currentElement.getName())) {
processUri(chars, map);
return;
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0092_CHARACTER_DATA_UNEXPECTED(currentElement, data, chars.getLocation())));
}
}
}
XmlPolicyModelUnmarshaller.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
private StringBuilder processCharacters(final ModelNode.Type currentNodeType, final Characters characters,
final StringBuilder currentValueBuffer)
throws PolicyException {
if (characters.isWhiteSpace()) {
return currentValueBuffer;
} else {
final StringBuilder buffer = (currentValueBuffer == null) ? new StringBuilder() : currentValueBuffer;
final String data = characters.getData();
if (currentNodeType == ModelNode.Type.ASSERTION || currentNodeType == ModelNode.Type.ASSERTION_PARAMETER_NODE) {
return buffer.append(data);
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0009_UNEXPECTED_CDATA_ON_SOURCE_MODEL_NODE(currentNodeType, data)));
}
}
}
StAXFilteredEvent.java 文件源码
项目:openjdk-jdk10
阅读 17
收藏 0
点赞 0
评论 0
public String getElementText() throws XMLStreamException
{
StringBuffer buffer = new StringBuffer();
XMLEvent e = nextEvent();
if (!e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.mustBeOnSTART_ELEMENT"));
while(hasNext()) {
e = nextEvent();
if(e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.getElementTextExpectTextOnly"));
if(e.isCharacters())
buffer.append(((Characters) e).getData());
if(e.isEndElement())
return buffer.toString();
}
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.END_ELEMENTnotFound"));
}
ExternalAttachmentsUnmarshaller.java 文件源码
项目:openjdk9
阅读 24
收藏 0
点赞 0
评论 0
private void processCharacters(final Characters chars, final StartElement currentElement, final Map<URI, Policy> map)
throws PolicyException {
if (chars.isWhiteSpace()) {
return;
}
else {
final String data = chars.getData();
if ((currentElement != null) && URI.equals(currentElement.getName())) {
processUri(chars, map);
return;
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0092_CHARACTER_DATA_UNEXPECTED(currentElement, data, chars.getLocation())));
}
}
}
XmlPolicyModelUnmarshaller.java 文件源码
项目:openjdk9
阅读 24
收藏 0
点赞 0
评论 0
private StringBuilder processCharacters(final ModelNode.Type currentNodeType, final Characters characters,
final StringBuilder currentValueBuffer)
throws PolicyException {
if (characters.isWhiteSpace()) {
return currentValueBuffer;
} else {
final StringBuilder buffer = (currentValueBuffer == null) ? new StringBuilder() : currentValueBuffer;
final String data = characters.getData();
if (currentNodeType == ModelNode.Type.ASSERTION || currentNodeType == ModelNode.Type.ASSERTION_PARAMETER_NODE) {
return buffer.append(data);
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0009_UNEXPECTED_CDATA_ON_SOURCE_MODEL_NODE(currentNodeType, data)));
}
}
}
StAXFilteredEvent.java 文件源码
项目:openjdk9
阅读 27
收藏 0
点赞 0
评论 0
public String getElementText() throws XMLStreamException
{
StringBuffer buffer = new StringBuffer();
XMLEvent e = nextEvent();
if (!e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.mustBeOnSTART_ELEMENT"));
while(hasNext()) {
e = nextEvent();
if(e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.getElementTextExpectTextOnly"));
if(e.isCharacters())
buffer.append(((Characters) e).getData());
if(e.isEndElement())
return buffer.toString();
}
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.END_ELEMENTnotFound"));
}
StaxEventXMLReader.java 文件源码
项目:spring4-understanding
阅读 22
收藏 0
点赞 0
评论 0
private void handleCharacters(Characters characters) throws SAXException {
char[] data = characters.getData().toCharArray();
if (getContentHandler() != null && characters.isIgnorableWhiteSpace()) {
getContentHandler().ignorableWhitespace(data, 0, data.length);
return;
}
if (characters.isCData() && getLexicalHandler() != null) {
getLexicalHandler().startCDATA();
}
if (getContentHandler() != null) {
getContentHandler().characters(data, 0, data.length);
}
if (characters.isCData() && getLexicalHandler() != null) {
getLexicalHandler().endCDATA();
}
}
StAXFilteredEvent.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 21
收藏 0
点赞 0
评论 0
public String getElementText() throws XMLStreamException
{
StringBuffer buffer = new StringBuffer();
XMLEvent e = nextEvent();
if (!e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.mustBeOnSTART_ELEMENT"));
while(hasNext()) {
e = nextEvent();
if(e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.getElementTextExpectTextOnly"));
if(e.isCharacters())
buffer.append(((Characters) e).getData());
if(e.isEndElement())
return buffer.toString();
}
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.END_ELEMENTnotFound"));
}
ExternalAttachmentsUnmarshaller.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 29
收藏 0
点赞 0
评论 0
private void processCharacters(final Characters chars, final StartElement currentElement, final Map<URI, Policy> map)
throws PolicyException {
if (chars.isWhiteSpace()) {
return;
}
else {
final String data = chars.getData();
if ((currentElement != null) && URI.equals(currentElement.getName())) {
processUri(chars, map);
return;
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0092_CHARACTER_DATA_UNEXPECTED(currentElement, data, chars.getLocation())));
}
}
}
XmlPolicyModelUnmarshaller.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 25
收藏 0
点赞 0
评论 0
private StringBuilder processCharacters(final ModelNode.Type currentNodeType, final Characters characters,
final StringBuilder currentValueBuffer)
throws PolicyException {
if (characters.isWhiteSpace()) {
return currentValueBuffer;
} else {
final StringBuilder buffer = (currentValueBuffer == null) ? new StringBuilder() : currentValueBuffer;
final String data = characters.getData();
if (currentNodeType == ModelNode.Type.ASSERTION || currentNodeType == ModelNode.Type.ASSERTION_PARAMETER_NODE) {
return buffer.append(data);
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0009_UNEXPECTED_CDATA_ON_SOURCE_MODEL_NODE(currentNodeType, data)));
}
}
}
StaxEventXMLReader.java 文件源码
项目:spring
阅读 15
收藏 0
点赞 0
评论 0
private void handleCharacters(Characters characters) throws SAXException {
char[] data = characters.getData().toCharArray();
if (getContentHandler() != null && characters.isIgnorableWhiteSpace()) {
getContentHandler().ignorableWhitespace(data, 0, data.length);
return;
}
if (characters.isCData() && getLexicalHandler() != null) {
getLexicalHandler().startCDATA();
}
if (getContentHandler() != null) {
getContentHandler().characters(data, 0, data.length);
}
if (characters.isCData() && getLexicalHandler() != null) {
getLexicalHandler().endCDATA();
}
}
ModifiedPomXMLEventReader.java 文件源码
项目:versions-maven-plugin
阅读 18
收藏 0
点赞 0
评论 0
/**
* {@inheritDoc}
*/
public XMLEvent nextTag()
throws XMLStreamException
{
while ( hasNext() )
{
XMLEvent e = nextEvent();
if ( e.isCharacters() && !( (Characters) e ).isWhiteSpace() )
{
throw new XMLStreamException( "Unexpected text" );
}
if ( e.isStartElement() || e.isEndElement() )
{
return e;
}
}
throw new XMLStreamException( "Unexpected end of Document" );
}
StAXFilteredEvent.java 文件源码
项目:infobip-open-jdk-8
阅读 19
收藏 0
点赞 0
评论 0
public String getElementText() throws XMLStreamException
{
StringBuffer buffer = new StringBuffer();
XMLEvent e = nextEvent();
if (!e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.mustBeOnSTART_ELEMENT"));
while(hasNext()) {
e = nextEvent();
if(e.isStartElement())
throw new XMLStreamException(
CommonResourceBundle.getInstance().getString("message.getElementTextExpectTextOnly"));
if(e.isCharacters())
buffer.append(((Characters) e).getData());
if(e.isEndElement())
return buffer.toString();
}
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.END_ELEMENTnotFound"));
}
ExternalAttachmentsUnmarshaller.java 文件源码
项目:infobip-open-jdk-8
阅读 30
收藏 0
点赞 0
评论 0
private void processCharacters(final Characters chars, final StartElement currentElement, final Map<URI, Policy> map)
throws PolicyException {
if (chars.isWhiteSpace()) {
return;
}
else {
final String data = chars.getData();
if ((currentElement != null) && URI.equals(currentElement.getName())) {
processUri(chars, map);
return;
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0092_CHARACTER_DATA_UNEXPECTED(currentElement, data, chars.getLocation())));
}
}
}
XmlPolicyModelUnmarshaller.java 文件源码
项目:infobip-open-jdk-8
阅读 21
收藏 0
点赞 0
评论 0
private StringBuilder processCharacters(final ModelNode.Type currentNodeType, final Characters characters,
final StringBuilder currentValueBuffer)
throws PolicyException {
if (characters.isWhiteSpace()) {
return currentValueBuffer;
} else {
final StringBuilder buffer = (currentValueBuffer == null) ? new StringBuilder() : currentValueBuffer;
final String data = characters.getData();
if (currentNodeType == ModelNode.Type.ASSERTION || currentNodeType == ModelNode.Type.ASSERTION_PARAMETER_NODE) {
return buffer.append(data);
} else {
throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0009_UNEXPECTED_CDATA_ON_SOURCE_MODEL_NODE(currentNodeType, data)));
}
}
}
TmxReader2.java 文件源码
项目:tmpotter
阅读 22
收藏 0
点赞 0
评论 0
/**
* Parse prop elements in Header.
*
* @param element XML element.
* @throws Exception when error happend.
*/
private void parseHeaderProp(StartElement element) throws Exception {
String propType = getAttributeValue(element, "type");
StringBuilder headerPropContent = new StringBuilder();
while (true) {
XMLEvent evt = xml.nextEvent();
switch (evt.getEventType()) {
case XMLEvent.END_ELEMENT:
EndElement eleEnd = (EndElement) evt;
if ("prop".equals(eleEnd.getName().getLocalPart())) {
header.props.put(propType, headerPropContent.toString());
return;
}
break;
case XMLEvent.CHARACTERS:
Characters ch = (Characters) evt;
headerPropContent.append(ch.getData());
break;
default:
break;
}
}
}
TmxReader2.java 文件源码
项目:tmpotter
阅读 21
收藏 0
点赞 0
评论 0
private void parseHeaderNote(StartElement element) throws Exception {
noteContent.setLength(0);
while (true) {
XMLEvent evt = xml.nextEvent();
switch (evt.getEventType()) {
case XMLEvent.END_ELEMENT:
EndElement eleEnd = (EndElement) evt;
if ("note".equals(eleEnd.getName().getLocalPart())) {
header.note = noteContent.toString();
return;
}
break;
case XMLEvent.CHARACTERS:
Characters ch = (Characters) evt;
noteContent.append(ch.getData());
break;
default:
break;
}
}
}
TmxReader2.java 文件源码
项目:tmpotter
阅读 30
收藏 0
点赞 0
评论 0
private void parseTuNote(StartElement element) throws Exception {
noteContent.setLength(0);
while (true) {
XMLEvent evt = xml.nextEvent();
switch (evt.getEventType()) {
case XMLEvent.END_ELEMENT:
EndElement eleEnd = (EndElement) evt;
if ("note".equals(eleEnd.getName().getLocalPart())) {
currentTu.note = noteContent.toString();
return;
}
break;
case XMLEvent.CHARACTERS:
Characters ch = (Characters) evt;
noteContent.append(ch.getData());
break;
default:
break;
}
}
}
TmxReader2.java 文件源码
项目:tmpotter
阅读 28
收藏 0
点赞 0
评论 0
/**
* Parse prop elements in Tu element.
*
* @param element XML element.
* @throws Exception when error happened.
*/
private void parseTuProp(StartElement element) throws Exception {
String propType = getAttributeValue(element, "type");
propContent.setLength(0);
while (true) {
XMLEvent evt = xml.nextEvent();
switch (evt.getEventType()) {
case XMLEvent.END_ELEMENT:
EndElement eleEnd = (EndElement) evt;
if ("prop".equals(eleEnd.getName().getLocalPart())) {
currentTu.props.put(propType, propContent.toString());
return;
}
break;
case XMLEvent.CHARACTERS:
Characters ch = (Characters) evt;
propContent.append(ch.getData());
break;
default:
break;
}
}
}
TmxReader2.java 文件源码
项目:tmpotter
阅读 19
收藏 0
点赞 0
评论 0
/**
* OmegaT TMX - just read full text.
*/
private void parseSegOmegaT() throws Exception {
segContent.setLength(0);
while (true) {
XMLEvent evt = xml.nextEvent();
switch (evt.getEventType()) {
case XMLEvent.END_ELEMENT:
EndElement eleEnd = (EndElement) evt;
if ("seg".equals(eleEnd.getName().getLocalPart())) {
return;
}
break;
case XMLEvent.CHARACTERS:
Characters ch = (Characters) evt;
segContent.append(ch.getData());
break;
default:
break;
}
}
}
EntityRepository.java 文件源码
项目:JavaMainRepo
阅读 28
收藏 0
点赞 0
评论 0
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
XMLEvent tab = eventFactory.createDTD("\t");
// Create start node
StartElement sElement = eventFactory.createStartElement("", "", name);
eventWriter.add(tab);
eventWriter.add(sElement);
// Create Content
Characters characters = eventFactory.createCharacters(value);
eventWriter.add(characters);
// Create End node
EndElement eElement = eventFactory.createEndElement("", "", name);
eventWriter.add(eElement);
eventWriter.add(end);
}
EmployeeRepository.java 文件源码
项目:JavaMainRepo
阅读 18
收藏 0
点赞 0
评论 0
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
XMLEvent tab = eventFactory.createDTD("\t");
// Create start node
StartElement sElement = eventFactory.createStartElement("", "", name);
eventWriter.add(tab);
eventWriter.add(sElement);
// Create Content
Characters characters = eventFactory.createCharacters(value);
eventWriter.add(characters);
// Create End node
EndElement eElement = eventFactory.createEndElement("", "", name);
eventWriter.add(eElement);
eventWriter.add(end);
}
EntityRepository.java 文件源码
项目:JavaMainRepo
阅读 21
收藏 0
点赞 0
评论 0
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
XMLEvent tab = eventFactory.createDTD("\t");
StartElement sElement = eventFactory.createStartElement("", "", name);
eventWriter.add(tab);
eventWriter.add(sElement);
Characters characters = eventFactory.createCharacters(value);
eventWriter.add(characters);
EndElement eElement = eventFactory.createEndElement("", "", name);
eventWriter.add(eElement);
eventWriter.add(end);
}
EntityRepository.java 文件源码
项目:JavaMainRepo
阅读 19
收藏 0
点赞 0
评论 0
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
XMLEvent tab = eventFactory.createDTD("\t");
// Create Start node
StartElement sElement = eventFactory.createStartElement("", "", name);
eventWriter.add(tab);
eventWriter.add(sElement);
// Create Content
Characters characters = eventFactory.createCharacters(value);
eventWriter.add(characters);
// Create End node
EndElement eElement = eventFactory.createEndElement("", "", name);
eventWriter.add(eElement);
eventWriter.add(end);
}
EntityRepository.java 文件源码
项目:JavaMainRepo
阅读 19
收藏 0
点赞 0
评论 0
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
XMLEvent tab = eventFactory.createDTD("\t");
// Create Start node
StartElement sElement = eventFactory.createStartElement("", "", name);
eventWriter.add(tab);
eventWriter.add(sElement);
// Create Content
Characters characters = eventFactory.createCharacters(value);
eventWriter.add(characters);
// Create End node
EndElement eElement = eventFactory.createEndElement("", "", name);
eventWriter.add(eElement);
eventWriter.add(end);
}
AnimalRepository.java 文件源码
项目:JavaMainRepo
阅读 20
收藏 0
点赞 0
评论 0
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
XMLEvent tab = eventFactory.createDTD("\t");
// Create Start node
StartElement sElement = eventFactory.createStartElement("", "", name);
eventWriter.add(tab);
eventWriter.add(sElement);
// Create Content
Characters characters = eventFactory.createCharacters(value);
eventWriter.add(characters);
// Create End node
EndElement eElement = eventFactory.createEndElement("", "", name);
eventWriter.add(eElement);
eventWriter.add(end);
}
EmployeeRepository.java 文件源码
项目:JavaMainRepo
阅读 24
收藏 0
点赞 0
评论 0
public static void createNode(XMLEventWriter eventWriter, String name, String value) throws XMLStreamException {
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
XMLEvent end = eventFactory.createDTD("\n");
XMLEvent tab = eventFactory.createDTD("\t");
// Create Start node
StartElement sElement = eventFactory.createStartElement("", "", name);
eventWriter.add(tab);
eventWriter.add(sElement);
// Create Content
Characters characters = eventFactory.createCharacters(value);
eventWriter.add(characters);
// Create End node
EndElement eElement = eventFactory.createEndElement("", "", name);
eventWriter.add(eElement);
eventWriter.add(end);
}