Author Topic: Include XSD file into project  (Read 5370 times)

ja1234

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Include XSD file into project
« 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:

Code: [Select]
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?  :-?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13274
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Include XSD file into project
« Reply #1 on: November 25, 2015, 06:18:19 am »
Are you looking for the Import XML Schema 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

ja1234

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: Include XSD file into project
« Reply #2 on: December 01, 2015, 08:28:18 pm »
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:

Code: [Select]
path_file_included_in_Sparx = EA_path + XSD_filename
What I am trying to do is get the
Code: [Select]
EA_path and
Code: [Select]
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


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13274
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Include XSD file into project
« Reply #3 on: December 01, 2015, 09:29:04 pm »
No, sorry I don't understand your question.

Geert