Autor Zpráva
jtfcobra
Profil
Dobry den prosim o radu nevypisuji se mi hodnoty

Kod
<?php              
$xml=simplexml_load_file("values.xml");

// Info o zarizeni
foreach ($xml->Agent as $item){
echo 'Nazev zarizeni: '.$item['DeviceName'].'</br>';
};

// M-Bus
foreach ($xml->Meter as $item){
echo 'Meter zarizeni: '.$item['Name'].'</br>';
};

// Input
foreach ($xml->Input as $item){
echo 'Input zarizeni: '.$item['Name'].'</br>';
};
 ?>

XML soubor
<?xml version="1.0" encoding="utf-8"?>
<val:Root xmlns:val="http://www.hw-group.com/XMLSchema/HWg-PWR/values.xsd">
<Agent>
    <Version>1.2.2</Version>
    <XmlVer>2.00</XmlVer>
    <DeviceName>HWg-PWR25</DeviceName>
    <Model>55</Model>
    <MAC>00:0A:59:04:7C:54</MAC>
    <sys_name>HWg-PWR</sys_name>
    <sys_location></sys_location>
    <sys_contact>HWg-PWR:For more information try http://www.hw-group.com</sys_contact>
    <log_endian>0</log_endian>
    <wtmp>01.01.1970 01:00:00, 0</wtmp>
    <etmp>1</etmp>
</Agent>
<Meter id="1">
        <cfg>1</cfg>
    <Name>Testovaci</Name>
    <Address>0</Address>
    <SecAddress>13150006</SecAddress>
</Meter>
    <Input id="1">
        <cfg>1</cfg>
        <Name>Input 1</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
    <Input id="2">
        <cfg>1</cfg>
        <Name>Input 2</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
    <Input id="3">
        <cfg>1</cfg>
        <Name>Input 3</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
    <Input id="4">
        <cfg>1</cfg>
        <Name>Input 4</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
    <Input id="5">
        <cfg>1</cfg>
        <Name>Input 5</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
    <Input id="6">
        <cfg>1</cfg>
        <Name>Input 6</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
    <Input id="7">
        <cfg>1</cfg>
        <Name>Input 7</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
    <Input id="8">
        <cfg>1</cfg>
        <Name>Input 8</Name>
        <Value>0</Value>
        <ValueName>Open</ValueName>
        <State>1</State>
        <State1>Normal</State1>
    </Input>
</val:Root>

Vypis z webu
Nazev zarizeni: 
Meter zarizeni: 
Input zarizeni: 
Input zarizeni: 
Input zarizeni: 
Input zarizeni: 
Input zarizeni: 
Input zarizeni: 
Input zarizeni: 
Input zarizeni: 
Taps
Profil
jtfcobra:
zkus tento zápis
<?
echo 'Nazev zarizeni: '.$item->DeviceName.'</br>';
?>
jtfcobra
Profil
boomba diky moc

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: