XMLSpy irritations

Published on 13 December, 2006 at 12:47

For a project at work, I need to automate Altova XMLSpy using its API. I want to "flatten" an XSD, which includes other XSDs, into a single XSD that includes all the element definitions inline, without any duplications.

It looked like a simple job - Altova have documented their API pretty well, and it's quite clean and easy to use. However, I spent 3 hours yesterday wondering why, when I added or removed nodes, nothing happened.

It turns out - as helpfully documented in a rather hidden place - that you must switch to the Grid view before you can use XMLData objects to programmatically alter the document tree. So when you open a document, you must do this (assuming you're writing in C#):
Document lMyNewXsd = lApp.Documents.NewFile("test.xsd", "xsd");
lMyNewXsd.SwitchViewMode(SPYViewModes.spyViewGrid);
Grr - I do wish gotcha's like this were documented more clearly!

0 Comments Add your own

Add a New Comment

 


 

Comment Guidelines: Basic XHTML is allowed (a href, strong, em, code). Line breaks and paragraphs are automatically generated. Off-topic or inappropriate comments will be edited or deleted. Email addresses will never be published. Thanks.