Java 类javax.xml.stream.StreamFilter 实例源码

项目:OpenJSharp    文件:XMLStreamFilterImpl.java   
/** Creates a new instance of XMLStreamFilterImpl */

    public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
        fStreamReader = reader;
        this.fStreamFilter = filter;

        //this is debatable to initiate at an acceptable event,
        //but it's neccessary in order to pass the TCK and yet avoid skipping element
        try {
            if (fStreamFilter.accept(fStreamReader)) {
                fEventAccepted = true;
            } else {
                findNextEvent();
            }
        }catch(XMLStreamException xs){
            System.err.println("Error while creating a stream Filter"+xs);
        }
    }
项目:openjdk-jdk10    文件:XMLStreamFilterImpl.java   
/** Creates a new instance of XMLStreamFilterImpl */

    public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
        fStreamReader = reader;
        this.fStreamFilter = filter;

        //this is debatable to initiate at an acceptable event,
        //but it's neccessary in order to pass the TCK and yet avoid skipping element
        try {
            if (fStreamFilter.accept(fStreamReader)) {
                fEventAccepted = true;
            } else {
                findNextEvent();
            }
        }catch(XMLStreamException xs){
            System.err.println("Error while creating a stream Filter"+xs);
        }
    }
项目:openjdk-jdk10    文件:Bug6481678.java   
@Test
public void testReadingNamespace() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);

        while (sr.hasNext()) {
            int eventType = sr.getEventType();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(rootElement)) {
                    Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
                }
            }
            eventType = sr.next();
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk-jdk10    文件:Bug6481678.java   
@Test
public void testRootElementNamespace() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);

        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(rootElement)) {
                    Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk-jdk10    文件:Bug6481678.java   
@Test
public void testChildElementNamespace() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(childElement)) {
                    QName qname = sr.getName();
                    Assert.assertTrue(qname.getPrefix().equals(prefixApple) && qname.getNamespaceURI().equals(namespaceURIApple)
                            && qname.getLocalPart().equals(childElement));
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk-jdk10    文件:Bug6481678.java   
@Test
public void testNamespaceContext() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(childElement)) {
                    NamespaceContext context = sr.getNamespaceContext();
                    Assert.assertTrue(context.getPrefix(namespaceURIApple).equals(prefixApple));
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk-jdk10    文件:Bug6481678.java   
@Test
public void testNamespaceCount() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(rootElement)) {
                    int count = sr.getNamespaceCount();
                    Assert.assertTrue(count == 3);
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk9    文件:XMLStreamFilterImpl.java   
/** Creates a new instance of XMLStreamFilterImpl */

    public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
        fStreamReader = reader;
        this.fStreamFilter = filter;

        //this is debatable to initiate at an acceptable event,
        //but it's neccessary in order to pass the TCK and yet avoid skipping element
        try {
            if (fStreamFilter.accept(fStreamReader)) {
                fEventAccepted = true;
            } else {
                findNextEvent();
            }
        }catch(XMLStreamException xs){
            System.err.println("Error while creating a stream Filter"+xs);
        }
    }
项目:openjdk9    文件:Bug6481678.java   
@Test
public void testReadingNamespace() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);

        while (sr.hasNext()) {
            int eventType = sr.getEventType();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(rootElement)) {
                    Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
                }
            }
            eventType = sr.next();
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk9    文件:Bug6481678.java   
@Test
public void testRootElementNamespace() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);

        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(rootElement)) {
                    Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk9    文件:Bug6481678.java   
@Test
public void testChildElementNamespace() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(childElement)) {
                    QName qname = sr.getName();
                    Assert.assertTrue(qname.getPrefix().equals(prefixApple) && qname.getNamespaceURI().equals(namespaceURIApple)
                            && qname.getLocalPart().equals(childElement));
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk9    文件:Bug6481678.java   
@Test
public void testNamespaceContext() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(childElement)) {
                    NamespaceContext context = sr.getNamespaceContext();
                    Assert.assertTrue(context.getPrefix(namespaceURIApple).equals(prefixApple));
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:openjdk9    文件:Bug6481678.java   
@Test
public void testNamespaceCount() {
    is = new java.io.ByteArrayInputStream(getXML().getBytes());
    try {
        XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
        while (sr.hasNext()) {
            int eventType = sr.next();
            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (sr.getLocalName().equals(rootElement)) {
                    int count = sr.getNamespaceCount();
                    Assert.assertTrue(count == 3);
                }
            }
        }
    } catch (Exception ex) {
        Assert.fail("Exception: " + ex.getMessage());
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:XMLStreamFilterImpl.java   
/** Creates a new instance of XMLStreamFilterImpl */

    public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
        fStreamReader = reader;
        this.fStreamFilter = filter;

        //this is debatable to initiate at an acceptable event,
        //but it's neccessary in order to pass the TCK and yet avoid skipping element
        try {
            if (fStreamFilter.accept(fStreamReader)) {
                fEventAccepted = true;
            } else {
                findNextEvent();
            }
        }catch(XMLStreamException xs){
            System.err.println("Error while creating a stream Filter"+xs);
        }
    }
项目:infobip-open-jdk-8    文件:XMLStreamFilterImpl.java   
/** Creates a new instance of XMLStreamFilterImpl */

    public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
        fStreamReader = reader;
        this.fStreamFilter = filter;

        //this is debatable to initiate at an acceptable event,
        //but it's neccessary in order to pass the TCK and yet avoid skipping element
        try {
            if (fStreamFilter.accept(fStreamReader)) {
                fEventAccepted = true;
            } else {
                findNextEvent();
            }
        }catch(XMLStreamException xs){
            System.err.println("Error while creating a stream Filter"+xs);
        }
    }
项目:OLD-OpenJDK8    文件:XMLStreamFilterImpl.java   
/** Creates a new instance of XMLStreamFilterImpl */

    public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
        fStreamReader = reader;
        this.fStreamFilter = filter;

        //this is debatable to initiate at an acceptable event,
        //but it's neccessary in order to pass the TCK and yet avoid skipping element
        try {
            if (fStreamFilter.accept(fStreamReader)) {
                fEventAccepted = true;
            } else {
                findNextEvent();
            }
        }catch(XMLStreamException xs){
            System.err.println("Error while creating a stream Filter"+xs);
        }
    }
项目:openjdk-icedtea7    文件:XMLStreamFilterImpl.java   
/** Creates a new instance of XMLStreamFilterImpl */

    public XMLStreamFilterImpl(XMLStreamReader reader,StreamFilter filter){
        fStreamReader = reader;
        this.fStreamFilter = filter;

        //this is debatable to initiate at an acceptable event,
        //but it's neccessary in order to pass the TCK and yet avoid skipping element
        try {
            if (fStreamFilter.accept(fStreamReader)) {
                fEventAccepted = true;
            } else {
                findNextEvent();
            }
        }catch(XMLStreamException xs){
            System.err.println("Error while creating a stream Filter"+xs);
        }
    }
项目:openjdk-jdk10    文件:HasNextTest.java   
private XMLStreamReader createStreamReader(HasNextTypeFilter f) {

        try {
            XMLInputFactory factory = XMLInputFactory.newInstance();
            factory = XMLInputFactory.newInstance();
            return factory.createFilteredReader(factory.createXMLStreamReader(this.getClass().getResourceAsStream(INPUT_FILE)), (StreamFilter) f);
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail("Unexpected Exception: " + e.getMessage());
            return null;
        }
    }
项目:openjdk9    文件:HasNextTest.java   
private XMLStreamReader createStreamReader(HasNextTypeFilter f) {

        try {
            XMLInputFactory factory = XMLInputFactory.newInstance();
            factory = XMLInputFactory.newInstance();
            return factory.createFilteredReader(factory.createXMLStreamReader(this.getClass().getResourceAsStream(INPUT_FILE)), (StreamFilter) f);
        } catch (Exception e) {
            e.printStackTrace();
            Assert.fail("Unexpected Exception: " + e.getMessage());
            return null;
        }
    }
项目:techytax-zk    文件:StaxUtils.java   
public static XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) {
    XMLInputFactory factory = getXMLInputFactory();
    try {
        return factory.createFilteredReader(reader, filter);
    } catch (XMLStreamException e) {
        throw new RuntimeException("Cant' create XMLStreamReader", e);
    } finally {
        returnXMLInputFactory(factory);
    }
}
项目:OpenJSharp    文件:StAXFilteredParser.java   
public StAXFilteredParser(XMLStreamReader reader, StreamFilter filter) {
    super(reader);
    _filter = filter;
}
项目:OpenJSharp    文件:StAXFilteredParser.java   
public void setFilter(StreamFilter filter) {
    _filter = filter;
}
项目:openjdk-jdk10    文件:StAXFilteredParser.java   
public StAXFilteredParser(XMLStreamReader reader, StreamFilter filter) {
    super(reader);
    _filter = filter;
}
项目:openjdk-jdk10    文件:StAXFilteredParser.java   
public void setFilter(StreamFilter filter) {
    _filter = filter;
}
项目:openjdk-jdk10    文件:MyInputFactory.java   
@Override
public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:openjdk-jdk10    文件:XMLInputFactoryWrapper.java   
@Override
public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
        throws XMLStreamException {
    return defaultImpl.createFilteredReader(reader, filter);
}
项目:openjdk-jdk10    文件:XMLInputFactoryImpl.java   
@Override
public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
        throws XMLStreamException {
    return null;
}
项目:openjdk9    文件:StAXFilteredParser.java   
public StAXFilteredParser(XMLStreamReader reader, StreamFilter filter) {
    super(reader);
    _filter = filter;
}
项目:openjdk9    文件:StAXFilteredParser.java   
public void setFilter(StreamFilter filter) {
    _filter = filter;
}
项目:openjdk9    文件:MyInputFactory.java   
@Override
public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:openjdk9    文件:XMLInputFactoryImpl.java   
@Override
public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
        throws XMLStreamException {
    return null;
}
项目:lookaside_java-1.8.0-openjdk    文件:StAXFilteredParser.java   
public StAXFilteredParser(XMLStreamReader reader, StreamFilter filter) {
    super(reader);
    _filter = filter;
}
项目:lookaside_java-1.8.0-openjdk    文件:StAXFilteredParser.java   
public void setFilter(StreamFilter filter) {
    _filter = filter;
}
项目:javify    文件:XMLInputFactoryImpl.java   
public XMLStreamReader createFilteredReader(XMLStreamReader reader,
                                            StreamFilter filter)
  throws XMLStreamException
{
  return new FilteredStreamReader(reader, filter);
}
项目:javify    文件:FilteredStreamReader.java   
FilteredStreamReader(XMLStreamReader reader, StreamFilter filter)
{
  super(reader);
  this.reader = reader;
  this.filter = filter;
}
项目:jvm-stm    文件:XMLInputFactoryImpl.java   
public XMLStreamReader createFilteredReader(XMLStreamReader reader,
                                            StreamFilter filter)
  throws XMLStreamException
{
  return new FilteredStreamReader(reader, filter);
}
项目:jvm-stm    文件:FilteredStreamReader.java   
FilteredStreamReader(XMLStreamReader reader, StreamFilter filter)
{
  super(reader);
  this.reader = reader;
  this.filter = filter;
}
项目:jettison    文件:AbstractXMLInputFactory.java   
public XMLStreamReader createFilteredReader(XMLStreamReader arg0, StreamFilter arg1) throws XMLStreamException {
    // TODO Auto-generated method stub
    return null;
}
项目:infobip-open-jdk-8    文件:StAXFilteredParser.java   
public StAXFilteredParser(XMLStreamReader reader, StreamFilter filter) {
    super(reader);
    _filter = filter;
}
项目:infobip-open-jdk-8    文件:StAXFilteredParser.java   
public void setFilter(StreamFilter filter) {
    _filter = filter;
}