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

Re-loading saved XML doesn't populate nested sequences #31

Open
Brassrat opened this issue Jan 27, 2020 · 1 comment
Open

Re-loading saved XML doesn't populate nested sequences #31

Brassrat opened this issue Jan 27, 2020 · 1 comment

Comments

@Brassrat
Copy link

I am splitting this off of the other issue i raised. You responded by suggesting that i transform the xml after adding a reference to the xsd. But the xsd file is not part of the deployed application. The goal is to deploy just the generated HTML file with additional js file and let the user create/save/load different XML files by filling in the generated HTML form.

In any case, what i am doing is using the htmlToXml function to create the XML from the form contents and saving this in some user-specified file. Then I am letting the user choose a previously saved file to be loaded into the HTML form.

So the xsd -> html transform only happens once, essentially on an empty xml document, i.e., with just my xsd file. My document has 2 sequences each of which contains subsequences
demo-skiier-ref.txt
(note: .xsd copied as .txt file)

When the user selects a file i parse the file into an XML document (which obviously needs to be one created from the HTML form being displayed). I then pass this xml document to parseNode to have it populate the HTML form. The js code generated from js/html-populators,xsl (~line 163) does not recreate all of the nested sequences and fill them with data.
the code
if (childElement.parentElement.lastElementChild.nodeName.toLowerCase() === "button") { button = childElement.parentElement.lastElementChild; } else if (childElement.parentElement.parentElement.parentElement.lastElementChild.nodeName.toLowerCase() === "button" && !childElement.parentElement.parentElement.parentElement.lastElementChild.hasAttribute("data-xsd2html2xml-element")) { button = childElement.parentElement.parentElement.parentElement.lastElementChild; } if (button !== null && **childNode.nodeName === previousChildName**) { clickAddButton(...)...

does not seem to work for nested sequences, just for the outermost sequence element is created but none of the inner sequence elements are created and populated.

Seems like the check for nodeName === previousChidName is not quite correct.

@Brassrat
Copy link
Author

correction! the data is being populated, but the sections are HIDDEN - the hidden (and possibly the disabled) attribute is still present.

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

1 participant