java - XMLBeans bounded Atom, setting content of entry -


this question similar 1 : xmlbeans - set content of complex type not quite same. trying set content of contententry in atom feed.

here atom xsd definition contenttype, i.e. content tag entry in atom feed.

<xs:complextype name="contenttype" mixed="true">     <xs:annotation>         <xs:documentation>             atom content construct defined in section 4.1.3 of format spec.         </xs:documentation>     </xs:annotation>     <xs:sequence>         <xs:any namespace="##other" minoccurs="0" maxoccurs="unbounded" />     </xs:sequence>     <xs:attribute name="type" type="xs:string"/>     <xs:attribute name="src" type="xs:anyuri"/>     <xs:attributegroup ref="atom:commonattributes"/> </xs:complextype> 

after compilation xmlbean' scomp, nice jar file makes me able following.

entrytype curentry; curentry = atomfeed.addnewentry(); contenttype curcontent = curentry.addnewcontent(); curcontent.setbase("base"); curcontent.setlang("en-en"); curcontent.setsrc("none"); curcontent.settype("none"); 

and outputted

<content xml:base="base" xml:lang="en-en" src="none" type="none"/> 

i don't want mess official (as official find) xsd atom, missing method able set actual text representation of curcontent. other set functions set(xmlobject object) , setnil().

how can change can :

<content xml:base="base" xml:lang="en-en" src="none" type="none">content of entry</content> 

thanks

you need drop xmlcursor land insert mixed content. example,

    contenttype content = x.addnewcontent();     content.settype("none");      xmlcursor cur = null;     try     {         cur = content.newcursor();         cur.tofirstcontenttoken();         cur.insertchars("hello world");     }         {         cur.dispose();     } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -