Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change 
notification.

The following page has been changed by KelvinGoodson:
http://wiki.apache.org/ws/Tuscany/Java/SDO/ThinkingAloud/OpenContent

------------------------------------------------------------------------------
  </xsd:schema>
  }}}
  
- You have to be able to get hold of a Property that is associated with a 
global element,  the schema above demonstrates one way to create such a beast.  
In the code you can find the Property that is generated from the element 
"simple" with  ...
+ To be able to set a value into a wildcard (<xsd:any>), you have to be able to 
get hold of a Property that is associated with a global element,  the schema 
above demonstrates one way to create such a beast.  In the code you can find 
the Property that is generated from the element "simple" with  ...
  
  {{{
        Property p = 
XSDHelper.INSTANCE.getGlobalProperty("http://www.example.com/simpleGlobalElem";, 
"simple", true);
  }}}
  
- so ...
+ so then you should I think be able to do ...
+ 
+ {{{
+       OpenQuote oq = OpenFactory.INSTANCE.createOpenQuote();
+       Property pc = 
XSDHelper.INSTANCE.getGlobalProperty("http://www.example.com/open";, "note", 
true);
+       ((DataObject)oq).set(pc, "TBA"); 
+ }}}
+ 
+ but there's a problem with the code at the moment I think (I've submitted 
http://issues.apache.org/jira/browse/TUSCANY-396)
+ 
+ so at the moment you have to do something like this ...
+ 
+ {{{
+       OpenQuote oq = OpenFactory.INSTANCE.createOpenQuote();
+       oq.setSymbol("ww");
+ 
+       DataObject doq = (DataObject)oq;
+       
+       boolean isElement = true;
+       Property pc = 
XSDHelper.INSTANCE.getGlobalProperty("http://www.example.com/open";, "note", 
isElement);     
+       
+       List lnote = new ArrayList();
+       lnote.add(new String("TBA"));
+       
+       doq.set(pc, lnote);
+       ByteArrayOutputStream baos = new ByteArrayOutputStream();
+       
+       XMLHelper.INSTANCE.save(doq, "http://www.example.com/open";, 
"openStockQuote", baos);
+       
+       System.out.println(baos.toString());
+ }}} 
+ 
+ which gives ...
+ 
+ {{{
+ <?xml version="1.0" encoding="ASCII"?>
+ <open:openStockQuote xmlns:open="http://www.example.com/open";>
+   <symbol>ww</symbol>
+   <open:note>TBA</open:note>
+ </open:openStockQuote>
+ }}}
+ 
  
  == Open content with max occurs > 1 ==
  

Reply via email to