本文整理汇总了Java中com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer类的典型用法代码示例。如果您正苦于以下问题:Java MutableXMLStreamBuffer类的具体用法?Java MutableXMLStreamBuffer怎么用?Java MutableXMLStreamBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MutableXMLStreamBuffer类属于com.sun.xml.internal.stream.buffer包,在下文中一共展示了MutableXMLStreamBuffer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
public MutableXMLStreamBuffer create(XMLReader reader, InputStream in, String systemId) throws IOException, SAXException {
if (_buffer == null) {
createBuffer();
}
_buffer.setSystemId(systemId);
reader.setContentHandler(this);
reader.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, this);
try {
setHasInternedStrings(reader.getFeature(Features.STRING_INTERNING_FEATURE));
} catch (SAXException e) {
}
if (systemId != null) {
InputSource s = new InputSource(systemId);
s.setByteStream(in);
reader.parse(s);
} else {
reader.parse(new InputSource(in));
}
return getXMLStreamBuffer();
}
示例2: readPayload
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
@Override
public XMLStreamReader readPayload() throws XMLStreamException {
try {
if(infoset==null) {
if (rawContext != null) {
XMLStreamBufferResult sbr = new XMLStreamBufferResult();
Marshaller m = rawContext.createMarshaller();
m.setProperty("jaxb.fragment", Boolean.TRUE);
m.marshal(jaxbObject, sbr);
infoset = sbr.getXMLStreamBuffer();
} else {
MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
writePayloadTo(buffer.createFromXMLStreamWriter());
infoset = buffer;
}
}
XMLStreamReader reader = infoset.readAsXMLStreamReader();
if(reader.getEventType()== START_DOCUMENT)
XMLStreamReaderUtil.nextElementContent(reader);
return reader;
} catch (JAXBException e) {
// bug 6449684, spec 4.3.4
throw new WebServiceException(e);
}
}
示例3: createBufferFromAddress
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的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);
}
}
示例4: getSchemaOutput
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
/**
* Updates filename if the suggested filename need to be changed in
* xsd:import. If there is already a schema document for the namespace
* in the metadata, then it is not generated.
*
* return null if schema need not be generated
* Result the generated schema document
*/
public Result getSchemaOutput(String namespace, Holder<String> filename) {
List<SDDocumentImpl> schemas = nsMapping.get(namespace);
if (schemas != null) {
if (schemas.size() > 1) {
throw new ServerRtException("server.rt.err",
"More than one schema for the target namespace "+namespace);
}
filename.value = schemas.get(0).getURL().toExternalForm();
return null; // Don't generate schema
}
URL url = createURL(filename.value);
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
xsb.setSystemId(url.toExternalForm());
SDDocumentSource sd = SDDocumentSource.create(url,xsb);
newDocs.add(sd);
XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
r.setSystemId(filename.value);
return r;
}
示例5: createElementFragment
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
/**
* Creates the buffer from a stream reader that is an element fragment.
* <p>
* The stream reader will be moved to the position of the next start of
* an element if the stream reader is not already positioned at the start
* of an element.
* <p>
* The element and all its children will be stored and after storing the stream
* will be positioned at the next event after the end of the element.
* <p>
* @param storeInScopeNamespaces true if in-scope namespaces of the element
* fragment should be stored.
* @return the mutable stream buffer.
* @throws XMLStreamException if the stream reader cannot be positioned at
* the start of an element.
*/
public MutableXMLStreamBuffer createElementFragment(XMLStreamReader reader,
boolean storeInScopeNamespaces) throws XMLStreamException {
if (_buffer == null) {
createBuffer();
}
if (!reader.hasNext()) {
return _buffer;
}
_storeInScopeNamespacesOnElementFragment = storeInScopeNamespaces;
_eventType = reader.getEventType();
if (_eventType != XMLStreamReader.START_ELEMENT) {
do {
_eventType = reader.next();
} while(_eventType != XMLStreamReader.START_ELEMENT && _eventType != XMLStreamReader.END_DOCUMENT);
}
if (storeInScopeNamespaces) {
_inScopePrefixes = new HashMap<String,Integer>();
}
storeElementAndChildren(reader);
return getXMLStreamBuffer();
}
示例6: cacheHeaders
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
private static XMLStreamBuffer cacheHeaders(XMLStreamReader reader,
Map<String, String> namespaces, HeaderList headers,
StreamHeaderDecoder headerDecoder) throws XMLStreamException {
MutableXMLStreamBuffer buffer = createXMLStreamBuffer();
StreamReaderBufferCreator creator = new StreamReaderBufferCreator();
creator.setXMLStreamBuffer(buffer);
// Reader is positioned at the first header block
while(reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT) {
Map<String,String> headerBlockNamespaces = namespaces;
// Collect namespaces on SOAP header block
if (reader.getNamespaceCount() > 0) {
headerBlockNamespaces = new HashMap<String,String>(namespaces);
for (int i = 0; i < reader.getNamespaceCount(); i++) {
headerBlockNamespaces.put(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
}
}
// Mark
XMLStreamBuffer mark = new XMLStreamBufferMark(headerBlockNamespaces, creator);
// Create Header
headers.add(headerDecoder.decodeHeader(reader, mark));
// Cache the header block
// After caching Reader will be positioned at next header block or
// the end of the </soap:header>
creator.createElementFragment(reader, false);
if (reader.getEventType() != XMLStreamConstants.START_ELEMENT &&
reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
XMLStreamReaderUtil.nextElementContent(reader);
}
}
return buffer;
}
示例7: createXMLStreamBuffer
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
private static MutableXMLStreamBuffer createXMLStreamBuffer() {
// TODO: Decode should own one MutableXMLStreamBuffer for reuse
// since it is more efficient. ISSUE: possible issue with
// lifetime of information in the buffer if accessed beyond
// the pipe line.
return new MutableXMLStreamBuffer();
}
示例8: readHeader
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
public XMLStreamReader readHeader() throws XMLStreamException {
if(infoset==null) {
MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
writeTo(buffer.createFromXMLStreamWriter());
infoset = buffer;
}
return infoset.readAsXMLStreamReader();
}
示例9: WSEndpointReference
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
/**
* Creates from the spec version of {@link EndpointReference}.
*
* <p>
* This method performs the data conversion, so it's slow.
* Do not use this method in a performance critical path.
*/
public WSEndpointReference(EndpointReference epr, AddressingVersion version) {
try {
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
epr.writeTo(new XMLStreamBufferResult(xsb));
this.infoset = xsb;
this.version = version;
this.rootElement = new QName("EndpointReference", version.nsUri);
parse();
} catch (XMLStreamException e) {
throw new WebServiceException(ClientMessages.FAILED_TO_PARSE_EPR(epr),e);
}
}
示例10: getWSDL
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
/**
* Generates the concrete WSDL that contains service element.
*
* @return Result the generated concrete WSDL
*/
public Result getWSDL(String filename) {
URL url = createURL(filename);
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
xsb.setSystemId(url.toExternalForm());
concreteWsdlSource = SDDocumentSource.create(url,xsb);
newDocs.add(concreteWsdlSource);
XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
r.setSystemId(filename);
return r;
}
示例11: getAbstractWSDL
import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer; //导入依赖的package包/类
/**
* Updates filename if the suggested filename need to be changed in
* wsdl:import. If the metadata already contains abstract wsdl(i.e. a WSDL
* which has the porttype), then the abstract wsdl shouldn't be generated
*
* return null if abstract WSDL need not be generated
* Result the abstract WSDL
*/
public Result getAbstractWSDL(Holder<String> filename) {
if (abstractWsdl != null) {
filename.value = abstractWsdl.getURL().toString();
return null; // Don't generate abstract WSDL
}
URL url = createURL(filename.value);
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
xsb.setSystemId(url.toExternalForm());
SDDocumentSource abstractWsdlSource = SDDocumentSource.create(url,xsb);
newDocs.add(abstractWsdlSource);
XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
r.setSystemId(filename.value);
return r;
}