Click here to Skip to main content
15,868,062 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
For the xml file (1.xml)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<traceCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.423#traceData" >
<fileHeader fileFormatVersion="32.423 V10.0" vendorName="CDOT GROUP" >
<fileSender elementDn="DC=a1.companycdot.com,SubNetwork=1, ManagedElement=MME-1_1_1" elementType="MME" />

<traceRecSession dnPrefix="DC=a1.companycdot.com,SubNetwork=1" traceRecSessionRef="992" stime="2018-06-08T13:47:12-05:30" >
<ue idType="IMSI" idValue="311480000002255" />
<msg function="S6" name="UPDATE LOCATION ANSWER" changeTime="0.000000" vendorSpecific="false" >
<ie name="RESULT_CODE">2001

<traceSessionRef >
<mcc>311
<mnc>480
<trace_id>8323073
<traceRecSession dnPrefix="DC=a1.companycdot.com,SubNetwork=1" traceRecSessionRef="992" stime="2018-06-08T13:47:12-05:30" >
<ue idType="IMSI" idValue="311480000002255" />
<msg function="S11" name="CREATE SESSION REQUEST" changeTime="0.000000" vendorSpecific="false" >
<ie name="GTP_V2_IE_IMSI">311480000002255
<ie name="GTP_V2_IE_RAT_TYPE">6
<ie name="GTP_V2_IE_MSISDN">913114802255
<ieGroup name="GTP_V2_IE_FQ_CSID" >
<ie name="INSTANCE">0
<ie name="GTP_V2_IE_FQ_CSID">1

<ieGroup name="GTP_V2_IE_BEARER_CNTXT" >
<ie name="INSTANCE">0
<ie name="GTP_V2_IE_EBI">5
<ieGroup name="GTP_V2_IE_BEARER_QOS" >
<ie name="ARP">92
<ie name="QCI">9
<ie name="UPLINK_MBR">0
<ie name="DOWNLINK_MBR">0
<ie name="UPLINK_GBR">0
<ie name="DOWNLINK_GBR">0


<ie name="GTP_V2_IE_APN">vzwinternet.mnc480.mcc311.gprs

<traceSessionRef >
<mcc>311
<mnc>480
<trace_id>8323073
I want to extract only the MSISDN values.

What I have tried:

<?php
$doc = new DOMDocument();
$doc->load('tce_sgw.xml');
$xpath = new DOMXPath($doc);
// If you want to read exact attribute
//Selects all the ie elements that have a "name" attribute with a value of "GTP_V2_IE_MSISDN".
$ienameAttribute = $xpath->query("//traceCollecFile/traceRecSession/msg/ie[@name='GTP_V2_IE_MSISDN']");
if ($ienameAttribute->length > 0) {
echo $ienameAttribute->item(0)->value;
}
Posted
Updated 3-Jul-18 23:07pm
Comments
RedDk 4-Jul-18 23:44pm    
There are 33 open tags in this ... "xml". I would suggest finding a primer of using "XPath", do some of the sample examples found in/at MSDN (of microsoft developers network) then attempt to get jiggy with some monolithic dev app to VALIDATE this ... "xml".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900