Tabelle parser

Einklappen
Dieses Thema ist geschlossen.
X
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Tabelle parser

    Hallo ! Ich bin ein für mich schwiriges Problem gestossen.Kann mir jemand helfen?
    Ich habe ein Expatparser Programm geschrieben.Jetzt will ich meine Daten von der inneren Tabelle in ein array sammeln(von der innen drin mit Berlin usw.

    Mein html Programm:Studien2a.html:
    PHP-Code:
    <html>
    <
    head>
    <
    titleNatascha </title>
    </
    head>
    <
    body width="60%" height="400">
    <
    form name="form1" method="post" action="expatnew4_st.php"
    <
    table border="8" width="60%" height="400" bgcolor="#FF00FF" bordercolordark="#FF00FF" bordercolorlight"#CCC444" align="center"
    <
    tr
    <
    td
    <
    h1Überschrift 1.Ordnung cdfdsfdsfdsfdsfdsfdsfdfdsfdsfdsfdsfsdsdasdasdsadsadasdasl </h1
    </
    td
    </
    tr>
    <
    TR
    <
    TD
    <
    H2Überschrift2.Ordnung hdsadk kdksdlsL Lasa xxx vfgffg fssaEbbbhh jjjjj kkkkkll dddcsxc xs sdsd cd </H2
    </
    TD
    </
    TR>
    <
    tr>
    <
    td>
    <
    h3>Uuml;berschrift 3.Ordnung </h3>
    </
    td>
    </
    tr>
    <
    tr>
    <
    td
    <
    input type ="text" size="10" name "inputfeld">test 3 </input>
    </
    td>
    </
    tr>
    <
    tr
    <
    td
    <
    input type "reset"test4 </input>
    </
    td>
    </
    tr>
    <
    tr
    <
    td
    <
    INPUT TYPE ="radio" NAME "kreis1" checked="1"test1 </INPUT>
    </
    td>
    </
    tr>
    <
    tr
    <
    td
    <
    input type "submit" value="Absenden"test5 </input>
    </
    td>
    </
    tr>
    <
    tr
    <
    td
    <
    input type ="button" name "option" value="$jdsajdksadkasdkksakdksadkksadksad">test6 </input>
    </
    td>
    </
    tr>
    <
    tr
    <
    td
    <
    input type ="checkbox" name "rechteck" checked="1">test7 </input>
    </
    td>
    </
    tr>
    <
    tr
    <
    td>
    <
    input type ="radio" name "kreis" >test8</input>
    </
    td>
    </
    tr>
    <
    tr>
    <
    td>
    <
    select name "selectliste" size="1" multiple="1"
    <
    option value="Beispiel"Beispiel </option
    <
    option value="Beispiel 1"Beispiel 1 </option
    <
    option value="Beispiel 2"Beispiel 2 </optiontest9
    </select
    </
    td>
    </
    tr>
    <
    tr
    <
    td
    <
    textarea name="text" size="10" cols="50" rows="10"PWOPOPQOPWOPQOPWOPQPOWQOPccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
    jjjjllllllllllllllllllllllllllllll 
    </textarea
    </
    td
    </
    tr>
    <
    tr
    <
    td
    <
    input type ="checkbox" name "rechteck1"test9</input>
    </
    td>
    </
    tr>
    <
    tr
    <
    td>
    <
    a href="http://www.antloop.de" target="_blank">anTlooooooooooooooooooooop</a>
    </
    td>
    </
    tr>
    <
    tr
    <
    td>
    <
    table border="8">
    <
    tr>
    <
    td>Berlin</td>
    <
    td>Hamburg</td>
    <
    td>München</td>
    </
    tr>
    <
    tr>
    <
    td>Miljöh</td>
    <
    td>Kiez</td>
    <
    td>Bierdampf</td>
    </
    tr>
    <
    tr>
    <
    td>Buletten</td>
    <
    td>Frikadellen</td>
    <
    td>Fleischpflanzerl</td>
    </
    tr>
    </
    table>
    </
    td>
    </
    tr>
    </
    table>
    <
    input type="submit" value="Submit">

    </
    form>
    </
    body>
    </
    html
    Mein parser:expat1.php
    PHP-Code:
    <?php

    // start_element() - wird vom XML-Parser bei öffnenden
    // Tags aufgerufen
    include ('class.ezpdf.php');
    $last_open=array();
    $atr_open=array();

    function 
    start_element$parser$element_name$attribute )
    {
    // Überprüfung des Elementennames
    global $last_open;
    global 
    $atr_open;
    array_push($last_open,$element_name);
    array_push($atr_open,$attribute);
    }

    function 
    end_element$parser$element_name )
    { global 
    $last_open;
    global 
    $atr_open;
    array_pop($last_open);
    array_pop($atr_open);
    }

    function 
    cdata$parser$element_inhalt){
    global 
    $last_open;
    global 
    $atr_open;
    global 
    $pdf;
    // global $attribute;
    $element_namearray_shift($last_open);
    $attributearray_shift($atr_open);
    // echo $element_name. "<br>\n ";
    //echo $element_inhalt. "<br>\n ";
    //echo $element_name2;
    // if($attribute==null) return;
    if($attribute!=null)
    //print_r(array_values ($attribute));
    array_change_key_case($attributeCASE_LOWER);
    if(
    $attribute!=null)
    while (list(
    $key$value) = each($attribute)){
    //echo $key." ".$value. "<br>\n"; 
    }
    if (
    $attribute!=null && array_key_exists("TYPE"$attribute) && "TYPE"==array_search("radio"$attribute)
    && 
    on==$_POST[$attribute['NAME']])
    {
    ..............
    }


    if (
    $attribute!=null && array_key_exists("TYPE"$attribute) && "TYPE"==array_search("radio"$attribute) &&
    empty(
    $_POST[$attribute['NAME']]))
    {.............
    }


    }
    $xmlFile=file("Studien2a.html");
    // Instanz des HTML-Parsers erzeugen
    $parser xml_parser_create();
    // Handler für Elemente ( öffnende / schließende Tags ) setzen
    xml_set_element_handler$parser,"start_element","end_element" ); 
    // Handler für Daten ( CDATA ) setzen
    xml_set_character_data_handler$parser"cdata" );
    // Versuchen, die Datei zu öffnen
    if (! ( $fp fopen"Studienarbeit2.html""r" ) ) )
    {
    // Fehler -> Ausführung abbrechen
    die( "XML Fehler: Konnte Datei nicht öffnen." );
    }
    // Datei zeilenweise auslesen
    foreach($xmlFile as $elem)
    {
    xml_parse($parser,$elem);
    }
    $pdf->ezStream();
    // Vom XML-Parser belegten Speicher freigeben
    xml_parser_free$parser );
    ?>

    Danke.


    EDIT:
    php.tags by Abraxax
    Zuletzt geändert von Abraxax; 11.08.2003, 18:04.

  • #2
    für php mit xml haben wir ein anderes forum. *VERSCHIEB*
    INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


    Kommentar


    • #3
      unterlasse bitte *CROSSPOSTINGS*

      hier gehts weiter
      http://www.php-resource.de/forum/sho...threadid=24178

      *CLOSE*
      INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


      Kommentar

      Lädt...
      X