Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import XMI fails with A JavaScript error occured in the main process #18

Open
aruvic opened this issue Jul 3, 2022 · 4 comments
Open

Comments

@aruvic
Copy link

aruvic commented Jul 3, 2022

Reproduce: File >> Import >> XMI Import (v2.1) >> SID Models.xmi

error

@Dead-Rabbit
Copy link

same

@Dead-Rabbit
Copy link

i fixed it (may be)
find out file xmi21-reader.js by path:
C://Users/<user_name>/AppData/Roaming/StarUML/extensions/user/staruml.xmi/xmi21-reader.js
at line: 333 change into
var XMINode = dom.getElementsByTagName('xmi:XMI')[0]
image

image

success ??

@ckuhlmann
Copy link

I could import import a XMI v2.1.1 export from Modelio 4.1 into StarUML 5.1,
by replacing line 333 of xmi21-reader.js
var XMINode = dom.getElementsByTagName('XMI')[0]
with

  //var XMINode = dom.getElementsByTagName('XMI')[0]
  
  var XMINode = dom.getElementsByTagName('xmi:XMI')[0]
  if (typeof(XMINode) == 'undefined') {
    XMINode = dom.getElementsByTagName('XMI')[0]
  }
  
  if (typeof(XMINode) == 'undefined') {
    // we are desperate now, try to start from UML:Model
    var XMIModelNode = dom.getElementsByTagName('uml:Model')[0]
    if (typeof(XMIModelNode) != 'undefined' && XMIModelNode != null && typeof(XMIModelNode.parentNode) != 'undefined' ) {
      XMINode = XMIModelNode.parentNode // this might not be the xmi node, but seems equivalent enough to us
    }
  }
  
  if (typeof(XMINode) == 'undefined') {
    // still no luck, out of options
    window.alert('Could not find root element, Import failed.')
    return
  }

Maybe someone can improve the code to production quality and make a pull request.

@JoelSA1
Copy link

JoelSA1 commented May 2, 2024

Someone have fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants