我有一个.xsd文件,当然我可以从中创建一个.xml文件。所以基本上我有一个空白的.xml文件(没有数据/文本)PHP:读取现有的xml文件并写入新内容
使用PHP我想读取空白的.xml文件,交叉节点并根据标签填充数据库中的数据。
似乎有很多选择:XMLReader,XMLWriter,DOMDocument,SimpleXML 我不知道从哪里开始。最简单/最简单的方式是什么?
更多信息: Here you kann find the .xsd-file... 以下.xml文件我创建:
<?xml version="1.0" encoding="utf-8"?><Patienten>
<InfoXML>
<DatumXML></DatumXML>
<NameTudokusys></NameTudokusys>
<VersionTudokusys></VersionTudokusys>
</InfoXML>
<Patient>
<Stammdaten>
<PatientID></PatientID>
<GeburtsJahr></GeburtsJahr>
<GeburtsMonat></GeburtsMonat>
<GeburtsTag></GeburtsTag>
<Geschlecht></Geschlecht>
<EinwilligungTumordoku></EinwilligungTumordoku>
<EinwilligungExterneStelle></EinwilligungExterneStelle>
</Stammdaten>
<Fall>
<Anamnese>
<RelevanteKrebsvorerkrankungen></RelevanteKrebsvorerkrankungen>
<JahrRelevanteKrebsvorerkrankungen></JahrRelevanteKrebsvorerkrankungen>
<NichtRelevanteKrebsvorerkrankungen></NichtRelevanteKrebsvorerkrankungen>
<JahrNichtRelevanteKrebsvorerkrankungen></JahrNichtRelevanteKrebsvorerkrankungen>
<DKGPatientenfragebogen></DKGPatientenfragebogen>
<PositiveFamilienanamnese></PositiveFamilienanamnese>
</Anamnese>
<Grundgesamtheiten></Grundgesamtheiten>
<Fallinfos>
<Zentrumsfall></Zentrumsfall>
<Organ></Organ>
<RegNr></RegNr>
<HauptNebenStandort></HauptNebenStandort>
<FallNummer></FallNummer>
<EingabeFalldaten></EingabeFalldaten>
</Fallinfos>
<Diagnose>
<DatumErstdiagnosePrimaertumor></DatumErstdiagnosePrimaertumor>
<DatumHistologischeSicherung></DatumHistologischeSicherung>
<ICDOHistologieDiagnose></ICDOHistologieDiagnose>
<Tumorauspraegung></Tumorauspraegung>
<ICDOLokalisation></ICDOLokalisation>
<KolonRektum></KolonRektum>
<TumorlokalisationRektum></TumorlokalisationRektum>
<praeT></praeT>
<praeN></praeN>
<praeM></praeM>
<UICCStadium></UICCStadium>
<SynchroneBehandlungKolorektalerPrimaertumoren></SynchroneBehandlungKolorektalerPrimaertumoren>
<MRTBecken></MRTBecken>
<CTBecken></CTBecken>
<AbstandFaszie></AbstandFaszie>
</Diagnose>
<PraetherapeutischeTumorkonferenz>
<VorstellungPraetherapeutischeTumorkonferenz></VorstellungPraetherapeutischeTumorkonferenz>
<EmpfehlungPraetherapeutischeTumorkonferenz></EmpfehlungPraetherapeutischeTumorkonferenz>
</PraetherapeutischeTumorkonferenz>
<EndoskopischePrimaertherapie>
<DatumTherapeutischeKoloskopie></DatumTherapeutischeKoloskopie>
<OPSCodeEndoskopischePrimaertherapie></OPSCodeEndoskopischePrimaertherapie>
</EndoskopischePrimaertherapie>
<ChirurgischePrimaertherapie>
<ASAKlassifikation></ASAKlassifikation>
<DatumOperativeTumorentfernung></DatumOperativeTumorentfernung>
<OPSCodesChirurgischePrimaertherapie></OPSCodesChirurgischePrimaertherapie>
<NotfallOderElektiveingriff></NotfallOderElektiveingriff>
<Erstoperateur></Erstoperateur>
<Zweitoperateur></Zweitoperateur>
<AnastomoseDurchgefuehrt></AnastomoseDurchgefuehrt>
<TMEDurchgefuehrt></TMEDurchgefuehrt>
<PostoperativeWundinfektion></PostoperativeWundinfektion>
<DatumPostoperativeWundinfektion></DatumPostoperativeWundinfektion>
<AufgetretenAnastomoseninsuffizienz></AufgetretenAnastomoseninsuffizienz>
<AnastomoseninsuffizienzInterventionspflichtig></AnastomoseninsuffizienzInterventionspflichtig>
<DatumInterventionspflichtigeAnastomoseninsuffizienz></DatumInterventionspflichtigeAnastomoseninsuffizienz>
<Revisionseingriff></Revisionseingriff>
<DatumRevisionseingriff></DatumRevisionseingriff>
<OPmitStoma></OPmitStoma>
<Stomaangezeichnet></Stomaangezeichnet>
</ChirurgischePrimaertherapie>
<PostoperativeHistologieStaging>
<pT></pT>
<pN></pN>
<postM></postM>
<Grading></Grading>
<ICDOHistologiePostoperative></ICDOHistologiePostoperative>
<PSRLokalNachAllenOPs></PSRLokalNachAllenOPs>
<PSRGesamtNachPrimaertherapie></PSRGesamtNachPrimaertherapie>
<GueteDerMesorektumresektion></GueteDerMesorektumresektion>
<AnzahlDerUntersuchtenLymphknoten></AnzahlDerUntersuchtenLymphknoten>
<AbstandAboralerTumorrand></AbstandAboralerTumorrand>
<AbstandZirkumferentiellerTumorrand></AbstandZirkumferentiellerTumorrand>
</PostoperativeHistologieStaging>
<PostoperativeTumorkonferenz>
<VorstellungPostoperativeTumorkonferenz></VorstellungPostoperativeTumorkonferenz>
<EmpfehlungPostoperativeTumorkonferenz></EmpfehlungPostoperativeTumorkonferenz>
</PostoperativeTumorkonferenz>
<Lebermetastasen>
<LebermetastasenVorhanden></LebermetastasenVorhanden>
<LebermetastasenAusschliesslich></LebermetastasenAusschliesslich>
<PrimaereLebermetastasenresektion></PrimaereLebermetastasenresektion>
<BedingungenSenkundaereLebermetastasenresektion></BedingungenSenkundaereLebermetastasenresektion>
<SekundaereLebermetastasenresektion></SekundaereLebermetastasenresektion>
</Lebermetastasen>
<PraeoperativeStrahlentherapie>
<EmpfehlungPraeoperativeStrahlentherapie></EmpfehlungPraeoperativeStrahlentherapie>
<DatumEmpfehlungPraeoperativeStrahlentherapie></DatumEmpfehlungPraeoperativeStrahlentherapie>
<TherapiezeitpunktPraeoperativeStrahlentherapie></TherapiezeitpunktPraeoperativeStrahlentherapie>
<TherapieintentionPraeoperativeStrahlentherapie></TherapieintentionPraeoperativeStrahlentherapie>
<GruendeFuerNichtdurchfuehrungPraeoperativeStrahlentherapie></GruendeFuerNichtdurchfuehrungPraeoperativeStrahlentherapie>
<DatumBeginnPraeoperativeStrahlentherapie></DatumBeginnPraeoperativeStrahlentherapie>
<DatumEndePraeoperativeStrahlentherapie></DatumEndePraeoperativeStrahlentherapie>
<GrundDerBeendigungDerPraeoperativeStrahlentherapie></GrundDerBeendigungDerPraeoperativeStrahlentherapie>
</PraeoperativeStrahlentherapie>
<PostoperativeStrahlentherapie>
<EmpfehlungPostoperativeStrahlentherapie></EmpfehlungPostoperativeStrahlentherapie>
<DatumEmpfehlungPostoperativeStrahlentherapie></DatumEmpfehlungPostoperativeStrahlentherapie>
<TherapiezeitpunktPostoperativeStrahlentherapie></TherapiezeitpunktPostoperativeStrahlentherapie>
<TherapieintentionPostoperativeStrahlentherapie></TherapieintentionPostoperativeStrahlentherapie>
<GruendeFuerNichtdurchfuehrungPostoperativeStrahlentherapie></GruendeFuerNichtdurchfuehrungPostoperativeStrahlentherapie>
<DatumBeginnPostoperativeStrahlentherapie></DatumBeginnPostoperativeStrahlentherapie>
<DatumEndePostoperativeStrahlentherapie></DatumEndePostoperativeStrahlentherapie>
<GrundDerBeendigungDerPostoperativeStrahlentherapie></GrundDerBeendigungDerPostoperativeStrahlentherapie>
</PostoperativeStrahlentherapie>
<PraeoperativeChemotherapie>
<EmpfehlungPraeoperativeChemotherapie></EmpfehlungPraeoperativeChemotherapie>
<DatumEmpfehlungPraeoperativeChemotherapie></DatumEmpfehlungPraeoperativeChemotherapie>
<TherapiezeitpunktPraeoperativeChemotherapie></TherapiezeitpunktPraeoperativeChemotherapie>
<TherapieintentionPraeoperativeChemotherapie></TherapieintentionPraeoperativeChemotherapie>
<GruendeFuerNichtdurchfuehrungPraeoperativeChemotherapie></GruendeFuerNichtdurchfuehrungPraeoperativeChemotherapie>
<DatumBeginnPraeoperativeChemotherapie></DatumBeginnPraeoperativeChemotherapie>
<DatumEndePraeoperativeChemotherapie></DatumEndePraeoperativeChemotherapie>
<GrundDerBeendigungDerPraeoperativeChemotherapie></GrundDerBeendigungDerPraeoperativeChemotherapie>
</PraeoperativeChemotherapie>
<PostoperativeChemotherapie>
<EmpfehlungPostoperativeChemotherapie></EmpfehlungPostoperativeChemotherapie>
<DatumEmpfehlungPostoperativeChemotherapie></DatumEmpfehlungPostoperativeChemotherapie>
<TherapiezeitpunktPostoperativeChemotherapie></TherapiezeitpunktPostoperativeChemotherapie>
<TherapieintentionPostoperativeChemotherapie></TherapieintentionPostoperativeChemotherapie>
<GruendeFuerNichtdurchfuehrungPostoperativeChemotherapie></GruendeFuerNichtdurchfuehrungPostoperativeChemotherapie>
<DatumBeginnPostoperativeChemotherapie></DatumBeginnPostoperativeChemotherapie>
<DatumEndePostoperativeChemotherapie></DatumEndePostoperativeChemotherapie>
<GrundDerBeendigungDerPostoperativeChemotherapie></GrundDerBeendigungDerPostoperativeChemotherapie>
</PostoperativeChemotherapie>
<BestSupportiveCare></BestSupportiveCare>
<Prozess>
<DatumStudie></DatumStudie>
<Studientyp></Studientyp>
<PsychoonkologischeBetreuung></PsychoonkologischeBetreuung>
<BeratungSozialdienst></BeratungSozialdienst>
<GenetischeBeratungEmpfohlen></GenetischeBeratungEmpfohlen>
<GenetischeBeratungErhalten></GenetischeBeratungErhalten>
<ImmunhistochemischeUntersuchungAufMSI></ImmunhistochemischeUntersuchungAufMSI>
</Prozess>
<FollowUp>
<DatumFollowUp></DatumFollowUp>
<LokoregionaeresRezidiv></LokoregionaeresRezidiv>
<LymphknotenRezidiv></LymphknotenRezidiv>
<Fernmetastasen></Fernmetastasen>
<Zweittumor></Zweittumor>
<Verstorben></Verstorben>
<QuelleFollowUp></QuelleFollowUp>
</FollowUp>
</Fall>
</Patient>
首先,我必须导航到某些节点(例如, “DatumXML”)和输入值。 其次,我必须遍历某些节点的所有子节点(例如Stammdaten)并输入值。
我通过编辑我的问题提供了更多信息。我如何摆脱“持有状态”? – Phantom 2015-02-09 12:55:23