本文整理汇总了Java中com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator.writeCharacters方法的典型用法代码示例。如果您正苦于以下问题:Java StreamWriterBufferCreator.writeCharacters方法的具体用法?Java StreamWriterBufferCreator.writeCharacters怎么用?Java StreamWriterBufferCreator.writeCharacters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator
的用法示例。
在下文中一共展示了StreamWriterBufferCreator.writeCharacters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBufferFromAddress
import com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator; //导入方法依赖的package包/类
private static XMLStreamBuffer createBufferFromAddress(String address, AddressingVersion version) {
try {
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
StreamWriterBufferCreator w = new StreamWriterBufferCreator(xsb);
w.writeStartDocument();
w.writeStartElement(version.getPrefix(),
"EndpointReference", version.nsUri);
w.writeNamespace(version.getPrefix(), version.nsUri);
w.writeStartElement(version.getPrefix(),version.eprType.address, version.nsUri);
w.writeCharacters(address);
w.writeEndElement();
w.writeEndElement();
w.writeEndDocument();
w.close();
return xsb;
} catch (XMLStreamException e) {
// can never happen because we are writing to XSB
throw new AssertionError(e);
}
}
示例2: writePartialEPRInfoset
import com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator; //导入方法依赖的package包/类
private static void writePartialEPRInfoset(StreamWriterBufferCreator writer, AddressingVersion version, String address, List<Element> referenceParameters, QName service, QName port, QName portType,
List<Element> metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable Map<QName, String> attributes) throws XMLStreamException {
//add extensibile attributes on the EPR element
if (attributes != null) {
for (Map.Entry<QName, String> entry : attributes.entrySet()) {
QName qname = entry.getKey();
writer.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(), entry.getValue());
}
}
writer.writeStartElement(version.getPrefix(), version.eprType.address, version.nsUri);
writer.writeCharacters(address);
writer.writeEndElement();
//When the size of ReferenceParametes is zero, the ReferenceParametes element will not be written.
if(referenceParameters != null && referenceParameters.size() > 0) {
writer.writeStartElement(version.getPrefix(), version.eprType.referenceParameters, version.nsUri);
for (Element e : referenceParameters) {
DOMUtil.serializeNode(e, writer);
}
writer.writeEndElement();
}
switch (version) {
case W3C:
writeW3CMetaData(writer, service, port, portType, metadata, wsdlAddress, wsdlTargetNamespace);
break;
case MEMBER:
writeMSMetaData(writer, service, port, portType, metadata);
if (wsdlAddress != null) {
//Inline the wsdl as extensibility element
//Write mex:Metadata wrapper
writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA.getPrefix(),
MemberSubmissionAddressingConstants.MEX_METADATA.getLocalPart(),
MemberSubmissionAddressingConstants.MEX_METADATA.getNamespaceURI());
writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getPrefix(),
MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getLocalPart(),
MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getNamespaceURI());
writer.writeAttribute(MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_ATTRIBUTE,
MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_VALUE);
writeWsdl(writer, service, wsdlAddress);
writer.writeEndElement();
writer.writeEndElement();
}
break;
}
}
示例3: writeW3CMetaData
import com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator; //导入方法依赖的package包/类
private static void writeW3CMetaData(StreamWriterBufferCreator writer,
QName service,
QName port,
QName portType, List<Element> metadata,
String wsdlAddress, String wsdlTargetNamespace) throws XMLStreamException {
//.NET treate empty metaData element as bad request.
if (isEmty(service) && isEmty(port) && isEmty(portType) && metadata == null/* && wsdlAddress == null*/) {
return;
}
writer.writeStartElement(AddressingVersion.W3C.getPrefix(),
AddressingVersion.W3C.eprType.wsdlMetadata.getLocalPart(), AddressingVersion.W3C.nsUri);
writer.writeNamespace(AddressingVersion.W3C.getWsdlPrefix(),
AddressingVersion.W3C.wsdlNsUri);
//write wsdliLication as defined in WS-Addressing 1.0 Metadata spec
if(wsdlAddress != null) {
writeWsdliLocation(writer, service, wsdlAddress, wsdlTargetNamespace);
}
//Write Interface info
if (portType != null) {
writer.writeStartElement(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
AddressingVersion.W3C.eprType.portTypeName,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
writer.writeNamespace(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
String portTypePrefix = portType.getPrefix();
if (portTypePrefix == null || portTypePrefix.equals("")) {
//TODO check prefix again
portTypePrefix = "wsns";
}
writer.writeNamespace(portTypePrefix, portType.getNamespaceURI());
writer.writeCharacters(portTypePrefix + ":" + portType.getLocalPart());
writer.writeEndElement();
}
if (service != null) {
//Write service and Port info
if (!(service.getNamespaceURI().equals("") || service.getLocalPart().equals(""))) {
writer.writeStartElement(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
AddressingVersion.W3C.eprType.serviceName,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
writer.writeNamespace(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
String servicePrefix = service.getPrefix();
if (servicePrefix == null || servicePrefix.equals("")) {
//TODO check prefix again
servicePrefix = "wsns";
}
writer.writeNamespace(servicePrefix, service.getNamespaceURI());
if (port != null) {
writer.writeAttribute(AddressingVersion.W3C.eprType.portName, port.getLocalPart());
}
writer.writeCharacters(servicePrefix + ":" + service.getLocalPart());
writer.writeEndElement();
}
}
/*
//Inline the wsdl
if (wsdlAddress != null) {
writeWsdl(writer, service, wsdlAddress);
}
*/
//Add the extra metadata Elements
if (metadata != null) {
for (Element e : metadata) {
DOMUtil.serializeNode(e, writer);
}
}
writer.writeEndElement();
}
示例4: writeMSMetaData
import com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator; //导入方法依赖的package包/类
private static void writeMSMetaData(StreamWriterBufferCreator writer,
QName service,
QName port,
QName portType, List<Element> metadata) throws XMLStreamException {
// TODO: write ReferenceProperties
//TODO: write ReferenceParameters
if (portType != null) {
//Write Interface info
writer.writeStartElement(AddressingVersion.MEMBER.getPrefix(),
AddressingVersion.MEMBER.eprType.portTypeName,
AddressingVersion.MEMBER.nsUri);
String portTypePrefix = portType.getPrefix();
if (portTypePrefix == null || portTypePrefix.equals("")) {
//TODO check prefix again
portTypePrefix = "wsns";
}
writer.writeNamespace(portTypePrefix, portType.getNamespaceURI());
writer.writeCharacters(portTypePrefix + ":" + portType.getLocalPart());
writer.writeEndElement();
}
//Write service and Port info
if (service != null) {
if (!(service.getNamespaceURI().equals("") || service.getLocalPart().equals(""))) {
writer.writeStartElement(AddressingVersion.MEMBER.getPrefix(),
AddressingVersion.MEMBER.eprType.serviceName,
AddressingVersion.MEMBER.nsUri);
String servicePrefix = service.getPrefix();
if (servicePrefix == null || servicePrefix.equals("")) {
//TODO check prefix again
servicePrefix = "wsns";
}
writer.writeNamespace(servicePrefix, service.getNamespaceURI());
if (port != null) {
writer.writeAttribute(AddressingVersion.MEMBER.eprType.portName,
port.getLocalPart());
}
writer.writeCharacters(servicePrefix + ":" + service.getLocalPart());
writer.writeEndElement();
}
}
}
示例5: writePartialEPRInfoset
import com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator; //导入方法依赖的package包/类
private static void writePartialEPRInfoset(StreamWriterBufferCreator writer, AddressingVersion version, String address, List<Element> referenceParameters, QName service, QName port, QName portType,
List<Element> metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable Map<QName, String> attributes) throws XMLStreamException {
//add extensibile attributes on the EPR element
if (attributes != null) {
for (Map.Entry<QName, String> entry : attributes.entrySet()) {
QName qname = entry.getKey();
writer.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(), entry.getValue());
}
}
writer.writeStartElement(version.getPrefix(), version.eprType.address, version.nsUri);
writer.writeCharacters(address);
writer.writeEndElement();
if (referenceParameters != null) {
writer.writeStartElement(version.getPrefix(), version.eprType.referenceParameters, version.nsUri);
for (Element e : referenceParameters)
DOMUtil.serializeNode(e, writer);
writer.writeEndElement();
}
switch (version) {
case W3C:
writeW3CMetaData(writer, service, port, portType, metadata, wsdlAddress, wsdlTargetNamespace);
break;
case MEMBER:
writeMSMetaData(writer, service, port, portType, metadata);
if (wsdlAddress != null) {
//Inline the wsdl as extensibility element
//Write mex:Metadata wrapper
writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA.getPrefix(),
MemberSubmissionAddressingConstants.MEX_METADATA.getLocalPart(),
MemberSubmissionAddressingConstants.MEX_METADATA.getNamespaceURI());
writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getPrefix(),
MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getLocalPart(),
MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getNamespaceURI());
writer.writeAttribute(MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_ATTRIBUTE,
MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_VALUE);
writeWsdl(writer, service, wsdlAddress);
writer.writeEndElement();
writer.writeEndElement();
}
break;
}
}
示例6: writeW3CMetaData
import com.sun.xml.internal.stream.buffer.stax.StreamWriterBufferCreator; //导入方法依赖的package包/类
private static void writeW3CMetaData(StreamWriterBufferCreator writer,
QName service,
QName port,
QName portType, List<Element> metadata,
String wsdlAddress, String wsdlTargetNamespace) throws XMLStreamException {
writer.writeStartElement(AddressingVersion.W3C.getPrefix(),
AddressingVersion.W3C.eprType.wsdlMetadata.getLocalPart(), AddressingVersion.W3C.nsUri);
writer.writeNamespace(AddressingVersion.W3C.getWsdlPrefix(),
AddressingVersion.W3C.wsdlNsUri);
//write wsdliLication as defined in WS-Addressing 1.0 Metadata spec
if(wsdlAddress != null)
writeWsdliLocation(writer, service, wsdlAddress,wsdlTargetNamespace);
//Write Interface info
if (portType != null) {
writer.writeStartElement(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
AddressingVersion.W3C.eprType.portTypeName,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
String portTypePrefix = portType.getPrefix();
if (portTypePrefix == null || portTypePrefix.equals("")) {
//TODO check prefix again
portTypePrefix = "wsns";
}
writer.writeNamespace(portTypePrefix, portType.getNamespaceURI());
writer.writeCharacters(portTypePrefix + ":" + portType.getLocalPart());
writer.writeEndElement();
}
if (service != null) {
//Write service and Port info
if (!(service.getNamespaceURI().equals("") || service.getLocalPart().equals(""))) {
writer.writeStartElement(W3CAddressingMetadataConstants.WSAM_PREFIX_NAME,
AddressingVersion.W3C.eprType.serviceName,
W3CAddressingMetadataConstants.WSAM_NAMESPACE_NAME);
String servicePrefix = service.getPrefix();
if (servicePrefix == null || servicePrefix.equals("")) {
//TODO check prefix again
servicePrefix = "wsns";
}
writer.writeNamespace(servicePrefix, service.getNamespaceURI());
if (port != null) {
writer.writeAttribute(AddressingVersion.W3C.eprType.portName, port.getLocalPart());
}
writer.writeCharacters(servicePrefix + ":" + service.getLocalPart());
writer.writeEndElement();
}
}
/*
//Inline the wsdl
if (wsdlAddress != null) {
writeWsdl(writer, service, wsdlAddress);
}
*/
//Add the extra metadata Elements
if (metadata != null)
for (Element e : metadata) {
DOMUtil.serializeNode(e, writer);
}
writer.writeEndElement();
}