Say I have a file like this:
<Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Connections> <OleDbConnection Name="OLEDB_CON_EDW_STG2"> </OleDbConnection> <FlatFileConnection FilePath="C:\EDW\Data\<#=cycleTypeCd#>\<#=table.Name#>.dat"> <Expressions> <Expression PropertyName="ConnectionString"> </Expression> </Expressions> </FlatFileConnection> </Connections> </Biml>
The <# and #> delimiters are lexical transitions between the custom XML language and C#, using the Syntax Editor's lexical transition logic. We have intellisense and quick info working but I'm hitting a problem.
1. When I hover over the <Expressions> tag, directly under the <FlatFileConnection> tag, my Quick Info logic believes that <Expressions> is an invalid child element. Further, the returned element hierarchy is: Biml / Connections, although it should be Biml / Connections / FlatFileConnection.
2. A related issue is when I hover over 'C:\EDW\Data\' in the FlatFileConnection's FilePath attribute, I see the expected Quick Info content, describing the FilePath attribute. However, if I hover 'dat' at the end of the attribute value, the Quick Info pop-up displays information about the FlatFileConnection element, instead of the FilePath attribute.
The XML parser is reporting an error on the line with the start FlatFileConnection tag. The error is: "Attribute end value delimiter expected". The error's position is at the backslash character that's between the two C# delimited code 'nuggets'. I suspect this error is contributing to the incorrect element hierarchy when hovering over the Expressions tag.
As mentioned near the bottom of this post, I'm using a custom XmlTokenReader to filter out non-XML tokens via an overriden GetNextToken() method. As GetNextToken() is called during a parse, I see that it returns three attribute-value tokens in succession:
token text = C:\EDW\Data\, id = 11
token text = \, id = 11
token text = dat, id = 11
My theory, regarding the parser error, is that the parser expects an attribute-end-delimiter token to immediately follow the first attribute-value token, and gets confused when two more attribute-value tokens arrive instead. While I do have the source code for the XML and Dot Net add-ons, that isn't sufficient to confirm if my theory is correct.
1. Does my theory, as to the cause of the parse error, seem reasonable?
2. If so, what's the right way for me to solve this? I speculate that I could workaround this by somehow combining consecutive attribute value tokens but that seems kludgy.
3. If my theory doesn't sound right, do you have any notion on what might be the problem here, or thoughts on how can I debug this?
I looked at this some more and believe the parse error stems from the XmlGrammar in the add-on. Specifically, in the element.Production assignment, the grammar has:
For the above scenario to work, it needs to be something like:
By allowing zero or more attribute-value text terminals, my scenario works. Additionally, there are no parse errors in the AST and the Quick Info pop-up over the Expressions tag displays the correct information.
The only catch is that problem #2 above remains. I don't know if that's due to an issue in the built-in Quick Info provider or an issue on our end.
[Modified 8 years ago]