Click here to Skip to main content
14,642,979 members
Rate this:
Please Sign up or sign in to 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:

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 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
0x01AA 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!
0x01AA 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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100