Recently I did some work with []XML and have to admit that it mad my life easier while working on xml creation and reading. Significantly improving development time compared to my previous attempt of dealing with xml in APL.
I have a couple of notes in regards of the tool:
- In general:
[]XML is good but may be we need something more general, what will cover more formats. For example next may be []JSON and so on. In this regard to have []PARSer may be a universal tool. Give it left argument bnf (Backus–Naur Form) text and receive translation of say SQL statement in the form of current []XML translation.
- In detail related to []XML work:
1. I want to compose xml but final document is collected from multiple functions which already return xml document. So currently I would need to do double work by decoding xml to 5 column matrix and then composing back to xml.
Say we have a simple task: we have a function, which produces xml, but requirements are to enclose result in one more tag. (I do not want to change base function as it is perfectly good for other tasks). So if I would be able to specify in column 5 that the value of the node should not have conversion of escape characters. I may simply create new []XML structure, assign result of sub function to 3rd column and set column 5 to be 1 so value of node will not have conversion of escape characters.
2. If we allow partial xml to be value for node in []XML matrix. we may add one more parameter to []XML when it parses xml document. And this parameter may be parse up to level 2 or 3 or 4 ... keeping all other levels as unchanged xml nodes.
3. Looks like a bug/luck of knowledge. I did not find a way of removing tabular formatting/leading white spaces from resulting xml document. It is always structured, with white spaces and CR LF characters.
/Alex
[]XML improvement
Re: []XML improvement
I know this is about a year later, so I'm sure you've already found an answer to your third question. It's possible to remove the formatting and indentation by passing an optional left argument to ⎕XML. For some odd reason (perhaps Dyalog can explain this) this is done with the 'whitespace' 'preserve' option. The default option 'strip' actually structures and indents the data. Seems a bit back-to-front to me, not very intuitive.
What I'm missing in ⎕XML is the option to - when converting to XML - use self-closing tags. At the moment the following statement is always returning false when self-closing tags are used in the source xml.
Reasons I'd like to see this implemented:
1. Size can drop significantly when the data consists of empty nodes with information set in the attributes.
2. It would make ⎕XML reversible.
Perhaps not the most urgent of requests, but it would be nice to have.
What I'm missing in ⎕XML is the option to - when converting to XML - use self-closing tags. At the moment the following statement is always returning false when self-closing tags are used in the source xml.
Code: Select all
≡∘⎕XML∘⎕XML⍨
Reasons I'd like to see this implemented:
1. Size can drop significantly when the data consists of empty nodes with information set in the attributes.
2. It would make ⎕XML reversible.
Perhaps not the most urgent of requests, but it would be nice to have.
Re: []XML improvement
Another reason might be that in a strict whatever it's called thingy if a tag is defined as "empty" or "self-closing" as you say it isn't allowed to have an end tag:
<this whatever="that"/>
(correct)
vs
<this whatever="that"></this>
(incorrect)
<this whatever="that"/>
(correct)
vs
<this whatever="that"></this>
(incorrect)