Skip to content

Commit

Permalink
Added $loc information to Element and Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbattle committed May 12, 2024
1 parent 7a3f42a commit 885bb03
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions xsd2vdm/src/main/java/xsd2vdm/XSDElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,13 @@ public String toString()
* The toVDM method produces a raw VDM model of XML document elements.
*
* Element ::
* name : seq1 of char
* $loc : seq1 of char
* type : seq1 of char
* attrs : seq of Attribute
* children : seq of Element | Content;
*
* Attribute ::
* $loc : seq1 of char
* name : seq1 of char
* value : seq1 of char;
*
Expand All @@ -269,6 +271,12 @@ protected String toVDM(String indent)
sb.append("(\n");
sb.append(indent2);
sb.append("\"");
sb.append(file.getName());
sb.append(":");
sb.append(line);
sb.append("\",\n");
sb.append(indent2);
sb.append("\"");
sb.append(type);
sb.append("\",\n");

Expand All @@ -289,6 +297,10 @@ protected String toVDM(String indent)
sb.append(sep);
sb.append(indent3);
sb.append("mk_Attribute(\"");
sb.append(file.getName());
sb.append(":");
sb.append(line);
sb.append("\", \"");
sb.append(pair.getKey());
sb.append("\", ");
sb.append(valueToVDM(pair.getValue()));
Expand Down Expand Up @@ -351,7 +363,8 @@ protected String valueToVDM(String value)

while (m.find())
{
nums.add(m.group());
double num = Double.parseDouble(m.group());
nums.add(Double.toString(num));
}

if (nums.size() == 1)
Expand Down

0 comments on commit 885bb03

Please sign in to comment.