XML UTF-16


Status
Dieses Thema wurde gelöst! Zur Lösung gehen…
#1
Hallo

ich versuche hier eine XML via PHP zu schreiben, allerdings bekomme ich diese nicht richtig validiert. Kann mir dabei jemand helfen? Der Bereich EInstellungen liegt dabei als Array vor key und value. zum Schlus soll die XML im verzeichniss tmp gespeichert werden.

Code:
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<DataStore>
  <Header />
  <Body>
    <Version>2</Version>
    <Einstellung>
      <Server_IP>127.0.0.1</Server_IP>
      <Overwrite_Telnet_IP></Overwrite_Telnet_IP>
      <Telnet_Port>30004</Telnet_Port>
      <Telnet_PW>F1-45-59-DB-CA-CA-65-A6-6E-76-69-CB-48-5A-58-5C</Telnet_PW>
      <API_IP>127.0.0.1</API_IP>
      <API_Port>12345</API_Port>
      <Sync_Type>0</Sync_Type>
      <Sync_IP>127.0.0.1</Sync_IP>
      <Sync_Port>12346</Sync_Port>
      <Use_Plain_Sync_PW>false</Use_Plain_Sync_PW>
      <Sync_PW>F1-45-59-DB-CA-CA-65-A6-6E-76-69-CB-48-5A-58-5C</Sync_PW>
      <Sync_LU>1900-01-01T00:00:00</Sync_LU>
      <SyncStarter_Port>0</SyncStarter_Port>
      <FirstStart>false</FirstStart>
      <FTP_Port></FTP_Port>
      <FTP_Benutzer></FTP_Benutzer>
      <FTP_PW>F1-45-59-DB-CA-CA-65-A6-6E-76-69-CB-48-5A-58-5C</FTP_PW>
      <FTP_Active>false</FTP_Active>
      <FTP_Old>false</FTP_Old>
      <FTP_ConType>1</FTP_ConType>
      <FTP_Timeout>15000</FTP_Timeout>
      <FTP_Retry>1</FTP_Retry>
      <Game_Path>C:\home\egs\server\egs-win_7357\</Game_Path>
      <Backup_Path>C:\home\egs\server\egs-win_7357\Backup\</Backup_Path>
      <Dedicated>dedicated_EAH.yaml</Dedicated>
      <DedicatedCMD>EmpyrionDedicated_NoGraphics.cmd</DedicatedCMD>
      <SaveDirectory>Saves</SaveDirectory>
      <GameName>DediGame</GameName>
      <Creative_Game_Dir></Creative_Game_Dir>
      <Own_Player_ID>0</Own_Player_ID>
      <AutoBan>false</AutoBan>
      <AllowToEdit>true</AllowToEdit>
      <ChatBotOn>false</ChatBotOn>
      <GameVersion>18</GameVersion>
      <Translation>15</Translation>
      <Kick_WaitSeconds>6</Kick_WaitSeconds>
      <Welcome_Message>Welcome to the server!</Welcome_Message>
      <SwearWordFilterOn>false</SwearWordFilterOn>
      <KeepBackupForDays>3</KeepBackupForDays>
      <KeepBigDataForDays>3</KeepBigDataForDays>
      <LooseEcAtDeath>false</LooseEcAtDeath>
      <Activate_AutoMiner>false</Activate_AutoMiner>
      <Activate_AM_Info>false</Activate_AM_Info>
      <Activate_StructureControl>false</Activate_StructureControl>
      <Activate_StructureControl_Class_Execution>false</Activate_StructureControl_Class_Execution>
      <Activate_FactionBot>false</Activate_FactionBot>
      <Activate_FactionPlanetWarning>false</Activate_FactionPlanetWarning>
      <Activate_Coordinate_Logs>false</Activate_Coordinate_Logs>
      <Activate_PoleWarpTryDestruction>false</Activate_PoleWarpTryDestruction>
      <ActivateEmergencyWarp>false</ActivateEmergencyWarp>
      <ActivateEmergencyWarpOnLogin>false</ActivateEmergencyWarpOnLogin>
      <PoleControlWarp>false</PoleControlWarp>
      <PoleControlWarpShip>false</PoleControlWarpShip>
      <TelnetFloodRestart>false</TelnetFloodRestart>
      <AutomaticRestart>false</AutomaticRestart>
      <Faction_Control_SetTo></Faction_Control_SetTo>
      <StructureControlExecution_WhenOffline>false</StructureControlExecution_WhenOffline>
      <BeepOnChatAlert>false</BeepOnChatAlert>
      <Autominer_Buy>10000</Autominer_Buy>
      <Autominer_Sell>2500</Autominer_Sell>
      <Autominer_RareOreDivision>3</Autominer_RareOreDivision>
      <Autominer_Iron>false</Autominer_Iron>
      <Autominer_Magnesium>false</Autominer_Magnesium>
      <Autominer_Cobalt>false</Autominer_Cobalt>
      <Autominer_Silicon>false</Autominer_Silicon>
      <Autominer_Neo>false</Autominer_Neo>
      <Autominer_Copper>false</Autominer_Copper>
      <Autominer_Prom>false</Autominer_Prom>
      <Autominer_Eres>false</Autominer_Eres>
      <Autominer_Zas>false</Autominer_Zas>
      <Autominer_Sathium>false</Autominer_Sathium>
      <Autominer_Gold>false</Autominer_Gold>
      <Autominer_Blue_Crystal>false</Autominer_Blue_Crystal>
      <Autominer_Mine_Minutes>60</Autominer_Mine_Minutes>
      <Autominer_Fuel_Minutes>1440</Autominer_Fuel_Minutes>
      <Autominer_Fuel_Item>2105</Autominer_Fuel_Item>
      <Autominer_Fuel_PerLevel>1</Autominer_Fuel_PerLevel>
      <Autominer_AllLevelCostSame>false</Autominer_AllLevelCostSame>
      <Autominer_CostPerWithdrawl_PVE>0</Autominer_CostPerWithdrawl_PVE>
      <Autominer_CostPerWithdrawl_PVP>0</Autominer_CostPerWithdrawl_PVP>
      <Autominer_CostPerOreWithdrawl_PVE>0</Autominer_CostPerOreWithdrawl_PVE>
      <Autominer_CostPerOreWithdrawl_PVP>0</Autominer_CostPerOreWithdrawl_PVP>
      <EntityCheckTicks>50</EntityCheckTicks>
      <TelnetCheck_Minutes>1</TelnetCheck_Minutes>
      <AutoSave_Minutes>30</AutoSave_Minutes>
      <DediStats_Minutes>10</DediStats_Minutes>
      <PlayfieldStats_Minutes>30</PlayfieldStats_Minutes>
      <PlayerReload_Seconds>30</PlayerReload_Seconds>
      <StructureReload_Minutes>2</StructureReload_Minutes>
      <Mod_WaitForAnswerTimeout>50</Mod_WaitForAnswerTimeout>
      <Chat_Alerts></Chat_Alerts>
      <Intruder_Log>false</Intruder_Log>
      <Master_ConfigPath></Master_ConfigPath>
      <MaxFactionBasePVE>0.00</MaxFactionBasePVE>
      <MaxFactionBasePVP>0.00</MaxFactionBasePVP>
      <MaxPlayerBasePVE>0.00</MaxPlayerBasePVE>
      <MaxPlayerBasePVP>0.00</MaxPlayerBasePVP>
      <MaxFactionCvPVE>0.00</MaxFactionCvPVE>
      <MaxFactionCvPVP>0.00</MaxFactionCvPVP>
      <MaxPlayerCvPVE>0.00</MaxPlayerCvPVE>
      <MaxPlayerCvPVP>0.00</MaxPlayerCvPVP>
      <MaxFactionSvPVE>0.00</MaxFactionSvPVE>
      <MaxFactionSvPVP>0.00</MaxFactionSvPVP>
      <MaxPlayerSvPVE>0.00</MaxPlayerSvPVE>
      <MaxPlayerSvPVP>0.00</MaxPlayerSvPVP>
      <MaxFactionHvPVE>0.00</MaxFactionHvPVE>
      <MaxFactionHvPVP>0.00</MaxFactionHvPVP>
      <MaxPlayerHvPVE>0.00</MaxPlayerHvPVE>
      <MaxPlayerHvPVP>0.00</MaxPlayerHvPVP>
      <MaxFactionBasePVE_Base>0</MaxFactionBasePVE_Base>
      <MaxFactionBasePVP_Base>0</MaxFactionBasePVP_Base>
      <MaxFactionCvPVE_Base>0</MaxFactionCvPVE_Base>
      <MaxFactionCvPVP_Base>0</MaxFactionCvPVP_Base>
      <MaxFactionSvPVE_Base>0</MaxFactionSvPVE_Base>
      <MaxFactionSvPVP_Base>0</MaxFactionSvPVP_Base>
      <MaxFactionHvPVE_Base>0</MaxFactionHvPVE_Base>
      <MaxFactionHvPVP_Base>0</MaxFactionHvPVP_Base>
      <Survival_Money>0</Survival_Money>
      <Detailed_Logs>false</Detailed_Logs>
      <Telnet_Flood_Amount>3000</Telnet_Flood_Amount>
      <FactionPlanetWarnings>0</FactionPlanetWarnings>
      <KickInactive>false</KickInactive>
      <PublicStructureBugProtection>false</PublicStructureBugProtection>
      <PublicStructureBugMinStructures>10</PublicStructureBugMinStructures>
      <EmergencyLogInWarp_KickIn>4</EmergencyLogInWarp_KickIn>
      <AllowIntensiveChatbotCommandsEachSeconds>15</AllowIntensiveChatbotCommandsEachSeconds>
      <FactionReload_Minutes>2</FactionReload_Minutes>
      <CompleteFactionReload_Hours>3</CompleteFactionReload_Hours>
      <WipeTime_Hours>99999</WipeTime_Hours>
      <MaxPoleWarpTry>5</MaxPoleWarpTry>
      <Admin_Name>Server</Admin_Name>
      <LastUpdate_ChatBot_Log>1900-01-01T00:00:00</LastUpdate_ChatBot_Log>
      <LastUpdate_Coordinates_Log>1900-01-01T00:00:00</LastUpdate_Coordinates_Log>
      <LastUpdate_Intruder_Log>1900-01-01T00:00:00</LastUpdate_Intruder_Log>
      <LastUpdate_PlayerActivity>1900-01-01T00:00:00</LastUpdate_PlayerActivity>
      <LastUpdate_FactionActivity>1900-01-01T00:00:00</LastUpdate_FactionActivity>
      <LastUpdate_Player_Log>1900-01-01T00:00:00</LastUpdate_Player_Log>
      <LastUpdate_PlayerWarning_Log>1900-01-01T00:00:00</LastUpdate_PlayerWarning_Log>
      <LastUpdate_Playfield_Log>1900-01-01T00:00:00</LastUpdate_Playfield_Log>
      <LastUpdate_Statistics_Dedi>1900-01-01T00:00:00</LastUpdate_Statistics_Dedi>
      <LastUpdate_Statistics_Playfield>1900-01-01T00:00:00</LastUpdate_Statistics_Playfield>
      <LastUpdate_SteamID>1900-01-01T00:00:00</LastUpdate_SteamID>
      <LastUpdate_Structure_Log>1900-01-01T00:00:00</LastUpdate_Structure_Log>
      <SwearFilter_OnlyGlobalChat>false</SwearFilter_OnlyGlobalChat>
      <SwearFilter_Words></SwearFilter_Words>
      <SwearFilter_MaxWarnings>7</SwearFilter_MaxWarnings>
      <SwearFilter_IncreaseBanHour>2</SwearFilter_IncreaseBanHour>
      <SwearFilter_WhiteList></SwearFilter_WhiteList>
      <Log_ItemExchange>false</Log_ItemExchange>
      <Connection_Logs>false</Connection_Logs>
      <EAH_GUI>true</EAH_GUI>
      <Activate_GoToShip>false</Activate_GoToShip>
      <Activate_Offline_Protection>false</Activate_Offline_Protection>
      <Activate_Profiling>false</Activate_Profiling>
      <Profiling_AtCPU>100</Profiling_AtCPU>
      <Activate_CPU_AutoRestart>false</Activate_CPU_AutoRestart>
      <CPU_AutoRestart_At>100</CPU_AutoRestart_At>
      <Use_Dedicated_CMD>false</Use_Dedicated_CMD>
      <ResetCbSurvivalOnCbReset>false</ResetCbSurvivalOnCbReset>
      <SetStructuresToPublicIfNotTouchedForHours>0</SetStructuresToPublicIfNotTouchedForHours>
      <ChatBotOnlyInFactionChat>false</ChatBotOnlyInFactionChat>
      <Activate_CombatLog_Message>false</Activate_CombatLog_Message>
      <Activate_GetShipHere>false</Activate_GetShipHere>
      <Activate_GetShipDown>false</Activate_GetShipDown>
      <MinPauseBetweenStructureUpdate>20</MinPauseBetweenStructureUpdate>
      <MaxStructureCheckEveryMinute>60</MaxStructureCheckEveryMinute>
      <CombatLog_OnlyInPVP>false</CombatLog_OnlyInPVP>
      <CombatLog_CheckAlliances>false</CombatLog_CheckAlliances>
      <UploadBackupFolder></UploadBackupFolder>
      <Activate_BackpackBackup>true</Activate_BackpackBackup>
      <UploadBackup_SameName>false</UploadBackup_SameName>
      <Activate_RAM_AutoRestart>false</Activate_RAM_AutoRestart>
      <RAM_AutoRestart_At>90</RAM_AutoRestart_At>
      <Activate_Structure_ActivityLog>true</Activate_Structure_ActivityLog>
      <ReloadPlayerfileAfterLogout>false</ReloadPlayerfileAfterLogout>
      <MOTD></MOTD>
      <Discord_Token>F1-45-59-DB-CA-CA-65-A6-6E-76-69-CB-48-5A-58-5C</Discord_Token>
      <Discord_Public_Channel>0</Discord_Public_Channel>
      <Discord_Admin_Channel>0</Discord_Admin_Channel>
      <CombatLog_IgnoreStarterPF>false</CombatLog_IgnoreStarterPF>
      <CombatLog_PlanetDistance>350</CombatLog_PlanetDistance>
      <CombatLog_OrbitDistance>2000</CombatLog_OrbitDistance>
      <StructureLimit_Deletetion>false</StructureLimit_Deletetion>
      <StructureLimit_DeleteAfter_PVE>4320</StructureLimit_DeleteAfter_PVE>
      <StructureLimit_DeleteAfter_PVP>15</StructureLimit_DeleteAfter_PVP>
      <UploadOnlyFullBackup>true</UploadOnlyFullBackup>
      <InternalServerName>Server</InternalServerName>
      <PlayerFreeRestarts>3</PlayerFreeRestarts>
      <PlayerRestartPauseInHours>3</PlayerRestartPauseInHours>
      <DiscordIngameColor>49669e</DiscordIngameColor>
      <SendAutoChatToDiscord>true</SendAutoChatToDiscord>
      <FactionMemberCalculationInMinutes>60</FactionMemberCalculationInMinutes>
      <ProtectWorldDatOnWipe>false</ProtectWorldDatOnWipe>
      <Activate_CBGoHome>false</Activate_CBGoHome>
      <Activate_Events>true</Activate_Events>
      <Check_Cheater>true</Check_Cheater>
      <DiscordIgnoreChatStartingWith></DiscordIgnoreChatStartingWith>
      <WaitForDslInSec>10</WaitForDslInSec>
      <Activate_WarpRescue>false</Activate_WarpRescue>
      <Activate_StackTraceLogs>false</Activate_StackTraceLogs>
      <CbDestroy_DelayInSeconds>60</CbDestroy_DelayInSeconds>
      <CbGoToShip_DelayInSeconds>60</CbGoToShip_DelayInSeconds>
      <CombatLog_OfflineDiscordMessageEveryXMinutes>30</CombatLog_OfflineDiscordMessageEveryXMinutes>
      <Activate_ConsoleCommandProtection>false</Activate_ConsoleCommandProtection>
      <IgnoreNonEAHRequests>true</IgnoreNonEAHRequests>
      <ShowAutomatedServerMessages>true</ShowAutomatedServerMessages>
    </Einstellung>
  </Body>
</DataStore>
Danke
 
Zuletzt bearbeitet:
#3
Sry das die Antwort fehlte, ich war leider abwesend. Die Lösung ist eigentlich aber auch schon da. Ich habe mich die ganze Zeit darauf konzentriert die Zeilen gleich valide zu schreiben. Was so der größte Fehler war. Die Lösung war relativ einfach.

Die Zeilen einfach schreiben und in einen Parameter speichern und dann die datei wie folgt schreiben:

Code:
$copy_utf16 = iconv("UTF-8", "UTF-16LE", $xml);
file_put_contents("tmp/egs_$options[id].XML", $copy_utf16);
Damit wird dann die datei von simplexml als Valide ercannt und auch das Tool welches die Datei ansteuern soll.

Da ich selbst meinen BEitrag nicht als Lösung markieren kann, bitte ich den Moderator dies zu tun.

Danke trotzdem
 
Status
Dieses Thema wurde gelöst! Zur Lösung gehen…