Opened 12 years ago
Closed 12 years ago
#1868 closed defect (fixed)
A couple of syntax errors in Compiler/Template/CodegenXML.tpl
Reported by: | Bill Janssen | Owned by: | Bill Janssen |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.0 |
Component: | Backend | Version: | |
Keywords: | Cc: |
Description
CodegenXML.tpl gets the top-level declaration wrong, and has a couple of bugs with Boolean types. This means it can't be parsed by tools. Attached is a patch for these issues. After application, the generated XML actually validates. If I don't hear otherwise, I'll apply the patch in a day or two.
Attachments (1)
Change History (5)
by , 12 years ago
Attachment: | CodegenXML.tpl.patch added |
---|
comment:1 by , 12 years ago
comment:2 by , 12 years ago
- The xmlns expressions must be attributes on the top-level element, not freely-occurring strings in the body of the element. That's why the trailing greater-than sign must be moved.
- The expression <%if bool then "1" else "0"%> is just wrong -- the template system doesn't evaluate it. It's clear what needs to happen there -- my changes just make it happen.
- Really, there should be a test case or two for this -- and they should validate the generated XML. Say, by running it through the W3C's validator at http://validator.w3.org/.
comment:3 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
I'd also suggest renaming some of the functions depending on what they do. For instance, "modelDescriptionXml" should really be called "modelDescriptionAttributes", because that's what it generates. Whereas "vendorAnnotationsXml" should be called "VendorAnnotationsElement", because that's what it generates. That would make it easier for other people to work on this code in the future.
Where <OpenModelicaModelDescription> is opened at the top and closed at the end like this </OpenModelicaModelDescription>.
It seems quite ok .
What is your motivation to do like this.
However,regarding replacement of 'if bool then "1" else "0"' by (if bool then "1" else "0") ---I don't have any comment.