Open Brassrat opened 4 years ago
Oh man, I must have uploaded those files in the wrong folder. They should be in handlers, but the ones in root are the latest.
You can also download the latest release. It has all files in the right places... ;)
Thanks, I have updated my checkout.
However, I have a question, how can I reload saved xml into an existing form?
Thanks, Jay goldman mailto: work@mgjg.com
From: Michiel Meulendijk notifications@github.com Reply-To: MichielCM/xsd2html2xml reply@reply.github.com Date: Wednesday, January 15, 2020 at 18:36 To: MichielCM/xsd2html2xml xsd2html2xml@noreply.github.com Cc: Brassrat brassrat@mgjg.com, Author author@noreply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30) Resent-From: jgoldman@alum.mit.edu Resent-Date: Wednesday, January 15, 2020 at 18:36
Oh man, I must have uploaded those files in the wrong folder. They should be in handlers, but the ones in root are the latest.
You can also download the latest release. It has all files in the right places... ;)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MichielCM/xsd2html2xml/issues/30?email_source=notifications&email_token=AAEHFHFKSKHLPNXYCBTS473Q56MXNA5CNFSM4KHFSQH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJCGK2A#issuecomment-574907752, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEHFHD4M554S7YE2TA5IMDQ56MXNANCNFSM4KHFSQHQ.
Looks like the following will work:
Let xmlDocument = new DOMParser().parseFromString(doc, "application/xml");
parseNode( xmlDocument.childNodes[0], document.querySelector("[data-xsd2html2xml-xpath = '/".concat(xmlDocument.childNodes[0].nodeName).concat("']")) );
i.e., code from xmlToHTML,
but not using document.querySelector("meta[name='generator'][content='XSD2HTML2XML v3: https://github.com/MichielCM/xsd2html2xml']").getAttribute("data-xsd2html2xml-sourcehttps://github.com/MichielCM/xsd2html2xml'%5d%22).getAttribute(%22data-xsd2html2xml-source") to get the name
so far so good.
-jay
From: "Goldman, Jay - 0551 - MITLL" Jay.Goldman@ll.mit.edu Date: Thursday, January 16, 2020 at 14:13 To: MichielCM/xsd2html2xml reply@reply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30)
Thanks, I have updated my checkout.
However, I have a question, how can I reload saved xml into an existing form?
Thanks, Jay goldman mailto: work@mgjg.com
From: Michiel Meulendijk notifications@github.com Reply-To: MichielCM/xsd2html2xml reply@reply.github.com Date: Wednesday, January 15, 2020 at 18:36 To: MichielCM/xsd2html2xml xsd2html2xml@noreply.github.com Cc: Brassrat brassrat@mgjg.com, Author author@noreply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30) Resent-From: jgoldman@alum.mit.edu Resent-Date: Wednesday, January 15, 2020 at 18:36
Oh man, I must have uploaded those files in the wrong folder. They should be in handlers, but the ones in root are the latest.
You can also download the latest release. It has all files in the right places... ;)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MichielCM/xsd2html2xml/issues/30?email_source=notifications&email_token=AAEHFHFKSKHLPNXYCBTS473Q56MXNA5CNFSM4KHFSQH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJCGK2A#issuecomment-574907752, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEHFHD4M554S7YE2TA5IMDQ56MXNANCNFSM4KHFSQHQ.
I ‘spoke’ too soon … it appears that the parseNode method will not create nodes?
i.e., my xsd (attached is demo subset) has multiple ‘sequence’ elements which need to be ‘re-created’ – but this does not happen. Is there another way to do this which I didn’t see? Or do I have to do this myself, i.e., process the loaded xml to create the necessary nodes and then use parseNode to fill them in? Or just extend parseNode to create nodes as necessary – obviously the javascript methods are there since they are attached to the ‘add’ buttons.
TIA for any suggestions you might have (a number of years ago I was pretty fluent with xslt, but I’m pretty rusty now 😊) but I think this is mostly a javascript problem, i.e.,
-jay
Jay Goldman Subcontractor MIT Lincoln Laboratory Cyber Systems and Operations 244 Wood Street Lexington, MA 02420 Phone (Office): 781-981-0649 Email: jay.goldman@ll.mit.edumailto:jay.goldman@ll.mit.edu
From: "Goldman, Jay - 0551 - MITLL" Jay.Goldman@ll.mit.edu Date: Thursday, January 16, 2020 at 17:05 To: MichielCM/xsd2html2xml reply@reply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30)
Looks like the following will work:
i.e., code from xmlToHTML,
but not using document.querySelector("meta[name='generator'][content='XSD2HTML2XML v3: https://github.com/MichielCM/xsd2html2xml']").getAttribute("data-xsd2html2xml-sourcehttps://github.com/MichielCM/xsd2html2xml'%5d%22).getAttribute(%22data-xsd2html2xml-source") to get the name
so far so good.
-jay
From: "Goldman, Jay - 0551 - MITLL" Jay.Goldman@ll.mit.edu Date: Thursday, January 16, 2020 at 14:13 To: MichielCM/xsd2html2xml reply@reply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30)
Thanks, I have updated my checkout.
However, I have a question, how can I reload saved xml into an existing form?
Thanks, Jay goldman mailto: work@mgjg.com
From: Michiel Meulendijk notifications@github.com Reply-To: MichielCM/xsd2html2xml reply@reply.github.com Date: Wednesday, January 15, 2020 at 18:36 To: MichielCM/xsd2html2xml xsd2html2xml@noreply.github.com Cc: Brassrat brassrat@mgjg.com, Author author@noreply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30) Resent-From: jgoldman@alum.mit.edu Resent-Date: Wednesday, January 15, 2020 at 18:36
Oh man, I must have uploaded those files in the wrong folder. They should be in handlers, but the ones in root are the latest.
You can also download the latest release. It has all files in the right places... ;)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MichielCM/xsd2html2xml/issues/30?email_source=notifications&email_token=AAEHFHFKSKHLPNXYCBTS473Q56MXNA5CNFSM4KHFSQH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJCGK2A#issuecomment-574907752, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEHFHD4M554S7YE2TA5IMDQ56MXNANCNFSM4KHFSQHQ.
Hi!
Yes, parseNode should work as you describe. What happens if you transform an XML file with a reference to an XSD, the XSD is transformed and the XML file is just added completely as an attribute to the HTML meta tag. Did you try this approach?
Then the contents of the saved XML text are parsed with parseNode; it does create multiple elements if necessary.
Best regards, Michiel
On Fri, Jan 17, 2020 at 10:40 PM Brassrat notifications@github.com wrote:
I ‘spoke’ too soon … it appears that the parseNode method will not create nodes?
i.e., my xsd (attached is demo subset) has multiple ‘sequence’ elements which need to be ‘re-created’ – but this does not happen. Is there another way to do this which I didn’t see? Or do I have to do this myself, i.e., process the loaded xml to create the necessary nodes and then use parseNode to fill them in? Or just extend parseNode to create nodes as necessary – obviously the javascript methods are there since they are attached to the ‘add’ buttons.
TIA for any suggestions you might have (a number of years ago I was pretty fluent with xslt, but I’m pretty rusty now 😊) but I think this is mostly a javascript problem, i.e.,
- Reload empty html file or empty all sequences
- Walk down xml document and create nodes using clickAddButton ?
-jay
Jay Goldman Subcontractor MIT Lincoln Laboratory Cyber Systems and Operations 244 Wood Street Lexington, MA 02420 Phone (Office): 781-981-0649 Email: jay.goldman@ll.mit.edumailto:jay.goldman@ll.mit.edu
From: "Goldman, Jay - 0551 - MITLL" Jay.Goldman@ll.mit.edu Date: Thursday, January 16, 2020 at 17:05 To: MichielCM/xsd2html2xml reply@reply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30)
Looks like the following will work:
Read contents of file into string variable ‘doc’
Let xmlDocument = new DOMParser().parseFromString(doc, "application/xml");
parseNode( xmlDocument.childNodes[0], document.querySelector("[data-xsd2html2xml-xpath = '/".concat(xmlDocument.childNodes[0].nodeName).concat("']")) );
i.e., code from xmlToHTML,
but not using document.querySelector("meta[name='generator'][content='XSD2HTML2XML v3: https://github.com/MichielCM/xsd2html2xml' ]").getAttribute("data-xsd2html2xml-source< https://github.com/MichielCM/xsd2html2xml'%5d%22).getAttribute(%22data-xsd2html2xml-source>") to get the name
so far so good.
-jay
From: "Goldman, Jay - 0551 - MITLL" Jay.Goldman@ll.mit.edu Date: Thursday, January 16, 2020 at 14:13 To: MichielCM/xsd2html2xml reply@reply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30)
Thanks, I have updated my checkout.
However, I have a question, how can I reload saved xml into an existing form?
Thanks, Jay goldman mailto: work@mgjg.com
From: Michiel Meulendijk notifications@github.com Reply-To: MichielCM/xsd2html2xml reply@reply.github.com Date: Wednesday, January 15, 2020 at 18:36 To: MichielCM/xsd2html2xml xsd2html2xml@noreply.github.com Cc: Brassrat brassrat@mgjg.com, Author author@noreply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30) Resent-From: jgoldman@alum.mit.edu Resent-Date: Wednesday, January 15, 2020 at 18:36
Oh man, I must have uploaded those files in the wrong folder. They should be in handlers, but the ones in root are the latest.
You can also download the latest release. It has all files in the right places... ;)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/MichielCM/xsd2html2xml/issues/30?email_source=notifications&email_token=AAEHFHFKSKHLPNXYCBTS473Q56MXNA5CNFSM4KHFSQH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJCGK2A#issuecomment-574907752>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AAEHFHD4M554S7YE2TA5IMDQ56MXNANCNFSM4KHFSQHQ>.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MichielCM/xsd2html2xml/issues/30?email_source=notifications&email_token=AE4D3LA3SNLGJ6PBG5PNIDLQ6IQVVA5CNFSM4KHFSQH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJJBOAY#issuecomment-575805187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4D3LGLTBH3HJYH4OGHQDTQ6IQVVANCNFSM4KHFSQHQ .
Not exactly, the xml created by htmlToXml does not have an xsd reference.
But what I did was essentially the same (in my theForm.load() function)
However, It seems that if you have a top level sequence with nested sequences the code handles the outermost sequence but fails to re-create the inner sequences.
I really need to do a little more analysis, however, I think the code in question is:
( I guess from js/html-populators.xsl line 163
var button;
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) {
it looks like the previousChildName is null when the first of the inner sequence is processed so the clickAddButtom method is not invoked (this is correct for the outermost sequence as one entry is created when the html file is initially processed and thus nothing needs to be added to process the first outermost sequence entry)
I have attached the test xsd I am working working, the generated html file, my supplemental js file and a sample saved xml file (I have added the ability to save a partially filled in form, which is one of my requirements)
I don’t think you need the additional js files I add, they help in the additional buttons, etc.
Anyway, any help would be appreciated and I will let you know what I come up with.
-jay
Jay Goldman
Subcontractor
MIT Lincoln Laboratory
Cyber Systems and Operations
244 Wood Street
Lexington, MA 02420
Phone (Office): 781-981-0649
Email: jay.goldman@ll.mit.edu
From: Michiel Meulendijk notifications@github.com Reply-To: MichielCM/xsd2html2xml reply@reply.github.com Date: Monday, January 20, 2020 at 8:02 AM To: MichielCM/xsd2html2xml xsd2html2xml@noreply.github.com Cc: Brassrat brassrat@mgjg.com, Author author@noreply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30) Resent-From: jgoldman@alum.mit.edu Resent-Date: Monday, January 20, 2020 at 8:02 AM
Hi!
Yes, parseNode should work as you describe. What happens if you transform an XML file with a reference to an XSD, the XSD is transformed and the XML file is just added completely as an attribute to the HTML meta tag. Did you try this approach?
Then the contents of the saved XML text are parsed with parseNode; it does create multiple elements if necessary.
Best regards, Michiel
On Fri, Jan 17, 2020 at 10:40 PM Brassrat notifications@github.com wrote:
I ‘spoke’ too soon … it appears that the parseNode method will not create nodes?
i.e., my xsd (attached is demo subset) has multiple ‘sequence’ elements which need to be ‘re-created’ – but this does not happen. Is there another way to do this which I didn’t see? Or do I have to do this myself, i.e., process the loaded xml to create the necessary nodes and then use parseNode to fill them in? Or just extend parseNode to create nodes as necessary – obviously the javascript methods are there since they are attached to the ‘add’ buttons.
TIA for any suggestions you might have (a number of years ago I was pretty fluent with xslt, but I’m pretty rusty now 😊) but I think this is mostly a javascript problem, i.e.,
- Reload empty html file or empty all sequences
- Walk down xml document and create nodes using clickAddButton ?
-jay
Jay Goldman Subcontractor MIT Lincoln Laboratory Cyber Systems and Operations 244 Wood Street Lexington, MA 02420 Phone (Office): 781-981-0649 Email: jay.goldman@ll.mit.edumailto:jay.goldman@ll.mit.edu
From: "Goldman, Jay - 0551 - MITLL" Jay.Goldman@ll.mit.edu Date: Thursday, January 16, 2020 at 17:05 To: MichielCM/xsd2html2xml reply@reply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30)
Looks like the following will work:
Read contents of file into string variable ‘doc’
Let xmlDocument = new DOMParser().parseFromString(doc, "application/xml");
parseNode( xmlDocument.childNodes[0], document.querySelector("[data-xsd2html2xml-xpath = '/".concat(xmlDocument.childNodes[0].nodeName).concat("']")) );
i.e., code from xmlToHTML,
but not using document.querySelector("meta[name='generator'][content='XSD2HTML2XML v3: https://github.com/MichielCM/xsd2html2xml' ]").getAttribute("data-xsd2html2xml-source< https://github.com/MichielCM/xsd2html2xml'%5d%22).getAttribute(%22data-xsd2html2xml-source>") to get the name
so far so good.
-jay
From: "Goldman, Jay - 0551 - MITLL" Jay.Goldman@ll.mit.edu Date: Thursday, January 16, 2020 at 14:13 To: MichielCM/xsd2html2xml reply@reply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30)
Thanks, I have updated my checkout.
However, I have a question, how can I reload saved xml into an existing form?
Thanks, Jay goldman mailto: work@mgjg.com
From: Michiel Meulendijk notifications@github.com Reply-To: MichielCM/xsd2html2xml reply@reply.github.com Date: Wednesday, January 15, 2020 at 18:36 To: MichielCM/xsd2html2xml xsd2html2xml@noreply.github.com Cc: Brassrat brassrat@mgjg.com, Author author@noreply.github.com Subject: Re: [MichielCM/xsd2html2xml] multiline-strings.xsl vs handlers/multiline-strings.xsl (#30) Resent-From: jgoldman@alum.mit.edu Resent-Date: Wednesday, January 15, 2020 at 18:36
Oh man, I must have uploaded those files in the wrong folder. They should be in handlers, but the ones in root are the latest.
You can also download the latest release. It has all files in the right places... ;)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/MichielCM/xsd2html2xml/issues/30?email_source=notifications&email_token=AAEHFHFKSKHLPNXYCBTS473Q56MXNA5CNFSM4KHFSQH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJCGK2A#issuecomment-574907752>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AAEHFHD4M554S7YE2TA5IMDQ56MXNANCNFSM4KHFSQHQ>.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MichielCM/xsd2html2xml/issues/30?email_source=notifications&email_token=AE4D3LA3SNLGJ6PBG5PNIDLQ6IQVVA5CNFSM4KHFSQH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJJBOAY#issuecomment-575805187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4D3LGLTBH3HJYH4OGHQDTQ6IQVVANCNFSM4KHFSQHQ .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
the repo contains a multiline-strings.xsl file in the 'root' and one in handlers. The handlers/multiline-strings.xsl seems to be out-of-date as saxon reports a problem wrt extra min-length parameter which appears to be added to the 'root' multiline-strings.xsl. I tried copying the 'root' multiline-strings.xsl into handlers and this appears to resolve the saxon issue.
ALSO, there is a 'root' default-types.xsl which is appears to be out-of-date with the one in handlers? should this just be deleted?
BTW - thanks for building this tool, looks like it will save me a lot of development