我的 PlantUML 序列图中遇到语法错误。它与第 19 行相关。这是我试图创建的图表:
@startuml
participant Employee
participant System
group "Employee adds leave request" {
Employee -> System: Log in
activate System
Employee -> System: Select 'Add Leave Request'
Employee -> System: Fill out leave request form
Employee -> System: Submit leave request
System -> System: Validate leave request
alt Leave request is valid
System -> System: Update leave request status
System --> Employee: Notify successful submission
else Leave request is invalid
System --> Employee: Notify invalid request
end
deactivate System
}
@enduml
我收到的错误消息是“第 19 行语法错误”。我尝试过重新格式化代码,但我似乎无法找出导致问题的原因。
有人可以帮我识别并解决 PlantUML 序列图中的语法错误吗?
谢谢!
在尝试解决语法错误时,我首先查看了 PlantUML 文档并确保我的序列图遵循正确的语法指南。我仔细检查了每一行是否有拼写错误或缺少的元素。
我还尝试通过删除任何不必要的组件来简化图表,以查看错误是否仍然存在。然而,即使经过这些调整,第 19 行的语法错误仍然存在。
我期望通过遵守正确的语法并简化图表,错误将得到解决,并且序列图将正确呈现,而不会出现任何语法错误。然而,尽管我努力了,错误消息仍然出现。
使用
end
代替 {
}
。另外,如果您不想将组描述放在引号中,则可能应该跳过 "
。
@startuml
participant Employee
participant System
group Employee adds leave request
Employee -> System: Log in
activate System
Employee -> System: Select 'Add Leave Request'
Employee -> System: Fill out leave request form
Employee -> System: Submit leave request
System -> System: Validate leave request
alt Leave request is valid
System -> System: Update leave request status
System --> Employee: Notify successful submission
else Leave request is invalid
System --> Employee: Notify invalid request
end
deactivate System
end
@enduml