0
votes

I need to create a html template from xml data without using xslt in a mvc application.

my solution was: first I used json.net (http://json.codeplex.com/) to convert xml into json. second I converted above json string to javascript object literal by using $parse.Json (http://api.jquery.com/jQuery.parseJSON/) third I used jsRender (https://github.com/BorisMoore/jsrender) to add values to html template.

All good everything is fine. But I need to write own js for render html rather than jsRender.

my question is: How to loop through each js object and find the relavent html tag and add the value.

1
Welcome to SO. Please post some code along with your question or no one will be able to answer it! - vzwick

1 Answers

0
votes

As the comment implies, the question is not clear.

If you are using JQuery, then use the features it provides to loop through elements. If you want to use raw javascript, then use the primitives that it provides such as Object.keys.

If jsrender is working for you, then use it to study how to do things. That is one of the main objectives of open source -- to provide a base to learn from.