8

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.

Tono Nam
  • 34,064
  • 78
  • 298
  • 470

1 Answers1

8

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

kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • 1
    Unfortunately that library seems to be US-centric and doesn't support UTF-8 characters. Seems to only work with basic ANSI characters. – Nux May 26 '20 at 17:48
  • 1
    @Nux: I see you've [filed an issue](https://github.com/kripken/xml.js/issues/26#issuecomment-634146238) to that effect. Let us know if you're able to get resolution, find a work-around, or identify another library that works better for you. – kjhughes May 26 '20 at 20:21