Java Code Examples for com.sun.xml.internal.txw2.TypedXmlWriter#_attribute
The following examples show how to use
com.sun.xml.internal.txw2.TypedXmlWriter#_attribute .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolicyWSDLGeneratorExtension.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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()); } } }
Example 2
Source File: PolicyWSDLGeneratorExtension.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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()); } } }
Example 3
Source File: TXWContentHandler.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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)); } } } }
Example 4
Source File: PolicyWSDLGeneratorExtension.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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()); } } }
Example 5
Source File: TXWContentHandler.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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)); } } } }
Example 6
Source File: XmlPolicyModelMarshaller.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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); } } }
Example 7
Source File: XmlPolicyModelMarshaller.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 8
Source File: XmlPolicyModelMarshaller.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 9
Source File: XmlPolicyModelMarshaller.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 10
Source File: XmlPolicyModelMarshaller.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example 11
Source File: XmlPolicyModelMarshaller.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); } } }
Example 12
Source File: W3CAddressingMetadataWSDLGeneratorExtension.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) { input._attribute(WSAM_ACTION_QNAME, getInputAction(method)); }
Example 13
Source File: W3CAddressingWSDLGeneratorExtension.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void addAttribute(TypedXmlWriter writer, String attrValue) { writer._attribute(AddressingVersion.W3C.wsdlActionTag, attrValue); }
Example 14
Source File: W3CAddressingMetadataWSDLGeneratorExtension.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) { input._attribute(WSAM_ACTION_QNAME, getInputAction(method)); }
Example 15
Source File: W3CAddressingWSDLGeneratorExtension.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private void addAttribute(TypedXmlWriter writer, String attrValue) { writer._attribute(AddressingVersion.W3C.wsdlActionTag, attrValue); }
Example 16
Source File: W3CAddressingWSDLGeneratorExtension.java From hottub with GNU General Public License v2.0 | 4 votes |
private void addAttribute(TypedXmlWriter writer, String attrValue) { writer._attribute(AddressingVersion.W3C.wsdlActionTag, attrValue); }
Example 17
Source File: W3CAddressingWSDLGeneratorExtension.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private void addAttribute(TypedXmlWriter writer, String attrValue) { writer._attribute(AddressingVersion.W3C.wsdlActionTag, attrValue); }
Example 18
Source File: W3CAddressingWSDLGeneratorExtension.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private void addAttribute(TypedXmlWriter writer, String attrValue) { writer._attribute(AddressingVersion.W3C.wsdlActionTag, attrValue); }
Example 19
Source File: W3CAddressingMetadataWSDLGeneratorExtension.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) { input._attribute(WSAM_ACTION_QNAME, getInputAction(method)); }
Example 20
Source File: W3CAddressingMetadataWSDLGeneratorExtension.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) { input._attribute(WSAM_ACTION_QNAME, getInputAction(method)); }