本文整理汇总了Java中com.sun.xml.internal.txw2.TypedXmlWriter._attribute方法的典型用法代码示例。如果您正苦于以下问题:Java TypedXmlWriter._attribute方法的具体用法?Java TypedXmlWriter._attribute怎么用?Java TypedXmlWriter._attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.internal.txw2.TypedXmlWriter
的用法示例。
在下文中一共展示了TypedXmlWriter._attribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writePolicyOrReferenceIt
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
/**
* Adds a PolicyReference element that points to the policy of the element,
* if the policy does not have any id or name. Writes policy inside the element otherwise.
*
* @param subject
* PolicySubject to be referenced or marshalled
* @param writer
* A TXW on to which we shall add the PolicyReference
*/
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
final Policy policy;
try {
policy = subject.getEffectivePolicy(merger);
} catch (PolicyException e) {
throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
}
if (policy != null) {
if (null == policy.getIdOrName()) {
final PolicyModelGenerator generator = ModelGenerator.getGenerator();
try {
final PolicySourceModel policyInfoset = generator.translate(policy);
marshaller.marshal(policyInfoset, writer);
} catch (PolicyException pe) {
throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
}
} else {
final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
}
}
}
示例2: startElement
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
TypedXmlWriter txw = stack.peek()._element(uri, localName, TypedXmlWriter.class);
stack.push(txw);
if (atts != null) {
for(int i = 0; i < atts.getLength(); i++) {
String auri = atts.getURI(i);
if ("http://www.w3.org/2000/xmlns/".equals(auri)) {
if ("xmlns".equals(atts.getLocalName(i)))
txw._namespace(atts.getValue(i), "");
else
txw._namespace(atts.getValue(i),atts.getLocalName(i));
} else {
if ("schemaLocation".equals(atts.getLocalName(i))
&& "".equals(atts.getValue(i)))
continue;
txw._attribute(auri, atts.getLocalName(i), atts.getValue(i));
}
}
}
}
示例3: marshalPolicyAttributes
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
/**
* Marshal the Policy root element attributes onto the TypedXmlWriter.
*
* @param model The policy source model.
* @param writer The typed XML writer.
*/
private static void marshalPolicyAttributes(final PolicySourceModel model, final TypedXmlWriter writer) {
final String policyId = model.getPolicyId();
if (policyId != null) {
writer._attribute(PolicyConstants.WSU_ID, policyId);
}
final String policyName = model.getPolicyName();
if (policyName != null) {
writer._attribute(model.getNamespaceVersion().asQName(XmlToken.Name), policyName);
}
}
示例4: marshal
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
/**
* Marshal given ModelNode and child elements on given TypedXmlWriter.
*
* @param nsVersion The WS-Policy version.
* @param rootNode The ModelNode that is marshalled.
* @param writer The TypedXmlWriter onto which the content of the rootNode is marshalled.
*/
private void marshal(final NamespaceVersion nsVersion, final ModelNode rootNode, final TypedXmlWriter writer) {
for (ModelNode node : rootNode) {
final AssertionData data = node.getNodeData();
if (marshallInvisible || data == null || !data.isPrivateAttributeSet()) {
TypedXmlWriter child = null;
if (data == null) {
child = writer._element(nsVersion.asQName(node.getType().getXmlToken()), TypedXmlWriter.class);
} else {
child = writer._element(data.getName(), TypedXmlWriter.class);
final String value = data.getValue();
if (value != null) {
child._pcdata(value);
}
if (data.isOptionalAttributeSet()) {
child._attribute(nsVersion.asQName(XmlToken.Optional), Boolean.TRUE);
}
if (data.isIgnorableAttributeSet()) {
child._attribute(nsVersion.asQName(XmlToken.Ignorable), Boolean.TRUE);
}
for (Entry<QName, String> entry : data.getAttributesSet()) {
child._attribute(entry.getKey(), entry.getValue());
}
}
marshal(nsVersion, node, child);
}
}
}
示例5: addAttribute
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
private void addAttribute(TypedXmlWriter writer, String attrValue) {
writer._attribute(AddressingVersion.W3C.wsdlActionTag, attrValue);
}
示例6: addOperationInputExtension
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
@Override
public void addOperationInputExtension(TypedXmlWriter input,
JavaMethod method) {
input._attribute(WSAM_ACTION_QNAME, getInputAction(method));
}
示例7: addOperationOutputExtension
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
@Override
public void addOperationOutputExtension(TypedXmlWriter output,
JavaMethod method) {
output._attribute(WSAM_ACTION_QNAME, getOutputAction(method));
}
示例8: addOperationFaultExtension
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
@Override
public void addOperationFaultExtension(TypedXmlWriter fault,
JavaMethod method, CheckedException ce) {
fault._attribute(WSAM_ACTION_QNAME, getFaultAction(method, ce));
}
示例9: writeName
import com.sun.xml.internal.txw2.TypedXmlWriter; //导入方法依赖的package包/类
/**
* Writes the name attribute if it's named.
*/
private void writeName(NonElement<T,C> c, TypedXmlWriter xw) {
QName tn = c.getTypeName();
if(tn!=null)
xw._attribute("name",tn.getLocalPart()); // named
}