How to get a specific array value from an XML File?

emha

I have written an xml-parser to read an XML-file. The XML-file is not mine so I can't change the structure. Things work great till I got to this special point. I want to read a value but I don't have a key to access this value. I marked the values (in red) in the screenshot below which I want to access.

enter image description here

When I dump the parent element (the PRAT->VALUE) I get this in return:

object(SimpleXMLElement)#31 (3) { ["@attributes"]=> array(5) { ["nr"]=> string(1) "1" ["unit"]=> string(3) "bar" ["unit_id"]=> string(4) "3103" ["vo"]=> string(0) "" ["vo_id"]=> string(0) "" } [0]=> string(2) "20" [1]=> string(1) "2" } 

As seen, at the end of the dump the values that I want to access are presented. I tried to access it like an array but that doesn't work. The values are not part of the attributes.

Vivek

use (String) keyword in front of it.

eg.

echo (String) PRAT->VALUE;

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

R Get all information from specific elements of XML file

분류에서Dev

Using sed to get specific text from XML file

분류에서Dev

How to get selected value from xml?

분류에서Dev

Yii Translation Array : How to get a specific value within a nested array

분류에서Dev

Get specific value from multi array JSON with PHP

분류에서Dev

How to get value from user in java for array?

분류에서Dev

How to get a value of XML

분류에서Dev

Get Array From XML Nodes

분류에서Dev

How to get specific value of an dictionary

분류에서Dev

How to read lines of a text file with specific word to an array and get the first four characters of the last line in that array?

분류에서Dev

How to get json value from json array using javascript

분류에서Dev

get value from multi array

분류에서Dev

Get value name from array

분류에서Dev

Python - Select specific value from test file

분류에서Dev

Ansible get specific value from output

분류에서Dev

c# How to get specific values from XML files by using Xpath

분류에서Dev

Search value in PHP multidimentional array from xml

분류에서Dev

extract xml tag value from the file to Variable

분류에서Dev

XML Get Value from Node C#

분류에서Dev

Sending input from "GET" to xml file in php

분류에서Dev

How to remove a simple specific key value pair from all objects inside an array

분류에서Dev

How to get specific rows in a txt file in PHP?

분류에서Dev

How to get array of array value count?

분류에서Dev

How to get tag value from input XML where tag name is stored in a variable

분류에서Dev

PHP get a value from array index

분류에서Dev

JQuery : Get a value from the result object array

분류에서Dev

AdoNetAppender get connectionstring value from another file

분류에서Dev

Get value from JSON file in Swift

분류에서Dev

How to get something specific from a tuple

Related 관련 기사

뜨겁다태그

보관