Open volodya-lombrozo opened 10 months ago
@maxonfjvipon Could you take a look, please?
It's kinda urgent
@volodya-lombrozo could you please provide an xmir you try to print?
@maxonfjvipon
<o base="opcode" line="999" name="LDC-1">
<o base="int" data="bytes">00 00 00 00 00 00 00 12</o>
<o base="string" data="bytes">62 79 65</o>
</o>
Here the entire java code, text
variable is above:
final String text = new Xembler(this.toXmir(), new Transformers.Node()).xmlQuietly();
System.out.println(text);
return new Xmir.Default(new XMLDocument(text)).toEO();
Same for <o base="opcode" line="999" name="LDC-1"/>
, <o base="opcode" line="999" name="LDC"/>
, <o/>
@volodya-lombrozo your examples are not valid. There's no <program>
and <objects>
nodes
@maxonfjvipon, could you also ensure their validity, please? At least, they used to be valid with the old 'XMIR' implementation, and I don't see any reason why they wouldn't be valid. Moreover, it's strange that you check validity during printing eo
. As a developer I don't expect it.
@volodya-lombrozo old XMIR
implementation was wrong. It tried to print whatever XML you provide to it. XMIR as a format has a certain structure - XSD schema (Schema
object from eo-maven-plugin
). So Xmir.Default
objects expects that incoming XML is XMIR, but not a random XML with <o>
nodes.
@volodya-lombrozo I could add validation to Xmir.Default
object but I believe it would make you more troubles and we already have such validation in PrintMojo
that uses Xmir
@volodya-lombrozo And I think we definitely need to add some human readable message if something is wrong
@maxonfjvipon What if I need to print only part of the eo
(a single object for instance?) It's strange that now I need to create the entire xmir
structure to do it (which in turn complicates testing in my case.)
@volodya-lombrozo I could add validation to
Xmir.Default
object but I believe it would make you more troubles and we already have such validation inPrintMojo
that usesXmir
I believe it's better to remove the validation here. Or give a chance to use some other class without validation.
@yegor256 We need adults here
@volodya-lombrozo I'm on the XSD side here: XMIR is a data format that has certain limitations, for example it starts with <program>
and keeps all <o>
objects inside the <objects>
element. Let's adhere to this format, to make sure we don't have false expectations about the behavior of different components of our environment. So, if it's XMIR it should be XSD-compliant. BTW, it's not so hard to achieve.
Ok. Anyway, I believe Xmir.Default#toEO
should print human-readable message instead of:
[main] ERROR com.jcabi.xml.ConsoleErrorListener -- #fatalError(): org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.; SystemID: file:///org/eolang/parser/xmir-to-eo.xsl; Line#: 109; Column#: 61
Needs #2804
@volodya-lombrozo seems to be a duplicate of #3370?
@yegor256 #3370 issue is related to the PHI
printing. This issue is related to EO
printing.
@volodya-lombrozo usually, it's better to give titles to tickets such that they (the titles) explain the entire problem. A reader should understand what's wrong and what needs to be fixed. Here, I would use a title like "error messages are misleading" or "better error messages are needed" (you can make up a better one, but it has to explain what's wrong)
@yegor256 is it better now?
I'm trying to print
eo
by using the following commandnew Xmir.Default(new XMLDocument(xml)).toEO(),
and it gives me the following error:The full stacktrace:
I don't know what to do with it and how to fix my xmir. Could you please add more human-readable message?