Click here to Skip to main content
15,891,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is the xml file:(1.xml)

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
<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 RESPONSE" changeTime="0.000000" vendorSpecific="false" >
<ieGroup name="GTP_V2_IE_CAUSE" >
<ie name="GTP_V2_IE_CAUSE">16
<ie name="CAUSE_SOURCE">0

<ieGroup name="GTP_V2_IE_FQ_CSID" >
<ie name="INSTANCE">1
<ie name="GTP_V2_IE_FQ_CSID">45

<ie name="GTP_V2_IE_APN_RESTRICTION">1
<ieGroup name="GTP_V2_IE_APN_AMBR" >
<ie name="UPLINK_MBR">64000
<ie name="DOWNLINK_MBR">64000

<ieGroup name="GTP_V2_IE_PAA" >
<ie name="PDN_TYPE">1
<ie name="IPV4_ADDRESS">192.168.149.193

<ieGroup name="GTP_V2_IE_FTEID" >
<ie name="INTERFACE_TYPE">139
<ie name="TEID">50343649
<ie name="IPV4_ADDRESS">192.168.149.182

<ieGroup name="GTP_V2_IE_BEARER_CNTXT" >
<ie name="INSTANCE">0
<ie name="GTP_V2_IE_EBI">5
<ieGroup name="GTP_V2_IE_CAUSE" >
<ie name="GTP_V2_IE_CAUSE">16
<ie name="CAUSE_SOURCE">0

<ieGroup name="GTP_V2_IE_BEARER_QOS" >
<ie name="ARP">28
<ie name="QCI">9
<ie name="UPLINK_MBR">0
<ie name="DOWNLINK_MBR">0
<ie name="UPLINK_GBR">0
<ie name="DOWNLINK_GBR">0

<ieGroup name="GTP_V2_IE_FTEID" >
<ie name="INTERFACE_TYPE">129
<ie name="TEID">19993
<ie name="IPV4_ADDRESS">192.168.149.185

<ieGroup name="GTP_V2_IE_FTEID" >
<ie name="INTERFACE_TYPE">133
<ie name="TEID">9998
<ie name="IPV4_ADDRESS">192.168.149.189



<traceSessionRef >
<mcc>311
<mnc>480
<trace_id>8323073


What I have tried:

Here are the codes i have tried:

To display only the mesages:
("Description.html")

HTML
<!DOCTYPE html>

<p id="unique"></p>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        myFunction(this);
    }
};
xhttp.open("GET", "1.xml", true);
xhttp.send();

function myFunction(xml) {
    var x, i, xmlDoc, txt;
    xmlDoc = xml.responseXML;
    txt="";
    x = xmlDoc.getElementsByTagName('msg');
	txt += x[0].getAttribute('name') + "<br>";
    for (i = 1; i &lt; x.length; i++) {
	if(x[i].getAttribute('name')!= x[i-1].getAttribute('name')){
        txt += x[i].getAttribute('name') + "<br>";
	}
    }
	var str =txt;
var str1=str.split("<br>");
// the native filter method of an Array in the following way to get an array with unique values:
//The native method filter will loop through the array and leave only those entries that pass the given callback function onlyUnique.
//onlyUnique checks, if the given value is the first occurring. If not, it must be a duplicate and will not be copied.
function onlyUnique(value, index, self) { 
    return self.indexOf(value) === index;
    }
	var uni = str1.filter( onlyUnique );

   for(var t=0; t &lt; uni.length;t++)
   {
	var re = uni[t].link("file:///C:/Users/abc/Downloads/project/Message.html");
	document.getElementById("unique").innerHTML += re + "<br>";
}
}


To display the inside msgs:
("Messages.html")

HTML
<!DOCTYPE html>

<p id="unique"></p>

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        myFunction(this);
    }
};
xhttp.open("GET", "1.xml", true);
xhttp.send();

function myFunction(xml) {
    var x, i, xmlDoc, txt;
    xmlDoc = xml.responseXML;
    txt="";
    x = xmlDoc.getElementsByTagName('ie');
	txt += x[0].getAttribute('name') + "<br>";
    for (i = 1; i &lt; x.length; i++) {
	if(x[i].getAttribute('name')!= x[i-1].getAttribute('name')){
        txt += x[i].getAttribute('name') + "<br>";
	}
    }
 document.getElementById("unique").innerHTML = txt;
}


The problem is that on clicking the output of Description.html all the messages of Messages.html are displayed.

But i want that on clicking let's say(CREATE SESSION REQUEST)
only the msgs which are inside that should be displayed , not all.

Plz reply as soon as possible.THANKS!
Posted
Updated 26-Jun-18 19:40pm
v3

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