You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "David Illsley (JIRA)" <ji...@apache.org> on 2007/07/01 20:00:10 UTC
[jira] Commented: (WSCOMMONS-212) adding QName support to attribute
values
[ https://issues.apache.org/jira/browse/WSCOMMONS-212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509441 ]
David Illsley commented on WSCOMMONS-212:
-----------------------------------------
Surely since the QName will contain namespace information, the omNamespace in your example is redundant...
> adding QName support to attribute values
> ----------------------------------------
>
> Key: WSCOMMONS-212
> URL: https://issues.apache.org/jira/browse/WSCOMMONS-212
> Project: WS-Commons
> Issue Type: New Feature
> Components: AXIOM
> Reporter: Amila Chinthaka Suriarachchi
> Priority: Minor
>
> Currently there is no direct API method to give an QName as an attribute value.
> for an example lets say I have to create and OMElment for this xml string (programatically)
> <ns1:inObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="xsd:string">Test String</ns1:inObject>
> I managed to do it in this way by declaring the namespace and set it as a normal attribute.
> OMFactory omFactory = OMAbstractFactory.getOMFactory();
> OMNamespace omNamespace1 = omFactory.createOMNamespace("http://tempuri.org/","ns1");
> OMNamespace omNamespace2 = omFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance","xsi");
> OMNamespace omNamespace3 = omFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema","xsd");
> OMElement omElement = omFactory.createOMElement("inObject",omNamespace1);
> omElement.declareNamespace(omNamespace3);
> OMAttribute omatribute = omFactory.createOMAttribute("type",omNamespace2,"xsd:string");
> omElement.addAttribute(omatribute);
> omElement.setText("Test String");
> but nice to have a method
> createOMAttribute(String,omNamespace,QName)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org