Class X


  • public class X
    extends Object
    Convenience functions to access elements of project files

    Based on the upstream schema, most elements may occur multiple times even if semantically only one is possible, e.g., for specifying the compiler warning level. MSBuild seems to use the last occurrence while evaluating the project. Moreover, most simple elements that seem to be strings are simply specified as xs:any. This results in most XMLBeans generated accessors to return List<XmlObject>, e.g., ClCompileDocument.ClCompile.getWarningLevelList().

    The functions string(List) and set(List, String) provide easy access by working on the last value of a list and treat it as a string. Additionally, set(List, String) adds an element if the list is empty. The functions string(XmlObject) and set(XmlObject, String) are for the case if the underlying element is modelled as a single xs:any element.

    Based on these functions, list(List, String) and set(List, List, CharSequence) provide get/set access to string elements that actually represent string-delimited (usually ';') lists. For this, the ListElementWrapper provides an alternative mutable list implementation that is backed directly by the underlying model.