Let's extend the XML source editor in our multiview component to support XML checking and XML validation. The end result will be like this:

Thanks to Toni Epple and Enrico Scantamburlo, I came up with the following solution, which requires a dependency on the "XML Tools" module.
Note in particular the parts in bold below:public class AbcDataObject extends XMLDataObject implements Lookup.Provider { final InstanceContent ic; private AbstractLookup lookup; public AbcDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException { super(pf, loader); ic = new InstanceContent(); lookup = new AbstractLookup(ic); InputSource is = DataObjectAdapters.inputSource(this); Source source = DataObjectAdapters.source(this); ic.add(new CheckXMLSupport(is)); ic.add(new ValidateXMLSupport(is)); ic.add(new TransformableSupport(source)); ic.add(AbcEditorSupport.create(this)); } @Override protected Node createNodeDelegate() { return new MyDataNode(this); } public class MyDataNode extends DataNode implements Node.Cookie { public MyDataNode(AbcDataObject obj) { super(obj, Children.LEAF, lookup); ic.add(this); setIconBaseWithExtension("org/myorg/abcfiletype/Datasource.gif"); } } @Override public Lookup getLookup() { return lookup; } @Override public Node.Cookie getCookie(Class type){ Object o = lookup.lookup(type); return o instanceof Node.Cookie ? (Node.Cookie)o: null; }}
And now you should have XML checking and validation enabled in the XML editor of your multiview component!


Read More about [ XML Editor in Source View of MultiView Component (Part 2)...