當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLStreamReader.getName方法代碼示例

本文整理匯總了Java中javax.xml.stream.XMLStreamReader.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLStreamReader.getName方法的具體用法?Java XMLStreamReader.getName怎麽用?Java XMLStreamReader.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.stream.XMLStreamReader的用法示例。


在下文中一共展示了XMLStreamReader.getName方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readResponse

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
final Object readResponse(Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    return setter.put(obj,args);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:ResponseBuilder.java

示例2: readRequest

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
void readRequest( Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException {
    Object obj = null;
    AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null;
    if (bridge instanceof RepeatedElementBridge) {
        RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge;
        ArrayList list = new ArrayList();
        QName name = r.getName();
        while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) {
            list.add(rbridge.unmarshal(r, au));
            XMLStreamReaderUtil.toNextTag(r, name);
        }
        obj = rbridge.collectionHandler().convert(list);
    } else {
        obj = bridge.unmarshal(r, au);
    }
    setter.put(obj,args);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:EndpointArgumentsBuilder.java

示例3: readWrappedRequest

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    if (!msg.hasPayload()) {
        throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
    }
    XMLStreamReader reader = msg.readPayload();
    XMLStreamReaderUtil.verifyTag(reader,wrapperName);
    reader.nextTag();
    while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
        // TODO: QName has a performance issue
        QName name = reader.getName();
        WrappedPartBuilder part = wrappedParts.get(name);
        if(part==null) {
            // no corresponding part found. ignore
            XMLStreamReaderUtil.skipElement(reader);
            reader.nextTag();
        } else {
            part.readRequest(args,reader, msg.getAttachments());
        }
        XMLStreamReaderUtil.toNextTag(reader, name);
    }

    // we are done with the body
    reader.close();
    XMLStreamReaderFactory.recycle(reader);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:26,代碼來源:EndpointArgumentsBuilder.java

示例4: testStartElement

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
@Test
public void testStartElement() {
    try {
        XMLInputFactory xif = XMLInputFactory.newInstance();
        // File file = new File("./tests/XMLStreamReader/sgml.xml");
        // FileInputStream inputStream = new FileInputStream(file);
        XMLStreamReader xsr = xif.createXMLStreamReader(this.getClass().getResourceAsStream("sgml.xml"));

        xsr.getName();
    } catch (IllegalStateException ise) {
        // expected
        System.out.println(ise.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("Exception occured: " + e.getMessage());
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:Issue44Test.java

示例5: testChildElementNamespace

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
@Test
public void testChildElementNamespace() {
    try {
        XMLInputFactory xif = XMLInputFactory.newInstance();
        xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
        InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
        XMLStreamReader sr = xif.createXMLStreamReader(is);
        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(prefix) && qname.getNamespaceURI().equals(namespaceURI)
                            && qname.getLocalPart().equals(childElement));
                }
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:NamespaceTest.java

示例6: testChildElementNamespace

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
@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());
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:Bug6481678.java

示例7: addressibleElement

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) {
    QName ua = reader.getName();
    if (ua.equals(AddressingVersion.W3C.wsdlExtensionTag)) {
        String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required");
        binding.addFeature(new AddressingFeature(true, Boolean.parseBoolean(required)));
        XMLStreamReaderUtil.skipElement(reader);
        return true;        // UsingAddressing is consumed
    }

    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:W3CAddressingWSDLParserExtension.java

示例8: bindingOperationElements

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
@Override
public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
    EditableWSDLBoundOperation edit = (EditableWSDLBoundOperation) operation;

    QName anon = reader.getName();
    if (anon.equals(AddressingVersion.W3C.wsdlAnonymousTag)) {
        try {
            String value = reader.getElementText();
            if (value == null || value.trim().equals("")) {
                throw new WebServiceException("Null values not permitted in wsaw:Anonymous.");
                // TODO: throw exception only if wsdl:required=true
                // TODO: is this the right exception ?
            } else if (value.equals("optional")) {
                edit.setAnonymous(ANONYMOUS.optional);
            } else if (value.equals("required")) {
                edit.setAnonymous(ANONYMOUS.required);
            } else if (value.equals("prohibited")) {
                edit.setAnonymous(ANONYMOUS.prohibited);
            } else {
                throw new WebServiceException("wsaw:Anonymous value \"" + value + "\" not understood.");
                // TODO: throw exception only if wsdl:required=true
                // TODO: is this the right exception ?
            }
        } catch (XMLStreamException e) {
            throw new WebServiceException(e);       // TODO: is this the correct behavior ?
        }

        return true;        // consumed the element
    }

    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:33,代碼來源:W3CAddressingWSDLParserExtension.java

示例9: addressibleElement

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
private boolean addressibleElement(XMLStreamReader reader, WSDLFeaturedObject binding) {
    QName ua = reader.getName();
    if (ua.equals(AddressingVersion.MEMBER.wsdlExtensionTag)) {
        String required = reader.getAttributeValue(WSDLConstants.NS_WSDL, "required");
        binding.addFeature(new MemberSubmissionAddressingFeature(Boolean.parseBoolean(required)));
        XMLStreamReaderUtil.skipElement(reader);
        return true;        // UsingAddressing is consumed
    }

    return false;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:MemberSubmissionAddressingWSDLParserExtension.java

示例10: failWithFullName

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
protected static void failWithFullName(String key, XMLStreamReader reader) {
    throw new ServerRtException(
            key,
            reader.getLocation().getLineNumber(),
            reader.getName());
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:7,代碼來源:DeploymentDescriptorParser.java

示例11: pre

import javax.xml.stream.XMLStreamReader; //導入方法依賴的package包/類
private QName pre(XMLStreamReader xsr) {
    return xsr.getName();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:4,代碼來源:FoolProofParserExtension.java


注:本文中的javax.xml.stream.XMLStreamReader.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。