Activity Forums Salesforce® Discussions How to show xml document result on visualforce page?

  • Saddam

    Member
    October 10, 2019 at 6:20 am

    Hi,

    Inside your controller write a class:

     

    class person{

    public String name{get; set;}

    public String last_name{get; set;}

     

     

    //Then you make the constructor for this class

    public person(String name, String last_name){

    this.name = name;

    this.last_name = last_name;

    }

    }

     

    once you have your class defined (write it on the bottom of the controller code before the last '}' character

    create a variable on the top of the controller as you did with public XMLDom.Element person { get; set; }

    and then instantiate it. It would something like this:

     

    public XMLDom.Element personXML { get; set; }

    public person myPerson{get; set;}

     

    Then once you got the info  loaded on personXML just instantiate myPerson by calling its constructor

     

    myPerson = new myPerson(personXML.getValue('Name), personXML.getValue('last_name'));

    now all you need is to acces to myPerson on vf page by simply doing this {!myPerson.name} {!myPerson.last_name}

     

    The fields i put are just an example and i changed the name of your variable person to personXML so i could name my class as person

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos