开发者

XML Schema Binding / Object Model Framework in Cocoa

New to XSD here.

Has anyone found or written a framework for validating XML with an XML schema in Cocoa/Obj-C?

What I really need is the ability to define permitted types of modifications to an NSXMLDocument, as described in an XSD file. This includes defining sequences of child elements, list of attributes and their permitted values, etc etc. I need to expose these modification rules in my UI. For example:

  • I want to constrain the names of the new child elements added to an existing NSXMLElement node in my NSOutlineView
  • If the XSD says that Node A has required child elements (Nodes Aa and Ab) then when the user adds Node A to the XML tree, I want to automatically create Nodes Aa & Ab and add them to the just-created Node A.
  • etc etc

It seems to me that a good solution would be a Cocoa counterpart of JAXB. XSOM (which doesn't create schema-derived classes, but rather gives an query-able object model of the XSD) would work too.

My question is similar to this one, but I don开发者_如何学JAVA't want to limit myself to JAXB-like solution. I'm interested in finding out other solutions that people have come up to this problem.

Cheers!!


You can create a DTD and validate against it, or create a recursive parser based on your XSD, such as existing ones for RSS or Atom based on the spec.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜