Examples of StartElementEvent


Examples of com.bea.xml.stream.events.StartElementEvent

    return new NamespaceBase(prefix,namespaceUri);
  }
  public StartElement createStartElement(QName name,
                                         Iterator attributes,
                                         Iterator namespaces){
    StartElementEvent e= 
      new StartElementEvent(name);
    while(attributes != null && attributes.hasNext())
      e.addAttribute((Attribute) attributes.next());
    while(namespaces != null && namespaces.hasNext())
      e.addNamespace((Namespace) namespaces.next());
    return e;

  }
View Full Code Here

Examples of com.bea.xml.stream.events.StartElementEvent

  }

  public StartElement createStartElement(String prefix,
                                         String namespaceUri,
                                         String localName){
    return new StartElementEvent(new QName(namespaceUri,localName,prefix));
  }
View Full Code Here

Examples of com.bea.xml.stream.events.StartElementEvent

                                         String namespaceUri,
                                         String localName,
                                         Iterator attributes,
                                         Iterator namespaces){
    prefix=checkPrefix(prefix);
    StartElementEvent e= 
      new StartElementEvent(new QName(namespaceUri,localName,prefix));
    while(attributes != null && attributes.hasNext())
      e.addAttribute((Attribute) attributes.next());
    while(namespaces != null && namespaces.hasNext())
      e.addNamespace((Namespace) namespaces.next());
    return e;
  }
View Full Code Here

Examples of com.bea.xml.stream.events.StartElementEvent

                                         String localName,
                                         Iterator attributes,
                                         Iterator namespaces,
                                         NamespaceContext context){
    prefix=checkPrefix(prefix);
    StartElementEvent e= 
      new StartElementEvent(new QName(namespaceUri,localName,prefix));
    while(attributes != null && attributes.hasNext())
      e.addAttribute((Attribute)attributes.next());
    while(namespaces != null && namespaces.hasNext())
      e.addNamespace((Namespace)namespaces.next());
    e.setNamespaceContext(context);
    return e;
  }
View Full Code Here

Examples of org.apache.vysper.xml.sax.impl.TestHandler.StartElementEvent

    protected void assertStartElement(String expectedUri, String expectedLocalName, String expectedQName,
            Attributes expectedAttributes, TestEvent actual) {
        printIfFatal(actual);
        if (!(actual instanceof StartElementEvent))
            fail("Event must be StartElementEvent but was " + actual.getClass());
        StartElementEvent startElementEvent = (StartElementEvent) actual;
        assertEquals("URI", expectedUri, startElementEvent.getURI());
        assertEquals("local name", expectedLocalName, startElementEvent.getLocalName());
        assertEquals("qName", expectedQName, startElementEvent.getQName());
        assertAttributes(expectedAttributes, startElementEvent.getAtts());
    }
View Full Code Here

Examples of org.more.xml.stream.StartElementEvent

    @Override
    public synchronized void sendEvent(final XmlStreamEvent e) throws XMLStreamException, IOException {
        //1.处理StartElementEvent
        if (e instanceof StartElementEvent) {
            this.activateStack.createStack();
            StartElementEvent ee = (StartElementEvent) e;
            //
            int nsCount = ee.getNamespaceCount();
            for (int i = 0; i < nsCount; i++) {
                String prefix = ee.getNamespacePrefix(i);
                String uri = ee.getNamespaceURI(i);
                prefix = prefix == null ? "" : prefix;
                NameSpace ns = this.activateStack.getNameSpace(prefix);
                if (ns == null) {
                    //激活新的命名空间
                    this.activateStack.addNameSpace(prefix, new NameSpace(uri, "/"));
                }
            }
            //生成当前节点的xpath(专属命名空间下的xpath)
            String prefix = ee.getPrefix();
            prefix = prefix == null ? "" : prefix;
            NameSpace ns = this.activateStack.getNameSpace(prefix);
            ns.appendXPath(ee.getElementName(), false);
            this.issueEvent(e, this.activateStack);
            //如果执行的是跳过则删除其加入的xpath,因为reader不会再发送其end事件。
            if (e.isSkip() == true) {
                ns.removeXPath();
            }
            return;
        } else
        //2.处理EndElementEvent
        if (e instanceof EndElementEvent) {
            EndElementEvent ee = (EndElementEvent) e;
            NameSpace ns = this.activateStack.getNameSpace(ee.getPrefix());
            this.issueEvent(e, this.activateStack);
            ns.removeXPath();
            this.activateStack.dropStack();
            return;
        } else
        //3.处理AttributeEvent
        if (e instanceof AttributeEvent) {
            this.activateStack.createStack();
            AttributeEvent ee = (AttributeEvent) e;
            String prefix = ee.getName().getPrefix();
            prefix = prefix == null ? "" : prefix;
            if (prefix.equals("") == true) {
                prefix = ee.getCurrentElement().getPrefix();
            }
            prefix = prefix == null ? "" : prefix;
            //
            NameSpace ns = this.activateStack.getNameSpace(prefix);
            ns.appendXPath(ee.getElementName(), true);
            this.issueEvent(e, this.activateStack);
            ns.removeXPath();
            this.activateStack.dropStack();
            return;
        } else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.