Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - How do you customize how JAXB generates plural method names? -


we using jaxb generate java classes , have encountered few cases generated plural method names not correct. example, expect getphysicians getting getphysicien. how customize how jaxb pluralizes specific methods?

the schema:

<xs:complextype name="physician">     <xs:sequence>        ...     </xs:sequence> </xs:complextype>  <xs:complextype name="physicianlist">     <xs:sequence>         <xs:element name="physician"                     type="physician"                     minoccurs="0"                     maxoccurs="unbounded"/>     </xs:sequence> </xs:complextype> 

the generated java code:

... public class physicianlist { ...      @xmlelement(name = "physician")     protected list<physician> physicien;     ...      public list<physician> getphysicien() {         if (physicien == null) {             physicien = new arraylist<physician>();         }         return this.physicien;     } 

update

this has been answered blaise. however, prefer not mixing concerns such jaxb customizations in xml schema. of same preference, here jaxb binding file achieves same thing blaise suggested, keeping jaxb customization out of schema:

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"                xmlns:xs="http://www.w3.org/2001/xmlschema"                version="2.0">      <jaxb:bindings schemalocation="myschema.xsd">         <jaxb:bindings node="//xs:complextype[@name='physicianlist']//xs:element[@name='physician']">             <jaxb:property name="physicians"/>         </jaxb:bindings>     </jaxb:bindings>  </jaxb:bindings> 

by default following generated schema fragment:

    import java.util.arraylist;     import java.util.list;     import javax.xml.bind.annotation.xmlaccesstype;     import javax.xml.bind.annotation.xmlaccessortype;     import javax.xml.bind.annotation.xmlelement;     import javax.xml.bind.annotation.xmltype;      @xmlaccessortype(xmlaccesstype.field)     @xmltype(name = "physicianlist", proporder = {         "physician"     })     public class physicianlist {          @xmlelement(name = "physician")         protected list<physician> physician;          public list<physician> getphysician() {             if (physician == null) {                 physician = new arraylist<physician>();             }             return this.physician;         }      } 

if annotate xml schema:

    <xs:schema         xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"         xmlns:xs="http://www.w3.org/2001/xmlschema"         jaxb:version="2.1">          <xs:complextype name="physician">             <xs:sequence>             </xs:sequence>         </xs:complextype>          <xs:complextype name="physicianlist">             <xs:sequence>                 <xs:element name="physician"                             type="physician"                             minoccurs="0"                             maxoccurs="unbounded">                       <xs:annotation>                           <xs:appinfo>                               <jaxb:property name="physicians"/>                           </xs:appinfo>                       </xs:annotation>                  </xs:element>             </xs:sequence>         </xs:complextype>      </xs:schema> 

then can generate desired class:

import java.util.arraylist; import java.util.list; import javax.xml.bind.annotation.xmlaccesstype; import javax.xml.bind.annotation.xmlaccessortype; import javax.xml.bind.annotation.xmlelement; import javax.xml.bind.annotation.xmltype;  @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "physicianlist", proporder = {     "physicians" }) public class physicianlist {      @xmlelement(name = "physician")     protected list<physician> physicians;      public list<physician> getphysicians() {         if (physicians == null) {             physicians = new arraylist<physician>();         }         return this.physicians;     }  } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -