0

From a website web page. there's an input text field (policynum) and a call button (policynum). I created a function (getEntity) that renders an XML response. From the XML response, the goal is to parse out data from tag . I created a second function (getEntity1), but the button doesn't respond. Note: I remember to change onclick function name.; see code below:

<input id="policynum" name="policynum" type="text" value="">
<button id="policynum" class="btnSize" onclick="getEntity()">GET ENTITY ID</button>

function getEntity() {
    location.href='https://chwebsrvr.blserviceinc.com/ETM/admin/setup/context/ConceptOne/'+ document.getElementById('policynum').value+'/ConceptOne';
}

XML Response below with tag data

<ContextGet Reply_Code="1" Process_Status="PRC" Process_Message="Transaction 
       successfully processed." View="full">
   <Context System_Code="ConceptOne" Login_Name="CICFL000003-00" 
       App_Code="ConceptOne">
      <Context_Name>ETM Policy Holder</Context_Name>
      <Context_Config>
        <![CDATA[
          <ConceptOne> 
              <Entity_ID>86100</Entity_ID> 
              <Role_Type>CN</Role_Type> 
              <Team_Role>AGTBND</Team_Role> 
          </ConceptOne>
         ]]>
       </Context_Config>
    </Context>
</ContextGet>

This function will replace geetEntity function to return data to the screen from Entity_ID tag:

function getEntity1() {
    XmlDocument xml = new XmlDocument();
    xml.LoadXml(myXmlString);
    XmlNodeList xnList = xml.SelectNodes("//ConceptOne");
    foreach (XmlNode xn in xnList)
    {
        XmlNode example = null;
        string na = "";
        example = xn.SelectSingleNode("Entity_ID");
        if (example != null)
        {
            na = example.InnerText;
        }
    }
  $response = $client->request('GET', 
  'https://chwebsrvr.blserviceinc.com/ETM/admin/setup/context/ConceptOne/'+ 
  document.getElementById('policynum').value+'/ConceptOne');
  $response = $response->getBody()->getContents();
}

Suggestion please...

Robert
  • 7,394
  • 40
  • 45
  • 64
  • Hello GB Torry and welcome to SO. Can I suggest, you break your code blocks into a) the xml block b) the code (php?) block. Then the editor should be able to give you some syntax highlighting. If it looks prettier more people may respond :) – ether_joe Mar 10 '20 at 18:17
  • I will take you up on your suggestion. Thank You! – GB Torry Mar 10 '20 at 19:04
  • HTML Code renders XML Response: – GB Torry Mar 10 '20 at 19:19
  • – GB Torry Mar 10 '20 at 19:19
  • XML Response with tags – GB Torry Mar 10 '20 at 19:20
  • ETM Policy Holder <![CDATA[ 86100 CN AGTBND ]]> – GB Torry Mar 10 '20 at 19:20
  • Function to parse XML data – GB Torry Mar 10 '20 at 19:21
  • function getEntity1() { string myXmlString = "https://chwebsrvr.blserviceinc.com/ETM/admin/setup/context/ConceptOne/'+document.getElementById('policynum').value+'/ConceptOne'"; XmlDocument xml = new XmlDocument(); xml.LoadXml(myXmlString); XmlNodeList xnList = xml.SelectNodes("//ConceptOne"); foreach (XmlNode xn in xnList) { XmlNode example = null; string na = ""; example = xn.SelectSingleNode("Entity_ID"); if (example != null) { na = example.InnerText; } } } – GB Torry Mar 10 '20 at 19:23
  • @GBTorry You should share the code in your post, it's practically impossible to read as a comment. – AMC Mar 10 '20 at 20:57
  • @GB Torry you can *edit* your original comment, that's what I meant. The point here is to make your original post as readable as possible so others are encouraged to help. – ether_joe Mar 10 '20 at 23:50

0 Answers0