Thread Attributname sprengt Formatierung (12 answers)
Opened by Commu at 2016-08-23 13:44

Commu
 2016-08-23 13:44
#185277 #185277
User since
2016-08-23
3 Artikel
BenutzerIn
[default_avatar]
Hallo Zusammen,

Aus einem fremdsystem bekomme ich eine XML-Datei die sieht so aus:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="UTF-8"?>
<importrecord>
<dateiname>24845_2874846.fmd</dateiname>
<aktionen>
<transaktion>
<aktion>
<parameter>
<attribut attributname="aktion"></attribut>
<attribut attributname="bereich"></attribut>
<attribut attributname="dokumenttyp"></attribut>
<attribut attributname="voname"></attribut>
<attribut attributname="gz"></attribut>
<attribut attributname="betreff"></attribut>
....


Alle Attribute sind leer. Damit die XML-Datei weiterverarbeitet werden kann muß z.B. das Attribut Attributname='Anlegen' befüllt sein. Hierfür bin ich am testen, denn wenn ich das folgende Script ausführe wird die XML-Datei um gebaut.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
 
    use strict;
    use warnings;

    use XML::Simple;

    my $xml_file = '24845_2874846.fmd';

    my $xml = XMLin(
        $xml_file,
        KeepRoot => 1,
        ForceArray => 1,
    );

    $xml->{importrecord}->[1]->{aktionen}->[0]->{transaktion}->[0]->{parameter}->[0]->{aktion}->[0]->{attribut}->[0] = 'Anlegen';
    XMLout(
        $xml,
        KeepRoot => 1,
        NoAttr => 1,
        OutputFile => $xml_file,
    );


wie muss ich den <attribut attributname="aktion"></attribut> kennzeichnen damit ich in den Tag 'Anlegen' schreiben kann?

Gruß Jörg
Last edited: 2016-08-23 14:54:30 +0200 (CEST)

View full thread Attributname sprengt Formatierung