1

Please, as it could indicate the 'type' attribute on elements 'horaIniJornada' and 'tiempoJornadamedia'?

    @XmlElement(name = "tiempoJornadaMedia")
    public String getTimeJournalMedia() {
        return timeJournalMedia;
    }

    @XmlAttribute(name = "tipo")
    public String getTypeHourInitJournal() {
        return typeHourInitJournal;
    }

<configuraciones>
  <almacen>MD</almacen>
  <cliente>MKD</cliente>
     <secciones>
        <seccion>
            <seccId>70</seccId>
            <horaIniJornada tipo="T">23:00:00</horaIniJornada>
            <tiempoJornadaMedia tipo="T">07:30:00</tiempoJornadaMedia>
        </seccion>
        <seccion>
             <seccId>71</seccId>
             <horaIniJornada tipo="T">23:00:00</horaIniJornada>
             <tiempoJornadaMedia tipo="T">07:30:00</tiempoJornadaMedia>
         </seccion>
      </secciones>
</configuraciones>

1 Answer 1

1

You'll need a separate class for that. Something like TimeHournalMedia with an @XmlAttribute and @XmlValue property. Something like:

@XmlValue
public String getValue() {
    return value;
}

@XmlAttribute(name = "tipo")
public String getTypeHourInitJournal() {
    return typeHourInitJournal;
}

Then you'll have in your main class:

@XmlElement(name = "tiempoJornadaMedia")
public TimeHournalMedia getTimeJournalMedia() {
    return timeJournalMedia;
}

To get the textual content you'll do getTimeJournalMedia().getValue(), to get the attribute - getTimeJournalMedia().getgetTypeHourInitJournal(), something like that.

There are further options with MOXy @XmlPath.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.