Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hope you guys can help. Trying for over a week. Not very experienced with Javascript.

I have an xml file that I retreive via terminal emulation. I want to parse the results into a textarea in html. I am able to view the file in the textarea in xml format but have been unable to parse it into lines of the inner text.

Here is the javascript/jquery:

C#
var x = ""
var y = ""
var Command="";
var cmd=""
$(document).ready(function() {
    alert('jquery working');

$('#tester').click(function() {
     $("#disptext").val("");
    var APOresp = new ActiveXObject("DAT32COM.TERMINALEMULATION");
    var Command = "<FORMAT>>*IA</FORMAT>";
    APOresp.MakeEntry(Command);
        //APOresp.GetMore(true,false);
    var x = APOresp.ResponseXML;
    APOresp.Close();
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = "false";
    xmlDoc.loadXML(x);
    $(x).find('RESPONSE').each(function() {
    $("#disptext").val($(this).text() + "<br />");
    });
    //$("#disptext").val(xmlDoc.xml);
});


Here is a small portion of the xml file:

XML
<?xml version="1.0"?>
<!--This is a host terminal response-->
<RESPONSE xmlns="x-schema:C:\fp\swdir\Content\emulation-schema.xml">
    <LINE INDEX="1"><![CDATA[SIGN IN ]]><CARRIAGE_RETURN/></LINE>
    <LINE INDEX="2"><SOM/></LINE>
</RESPONSE>


I want to get the text of the "LINE: tag and loop it into the textarea. It does put in the whole xml file in xml format if I use the last commented out line in the javascript file. For some unknown reason, I am unable to use the xmlDoc function. I just get errors. Any help would be greatly appreciated. Thanks in advance.
Posted
Comments
[no name] 3-Jan-15 19:39pm    
Sorry only read your subject and it was enough. There is _no_ unusual XML file. Either it is XML or it is not!
[no name] 3-Jan-15 19:48pm    
Thank you Member 10876140. Now please define "unusual XML" otherwhise.....try to describe what Errors you get instead of "I just get errors."
Richard MacCutchan 4-Jan-15 3:56am    
Reported as abuse. Messages like this are a good way to get yourself banned from the site.

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