API Change: Addons.Xml.XmlContextElement

SyntaxEditor Web Languages Add-on for Windows Forms Forum

Posted 12 years ago by gardea
Version: 4.0.0255
Avatar
Would it be possible for you to make the Attributes property of the ActiproSoftware.SyntaxEditor.Addons.Xml.XmlContextElement (currently internal, Hashtable) public? It could be the whole (eventually a readonly copy so that "externals" may not corrupt your structure) hashtable or the array with the keys of the hashtable at least.

My usage scenario:

I am building my own XmlSyntaxLanguage by extending your ActiproSoftware.SyntaxEditor.Addons.Xml.XmlSyntaxLanguage.

then

base.SyntaxEditorIntelliPromptMemberListPreFilter += new IntelliPromptMemberListPreFilterEventHandler(XmlSyntaxLanguage_SyntaxEditorIntelliPromptMemberListPreFilter);

then

I can apply more complex and/or specific attribute filtering logic while avoiding to rebuild the whole info you seem to have already.

Examples for the XML Schema editor:

a choice/sequence/all compositor should not display name/ref attributes as options even though the schema resolves them as allowed (see section 3.8.2 XML Representation of Model Group Schema Components, XML Schema Part 1)

ref/name for elements are mutually exclusive.

Thank you.

Comments (3)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
So you only need the names of the attributes that exist within the current tag, correct? What if they have namespace prefixes, do we just return it in "ns:attributeName" format in this case?


Actipro Software Support

Posted 12 years ago by gardea
Avatar
At least in the form of [xmlns-alias:]attr-name (as it seems to work today). Right now I am using the NamespacePrefixes property of the context to build an indexed collection between aliases and namespaces and then a small util function which converts [xmlns-alias:]attr-name to an XmlQualifiedName. I am assuming (didn't test it yet) that the NamespacePrefixes property returns the list of *in-scope* mappings.

As a side note: for my specific use case, it would be ideal to return the list of XmlQualifiedName which were fully resolved from an xmlns alias point of view (includes "xml" and "xmlns" prefixed attributes). Attributes like "dummy:test" where dummy is not resolvable to an xmlns are in error and unusable for standard xml parsers, so returning them in this list doesn't help in my case. But then the semantics of the Attributes property would be altered from "whatever the user typed in" to "valid typed in attributes", which would be more restrictive.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ok, did even better than all this for the next maintenance release:
1) Added the XmlContextElement.Attributes property, which lists the attributes in the element. The keys are the attribute namespace prefix and name, and the values are of type XmlContextAttribute.
2) Added the QualifiedName property to the XmlContextElement and XmlContextAttribute classes.

If you'd like to test out a preview build of this functionality, send over an email to our support address.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 10 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.