当前位置: 首页>>代码示例>>Java>>正文


Java Characters.isIgnorableWhiteSpace方法代码示例

本文整理汇总了Java中javax.xml.stream.events.Characters.isIgnorableWhiteSpace方法的典型用法代码示例。如果您正苦于以下问题:Java Characters.isIgnorableWhiteSpace方法的具体用法?Java Characters.isIgnorableWhiteSpace怎么用?Java Characters.isIgnorableWhiteSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.stream.events.Characters的用法示例。


在下文中一共展示了Characters.isIgnorableWhiteSpace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleCharacters

import javax.xml.stream.events.Characters; //导入方法依赖的package包/类
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();
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:StaxEventXMLReader.java

示例2: read

import javax.xml.stream.events.Characters; //导入方法依赖的package包/类
/**
 * Reads the specified node type.
 *
 * @param keepWhiteSpace Do not remove whitespace characters if true
 * @throws ServiceXmlDeserializationException  the service xml deserialization exception
 * @throws XMLStreamException the XML stream exception
 */
private void read(boolean keepWhiteSpace) throws ServiceXmlDeserializationException,
    XMLStreamException {
  // The caller to EwsXmlReader.Read expects
  // that there's another node to
  // read. Throw an exception if not true.
  while (true) {
    if (!xmlReader.hasNext()) {
      throw new ServiceXmlDeserializationException("Unexpected end of XML document.");
    } else {
      XMLEvent event = xmlReader.nextEvent();
      if (event.getEventType() == XMLStreamConstants.CHARACTERS) {
        Characters characters = (Characters) event;
        if (!keepWhiteSpace)
          if (characters.isIgnorableWhiteSpace()
              || characters.isWhiteSpace()) {
            continue;
          }
      }
      this.prevEvent = this.presentEvent;
      this.presentEvent = event;
      break;
    }
  }
}
 
开发者ID:OfficeDev,项目名称:ews-java-api,代码行数:32,代码来源:EwsXmlReader.java

示例3: read

import javax.xml.stream.events.Characters; //导入方法依赖的package包/类
/**
 * Reads the specified node type.
 * 
 * @throws ServiceXmlDeserializationException
 *             the service xml deserialization exception
 * @throws XMLStreamException
 *             the xML stream exception
 */
public void read() throws ServiceXmlDeserializationException,
XMLStreamException {
	// The caller to EwsXmlReader.Read expects
	// that there's another node to
	// read. Throw an exception if not true.
	while (true) {
		if (!xmlReader.hasNext()) {
			throw new ServiceXmlDeserializationException(
					Strings.UnexpectedEndOfXmlDocument);
		} else {
			XMLEvent event = xmlReader.nextEvent();
			if (event.getEventType() == XMLStreamConstants.CHARACTERS) {
				Characters characters = (Characters) event;
				if (characters.isIgnorableWhiteSpace()
						|| characters.isWhiteSpace())
					continue;
			}
			this.prevEvent = this.presentEvent;
			this.presentEvent = event;
			break;
		}
	}
}
 
开发者ID:sheymans,项目名称:todopl,代码行数:32,代码来源:EwsXmlReader.java

示例4: collectEventInfo

import javax.xml.stream.events.Characters; //导入方法依赖的package包/类
private void collectEventInfo(Characters characters) {
    if (currentObjects.size() == 0) {
        return;
    }

    if (characters.isIgnorableWhiteSpace() || characters.isWhiteSpace()) {
        return;
    }

    String text = characters.getData();

    if (currentObjects.peek().containsKey(parents.peek().getName().getLocalPart() + "_value")) {
        String oldText = (String) currentObjects.peek().get(parents.peek().getName().getLocalPart() + "_value");
        text = oldText + text;
    }

    currentObjects.peek().put(parents.peek().getName().getLocalPart() + "_value", text);
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:19,代码来源:XmlParser.java

示例5: parseCharacters

import javax.xml.stream.events.Characters; //导入方法依赖的package包/类
private void parseCharacters(Characters characters) {
    if (!characters.isIgnorableWhiteSpace() && !characters.isWhiteSpace()) {
        String text = characters.getData();
        Object convertedValue = typeProvider.convertType(complexTypeStack.peek().getLeft().getType(), text);
        complexTypeStack.peek().getRight().put("_value", convertedValue);
    }
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:8,代码来源:EdfiRecordParserImpl.java

示例6: read

import javax.xml.stream.events.Characters; //导入方法依赖的package包/类
/**
 * Reads the XMI file by using iterator-style.
 *
 * @param reader the reader to browse
 *
 * @throws XMLStreamException if there is an error with the underlying XML
 */
private void read(XMLEventReader reader) throws XMLStreamException {

    readStartDocument();

    while (reader.hasNext()) {
        XMLEvent event = reader.nextEvent();

        if (event.isStartElement()) {
            StartElement element = event.asStartElement();

            Iterable<Namespace> namespaces = element::getNamespaces;
            for (Namespace ns : namespaces) {
                readNamespace(ns.getPrefix(), ns.getNamespaceURI());
            }

            QName elementName = element.getName();
            readStartElement(elementName.getNamespaceURI(), elementName.getLocalPart());

            Iterable<Attribute> attributes = element::getAttributes;
            for (Attribute attribute : attributes) {
                QName attributeName = attribute.getName();
                readAttribute(
                        attributeName.getPrefix(),
                        attributeName.getLocalPart(),
                        attribute.getValue());
            }

            flushStartElement();
        }
        else if (event.isEndElement()) {
            readEndElement();
        }
        else if (event.isCharacters()) {
            Characters characters = event.asCharacters();

            if (!characters.isWhiteSpace() && !characters.isIgnorableWhiteSpace()) {
                readCharacters(characters.getData());
            }
        }
    }

    readEndDocument();
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:51,代码来源:XmiStAXIteratorReader.java

示例7: writeCharacters

import javax.xml.stream.events.Characters; //导入方法依赖的package包/类
/**
 * Method called by {@link javax.xml.stream.XMLEventWriter}
 * (instead of more generic
 * text output methods), so that we can verify (if necessary) that
 * this character output type is legal in this context. Specifically,
 * it's not acceptable to add non-whitespace content outside root
 * element (in prolog/epilog).
 *<p>
 * Note: cut'n pasted from the main <code>writeCharacters</code>; not
 * good... but done to optimize white-space cases.
 */
public void writeCharacters(Characters ch)
    throws XMLStreamException
{
    // Need to finish an open start element?
    if (mStartElementOpen) {
        closeStartElement(mEmptyElement);
    }

    /* Not legal outside main element tree, except if it's all
     * white space
     */
    if (mCheckStructure) {
        if (inPrologOrEpilog()) {
            if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) {
                reportNwfStructure(ErrorConsts.WERR_PROLOG_NONWS_TEXT);
            }
        }
    }

    if (mVldContent <= XMLValidator.CONTENT_ALLOW_WS) {
        if (mVldContent == XMLValidator.CONTENT_ALLOW_NONE) { // never ok
            reportInvalidContent(CHARACTERS);
        } else { // all-ws is ok...
            if (!ch.isIgnorableWhiteSpace() && !ch.isWhiteSpace()) {
                reportInvalidContent(CHARACTERS);
            }
        }
    } else if (mVldContent == XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT) {
        if (mValidator != null) {
            /* Last arg is false, since we do not know if more text
             * may be added with additional calls
             */
            mValidator.validateText(ch.getData(), false);
        }
    }

    // Ok, let's just write it out:
    try {
        mWriter.writeCharacters(ch.getData());
    } catch (IOException ioe) {
        throw new WstxIOException(ioe);
    }
}
 
开发者ID:FasterXML,项目名称:woodstox,代码行数:55,代码来源:BaseStreamWriter.java


注:本文中的javax.xml.stream.events.Characters.isIgnorableWhiteSpace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。