如何从控制器渲染 XML 数据以高效查看
我正在开发一个需要渲染 XML 数据(这将是我的模型)的项目。它基本上以类似于标准数据库表示的行-列格式表示。除非您应该能够单击一行并从那里执行一些基本数据输入。我最初想过使用 Json 数据和 Jgrid 来做到这一点,但看起来它可能比它值得的更麻烦。从与我的同事的对话来看,似乎可以将 xml 从控制器直接发送到视图。由于 XML 只是一个字符串,我想这并不难。我只是有点不确定如何完成这件事。所以我想我提到所有这些都是为了问,如何在从控制器获取的视图中呈现 XML 数据。在这种情况下,最佳做法是什么?将 XML 从控制器发送到视图的最佳方法是什么?渲染此视图的最佳方式是什么?有没有办法让 xml 数据的一行“可点击”?我应该咬紧牙关并尝试找出 jqGrid 吗?
谢谢, 德里克
I am working on a project that requires that I render XML data (that would be my model). Its basically going to be represented in a row - column format similar to your standard database representation. Except you should be able to click on a row and from there perform some basic data entry. I initially thought about using Json data and Jgrid to do this, but It seems like it may be more trouble than it is worth. From conversations with my co-workers, it seems as though it is possible to send xml from a controller straight to the view. Since XML is just a string, I guess that wouldn't be to hard. I am just a little unsure about how to get this done. So I guess I mentioned all that to ask, how can you render XML data in a view that you get from a controller. What is best practice in a situation like this? What is the best way to send XML over from a controller to a view? What is the best way to render this view? Is there a way that I can make a row of that xml data "clickable"? Should I just byte the bullet and try and figure out jqGrid?
Thanks,
Derek
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的控制器应该将模型返回到您的视图。
它更易于管理,并且您无需解析 XML。
此处和此处
观看这些教程 (Plurasight) 如果你有时间的话。
Your controller should return a model to your view.
It's easier to manage and you don't have to parse XML.
It's all explained here and here
Watch these tutorials (Plurasight) if you have time.