Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ja1234 on November 25, 2015, 02:02:44 am
-
Hi,
I want to include an XSD file into the project, so that I can verify an XML file by applying the schema. The return path should be the full path to the XSD file that is included in the project.
Sample code:
try {
xs.add("urn:books", "path_file_included_in_Sparx.xsd");
xd.schemas = xs;
xd.async = false;
xd.validateOnParse = false;
}
where path_file_included_in_Sparx should be the path to the file included in Sparx.
Is there a way that I can do this in SPARX? :-?
-
Are you looking for the Import XML Schema (http://sparxsystems.com/enterprise_architect_user_guide/12.1/schema_engineering/import_xsd.html) function?
Try right clicking on a package and then choose Code Engineering|Import XML Schema...
If you are only after storing the file as such in EA you should try to drag and drop it from the windows explorer on an empty diagram and choose Artifact (internal) (version 12+)
Geert
-
Sorry for my late reply and thanks for your reply. But that is not quite what I am trying to do. I am writing a script. This script will then be exported and should be able to run the validation on each machine that I import it to...
So that for the example above there would be:
path_file_included_in_Sparx = EA_path + XSD_filename
What I am trying to do is get the EA_path
and XSD_filename
somehow, is that possible by including it as a resource?
TLDR; XML validation script with XSD schema included as a file using MSXML validator
(http://i.imgur.com/nDKKeWF.png)
-
No, sorry I don't understand your question.
Geert