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


Java LSParserFilter.FILTER_REJECT属性代码示例

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


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

示例1: endDocument

public void endDocument()
  throws SAXException
{
  if (interrupted)
    {
      return;
    }
  super.endDocument();

  switch (getDecision(ctx, false))
    {
    case LSParserFilter.FILTER_REJECT:
      ctx = null;
      doc = null;
      break;
    }

  nodes = null;
  decisions = null;
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:FilteredSAXEventSink.java

示例2: startElement

public void startElement(String uri, String localName, String qName,
                         Attributes atts)
  throws SAXException
{
  if (rejecting || interrupted)
    {
      return;
    }
  Element element = createElement(uri, localName, qName, atts);
  ctx = element;

  short decision = getDecision(element, true);
  nodes.addLast(element);
  decisions.addLast(new Short(decision));

  switch (decision)
    {
    case LSParserFilter.FILTER_REJECT:
      rejecting = true;
      break;
    case LSParserFilter.FILTER_INTERRUPT:
      interrupted = true;
      break;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:FilteredSAXEventSink.java

示例3: endDocument

public void endDocument()
  throws SAXException
{
  if (interrupted)
    {
      return;
    }
  super.endDocument();

  switch (getDecision(ctx, false))
    {
    case LSParserFilter.FILTER_REJECT:
      ctx = null;
      doc = null;
      break;
    }
  
  nodes = null;
  decisions = null;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:20,代码来源:FilteredSAXEventSink.java

示例4: startElement

public void startElement(String uri, String localName, String qName,
                         Attributes atts)
  throws SAXException
{
  if (rejecting || interrupted)
    {
      return;
    }
  Element element = createElement(uri, localName, qName, atts);
  ctx = element;
  
  short decision = getDecision(element, true);
  nodes.addLast(element);
  decisions.addLast(new Short(decision));

  switch (decision)
    {
    case LSParserFilter.FILTER_REJECT:
      rejecting = true;
      break;
    case LSParserFilter.FILTER_INTERRUPT:
      interrupted = true;
      break;
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:25,代码来源:FilteredSAXEventSink.java

示例5: createAttr

protected Attr createAttr(Attributes atts, int index)
{
  Attr attr = super.createAttr(atts, index);
  short decision = getDecision(attr, false);
  switch (decision)
    {
    case LSParserFilter.FILTER_REJECT:
      return null;
    case LSParserFilter.FILTER_INTERRUPT:
      interrupted = true;
      return null;
    }
  return attr;
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:FilteredSAXEventSink.java

示例6: endElement

public void endElement(String uri, String localName, String qName)
  throws SAXException
{
  if (rejecting || interrupted)
    {
      return;
    }
  super.endElement(uri, localName, qName);

  Element element = (Element) nodes.removeLast();
  Node parent = nodes.isEmpty() ? doc : (Node) nodes.getLast();
  ctx = parent;
  short decision = ((Short) decisions.removeLast()).shortValue();
  switch (decision)
    {
    case LSParserFilter.FILTER_SKIP:
      // Add all children of element to parent
      for (Node child = element.getFirstChild(); child != null;
           child = child.getNextSibling())
        {
          parent.insertBefore(child, element);
        }
      return;
    case LSParserFilter.FILTER_REJECT:
      rejecting = false;
      break;
    }
  decision = getDecision(element, false);
  switch (decision)
    {
    case LSParserFilter.FILTER_ACCEPT:
      parent.appendChild(element);
      break;
    case LSParserFilter.FILTER_INTERRUPT:
      interrupted = true;
      break;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:38,代码来源:FilteredSAXEventSink.java

示例7: endElement

public void endElement(String uri, String localName, String qName)
  throws SAXException
{
  if (rejecting || interrupted)
    {
      return;
    }
  super.endElement(uri, localName, qName);
  
  Element element = (Element) nodes.removeLast();
  Node parent = nodes.isEmpty() ? doc : (Node) nodes.getLast();
  ctx = parent;
  short decision = ((Short) decisions.removeLast()).shortValue();
  switch (decision)
    {
    case LSParserFilter.FILTER_SKIP:
      // Add all children of element to parent
      for (Node child = element.getFirstChild(); child != null;
           child = child.getNextSibling())
        {
          parent.insertBefore(child, element);
        }
      return;
    case LSParserFilter.FILTER_REJECT:
      rejecting = false;
      break;
    }
  decision = getDecision(element, false);
  switch (decision)
    {
    case LSParserFilter.FILTER_ACCEPT:
      parent.appendChild(element);
      break;
    case LSParserFilter.FILTER_INTERRUPT:
      interrupted = true;
      break;
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:38,代码来源:FilteredSAXEventSink.java

示例8: acceptNode

@Override
public short acceptNode(Node nodeArg) {
  String textContent = nodeArg.getTextContent();
  if (textContent.trim().isEmpty()) {
    return LSParserFilter.FILTER_REJECT;
  } else {
    return LSParserFilter.FILTER_ACCEPT;
  }
}
 
开发者ID:languagetool-org,项目名称:languagetool,代码行数:9,代码来源:IgnoreWhitespaceFilter.java

示例9: endCDATA

/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:53,代码来源:AbstractDOMParser.java

示例10: setCharacterData

protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:AbstractDOMParser.java

示例11: setCharacterData

protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuffer.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuffer.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuffer.toString ());
                    }
                }
                // reset string buffer
                fStringBuffer.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:49,代码来源:AbstractDOMParser.java


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