本文整理汇总了Java中groovy.xml.MarkupBuilder类的典型用法代码示例。如果您正苦于以下问题:Java MarkupBuilder类的具体用法?Java MarkupBuilder怎么用?Java MarkupBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MarkupBuilder类属于groovy.xml包,在下文中一共展示了MarkupBuilder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGPathParamValue
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
private Object getGPathParamValue(String varName, String varType) throws ActivityException {
Object value = super.getVariableValue(varName);
com.centurylink.mdw.variable.VariableTranslator translator = VariableTranslator.getTranslator(getPackage(), varType);
if (translator instanceof DocumentReferenceTranslator) {
try {
DocumentReferenceTranslator docRefTranslator = (DocumentReferenceTranslator) translator;
outputDocumentWriter = new StringWriter();
if (isOutputDocument(varName)) {
if (value == null) {
MarkupBuilder builder = new MarkupBuilder(outputDocumentWriter);
builder.setDoubleQuotes(true);
value = builder;
}
else {
value = new XmlParser().parseText(docRefTranslator.realToString(value));
}
}
else {
value = new XmlSlurper().parseText(docRefTranslator.realToString(value));
}
}
catch (Exception ex) {
logger.severeException(ex.getMessage(), ex);
throw new ActivityException(ex.getMessage(), ex);
}
}
return value;
}
示例2: getOperationInfo
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
@GET @Path("/{wsdlUrl}/bindings/{bindingName}/operations/{operationName}")
public SOAPOperationInfo getOperationInfo(@PathParam("wsdlUrl") String wsdlUrl, @PathParam("bindingName") String bindingName,
@PathParam("operationName") String operationName) {
SOAPOperationInfo info = new SOAPOperationInfo();
WSDLParser parser = new WSDLParser();
Definitions definition = parser.parse(wsdlUrl);
StringWriter writer = new StringWriter();
SOARequestCreator creator = new SOARequestCreator(definition, new RequestTemplateCreator(), new MarkupBuilder(writer));
creator.createRequest(null, operationName, bindingName);
info.setSampleRequest(writer.toString());
return info;
}
示例3: HtmlRenderContext
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
public HtmlRenderContext(MarkupBuilder markupBuilder, Transformer<String, File> relativizer) {
this.relativizer = relativizer;
this.markupBuilder = markupBuilder;
}
示例4: getSuiteXmlBuilder
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
public MarkupBuilder getSuiteXmlBuilder() {
return suiteXmlBuilder;
}
示例5: setSuiteXmlBuilder
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
public void setSuiteXmlBuilder(MarkupBuilder suiteXmlBuilder) {
this.suiteXmlBuilder = suiteXmlBuilder;
}
示例6: xmlBuilder
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
public static MarkupBuilder xmlBuilder(Closure c){
MarkupBuilder builder = new MarkupBuilder();
return builder;
}
示例7: createSoapTemplate
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
/**
* Function to create response message template
*
* @param SrcWsdl source wsld : wsdl file path or url
* @param portType callback port type
* @param operation callback operation name
* @param binding callback binding
* @return DOM element of response message template
* @throws IOException If error occurred while parsing string xml to Dom element
* @throws SAXException If error occurred while parsing string xml to Dom element
*/
private static Element createSoapTemplate(String SrcWsdl, String portType, String operation,
String binding)
throws IOException, SAXException {
WSDLParser parser = new WSDLParser();
//BPS-677
int fileLocationPrefixIndex = SrcWsdl.indexOf(HumanTaskConstants.FILE_LOCATION_FILE_PREFIX);
if( SrcWsdl.indexOf(HumanTaskConstants.FILE_LOCATION_FILE_PREFIX) != -1 ){
SrcWsdl = SrcWsdl.substring( fileLocationPrefixIndex + HumanTaskConstants.FILE_LOCATION_FILE_PREFIX
.length());
}
Definitions wsdl = parser.parse(SrcWsdl);
StringWriter writer = new StringWriter();
//SOAPRequestCreator constructor: SOARequestCreator(Definitions, Creator, MarkupBuilder)
SOARequestCreator creator = new SOARequestCreator(wsdl, new RequestTemplateCreator(), new MarkupBuilder(writer));
//creator.createRequest(PortType name, Operation name, Binding name);
creator.createRequest(portType, operation, binding);
Element outGenMessageDom = DOMUtils.stringToDOM(writer.toString());
Element outMsgElement = null;
NodeList nodes = outGenMessageDom.getElementsByTagNameNS(outGenMessageDom.getNamespaceURI(), "Body").item(0).getChildNodes();
if (nodes != null) {
for (int i = 0; i < nodes.getLength(); i++) {
if (nodes.item(i).getNodeType() == Node.ELEMENT_NODE) {
outMsgElement = (Element) nodes.item(i);
break;
}
}
}
if (outMsgElement != null) {
//convert element to string and back to element to remove Owner Document
return DOMUtils.stringToDOM(DOMUtils.domToString(outMsgElement));
}
return null;
}
示例8: html
import groovy.xml.MarkupBuilder; //导入依赖的package包/类
/**
* starts or continues rendering html/angular and returns MarkupBuilder to build html.
* <pre> g.html().with{
* h1("hello")
* h2("world")
* }</pre>
*/
public MarkupBuilder html() {
startOutputType("%angular");
return new MarkupBuilder(out);
}