本文整理汇总了Java中com.sun.xml.internal.bind.marshaller.SAX2DOMEx类的典型用法代码示例。如果您正苦于以下问题:Java SAX2DOMEx类的具体用法?Java SAX2DOMEx怎么用?Java SAX2DOMEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SAX2DOMEx类属于com.sun.xml.internal.bind.marshaller包,在下文中一共展示了SAX2DOMEx类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ResultImpl
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
ResultImpl() {
try {
DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
s2d = new SAX2DOMEx(factory);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
示例2: readAsSOAPMessage
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
/**
* Default implementation that uses {@link #writeTo(ContentHandler, ErrorHandler)}
*/
public SOAPMessage readAsSOAPMessage() throws SOAPException {
SOAPMessage msg = soapVersion.saajMessageFactory.createMessage();
SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
try {
writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
} catch (SAXException e) {
throw new SOAPException(e);
}
for(Attachment att : getAttachments()) {
AttachmentPart part = msg.createAttachmentPart();
part.setDataHandler(att.asDataHandler());
part.setContentId('<'+att.getContentId()+'>');
msg.addAttachmentPart(part);
}
return msg;
}
示例3: ResultImpl
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
ResultImpl() {
try {
s2d = new SAX2DOMEx();
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
示例4: readAsSOAPMessageSax2Dom
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
try {
message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
} catch (SAXException e) {
throw new SOAPException(e);
}
addAttachmentsToSOAPMessage(msg, message);
if (msg.saveRequired())
msg.saveChanges();
return msg;
}
示例5: getReferenceParameters
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
/**
* Gives a list of Reference Parameters in the Message
* <p>
* Headers which have attribute wsa:IsReferenceParameter="true"
* This is not cached as one may reset the Message.
*<p>
*/
@Property(MessageContext.REFERENCE_PARAMETERS)
public
@NotNull
List<Element> getReferenceParameters() {
Message msg = getMessage();
List<Element> refParams = new ArrayList<Element>();
if (msg == null) {
return refParams;
}
MessageHeaders hl = msg.getHeaders();
for (Header h : hl.asList()) {
String attr = h.getAttribute(AddressingVersion.W3C.nsUri, "IsReferenceParameter");
if (attr != null && (attr.equals("true") || attr.equals("1"))) {
Document d = DOMUtil.createDom();
SAX2DOMEx s2d = new SAX2DOMEx(d);
try {
h.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
refParams.add((Element) d.getLastChild());
} catch (SAXException e) {
throw new WebServiceException(e);
}
/*
DOMResult result = new DOMResult(d);
XMLDOMWriterImpl domwriter = new XMLDOMWriterImpl(result);
try {
h.writeTo(domwriter);
refParams.add((Element) result.getNode().getLastChild());
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
*/
}
}
return refParams;
}
示例6: getReferenceParameters
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
/**
* Gives a list of Reference Parameters in the Message
* <p>
* Headers which have attribute wsa:IsReferenceParameter="true"
* This is not cached as one may reset the Message.
*<p>
*/
@Property(MessageContext.REFERENCE_PARAMETERS)
public @NotNull List<Element> getReferenceParameters() {
List<Element> refParams = new ArrayList<Element>();
HeaderList hl = message.getHeaders();
for(Header h :hl) {
String attr = h.getAttribute(AddressingVersion.W3C.nsUri,"IsReferenceParameter");
if(attr!=null && (attr.equals("true") || attr.equals("1"))) {
Document d = DOMUtil.createDom();
SAX2DOMEx s2d = new SAX2DOMEx(d);
try {
h.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
refParams.add((Element) d.getLastChild());
} catch (SAXException e) {
throw new WebServiceException(e);
}
/*
DOMResult result = new DOMResult(d);
XMLDOMWriterImpl domwriter = new XMLDOMWriterImpl(result);
try {
h.writeTo(domwriter);
refParams.add((Element) result.getNode().getLastChild());
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
*/
}
}
return refParams;
}
示例7: getBuilder
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
private SAX2DOMEx getBuilder() {
return (SAX2DOMEx)out;
}
示例8: marshal
import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //导入依赖的package包/类
public void marshal(Marshaller _m, T t, Node output) throws JAXBException {
MarshallerImpl m = (MarshallerImpl)_m;
m.write(tagName,bi,t,new SAXOutput(new SAX2DOMEx(output)),new DomPostInitAction(output,m.serializer));
}