tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
1
ZUGRIFFE
315
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Freak2k Freak2k ist offline Mitglied Gold
    Registriert seit
    Apr 2005
    Beiträge
    129
    Hallo,

    folgendes Szenario:

    Code :
    1
    2
    3
    4
    5
    
    ...
    <topic title="myTopic">
        Hier kommt ne ganze Menge Text zom Thema (kann auch HTML enthalten)
    </topic>
    ...

    Wie wird der Text gemappt?
    Worauf ist zu achten, wenn der Text HTML ist?

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    
    @XmlRootElement(name = HelpTopic.TAG)
    public class HelpTopic {
     
        @XmlTransient
        public static final String TAG = "topic";
     
        private String title;   
        private String text;
     
        /**
         * Creates a new HelpTopic
         */
        public HelpTopic() {
     
        }
     
        /**
         * Gets the title of the topic
         * 
         * @return The title
         */
        @XmlAttribute(name = "title")
        public String getTitle() {
            return title;
        }
     
        /**
         * Sets the title of the topic
         * 
         * @param title
         *            The title
         */
        public void setTitle(String title) {
            this.title = title;
        }
     
        /**
         * Gets the text of the topic
         * 
         * @return The text
         */
        public String getText() {  // <--- Was kommt hier hin
            return text;
        }
     
        /**
         * Sets the text of the topic
         * 
         * @param text
         *            The topic
         */
        public void setText(String text) {
            this.text = text;
        }
    }

    Danke
    Geändert von Freak2k (28.10.08 um 16:21 Uhr)
     

  2. #2
    Registriert seit
    Jun 2002
    Ort
    Saarbrücken (Saarland)
    Beiträge
    9.886
    Blog-Einträge
    29
    Hallo,

    versuchs mal mit @XmlValue

    schau mal hier:
    http://www.tutorials.de/forum/java/3...rshalling.html
    http://www.tutorials.de/forum/java/2...-tutorial.html

    Wenn du als text html zulassen willst musst du das in einer <![CData[....]]> Section schachteln.

    Gruß Tom
     
    Java rocks!
    How to become a good Java Programmer?
    Does IT in Java and .Net
    The only valid measurement of code quality: WTFs / minute
    Blog
    Xing
    Twitter

Ähnliche Themen

  1. JAXB und Java Type Mapping
    Von saftmeister im Forum Java
    Antworten: 3
    Letzter Beitrag: 26.02.10, 20:55
  2. JAXB + Eclipse
    Von meni im Forum Java
    Antworten: 3
    Letzter Beitrag: 05.06.09, 11:06
  3. von UVW mapping zu Kugel-Mapping überblenden ?
    Von Principal im Forum Cinema 4D
    Antworten: 7
    Letzter Beitrag: 19.12.08, 17:20
  4. Jaxb
    Von nowacz im Forum Java
    Antworten: 1
    Letzter Beitrag: 02.08.07, 12:31
  5. Antworten: 0
    Letzter Beitrag: 24.06.07, 00:46