當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。