Validate XML against XSD with JavaScript on client side

╄→гoц情女王★ 提交于 2021-01-20 04:27:57

问题


I am required to show a user an XMLfile in a friendly way as a result I am creating a tree like structure such as: http://thecodeplayer.com/walkthrough/css3-family-tree instead of showing the user the raw XML.

Right now when creating a new node I am validating that on the server side. If the server validates the new proposed XML(tree) then I go ahead and create a new node for example.

Anyways now I will like to allow the user to drag these nodes. When dragging the nodes if I validate the proposed on the server side it will be to slow. So my question is how can I validate an XML file against a schema on the client side so that when dragging a node I can allow dragging the node or not depending whether or not the validation succeeds.


回答1:


See the xml.js package, which exports an xmllint object ported via Emscripten from libxml2.



来源:https://stackoverflow.com/questions/35930737/validate-xml-against-xsd-with-javascript-on-client-side

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!