Altova Mailing List Archives

Re: RFC: thoughts for a "streamlined" XML syntax variant...

From: BGB <cr88192@-------.--->
Date: 5/14/2012 9:25:00 PM
On 5/14/2012 4:49 AM, Manuel Collado wrote:
> El 11/05/2012 19:40, BGB escribió:
>> ...
>> example, say that a person has an expression like:
>> <if>
>> <cond>
>> <binary op="&lt;">
>> <ref name="x"/>
>> <number value="3"/>
>> </binary>
>> </cond>
>> <then>
>> <funcall name="foo">
>> <args/>
>> </funcall>
>> </then>
>> </if>
>> representing, say, the AST of the statement "if(x>3)foo();".
>> the parser and printer could use a more compact encoding, say:
>> <if
>> <cond <binary op="&lt;" <ref name="x"/> <number value="3"/>>>>
>> <then <funcall name="foo" <args/>>>
>> >
> In that case the slashes in the "/>" endmarks are probably superfluous.

in depends on how the parser works.

given the intention that the new syntax be a direct extension of the 
existing syntax, rather than entirely replacing it, the '/' is still 
needed in order to avoid the syntax becoming ambiguous (how do you 
otherwise distinguish between an empty tag and the start of a list which 
is terminated by a closing tag?...).

there are potentially more complex ways to deal with it, such as 
determining the type of the next matching closing tag, but this is 
problematic and potentially costly.

a begins, scans forwards, sees matched closing a.
b begins, scans forwards, sees that next closing tag is a, concludes it 
does not contain c, ...

the problem here is that in the naive case, this could cause the parser 
to require around O(n^2) time, rather than O(n) time, so it is better to 
avoid ambiguity.

or such...


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.