We are running SIMS commandreporter successfully to generate csv data out of SIMS.
However, we are aware that it would be better to export the data in XML (not least as a spurious comma in some student data recently caused a minor hiccup).
XML is a [relatively] new venture for us for this kind of thing (CSV has worked till now so we have not fixed it), but it seems that Python is adept at handling it and so progress drags us forward (another spinning plate).
A [test] report has been created to list the classes of students. (see attached pdf, slide 1)
Commandreporter generates the xml shown in slide 2 - note the attribute 'multiple IDs' and the 'x0020' in the middle of the attribute labels (hex for the space in the field name in SIMS?)
When run manually from SIMS it generates the XML shown in slide 3. No multiple IDs and no 'x0020' in the middle of attribute names. However in the schema the attributes have a 'caption' of the field name.
The question is a)why the difference? and b) is the x0020 consistent or might it change (if it is derived from something other than my guess)
[would be better/simpler for coding if we can get commandreporter to generate the simpler 'manual' xml]
OK that was 2 questions. [No one expects the Spanish Inquisition.]
Any constructive help/advice gratefully received, even if only to confirm this is expected behaviour and we have to live with it (should others have come across this also).
We did try to generate a paramdef file in case that is relevant, but it did not make much sense to us (other than date fields referred to in other posts).
If it helps our cmd file for comandreporter is as follows:
The _x0020_ is the UTF value for a space when the xml docuemt is parsed as XML element names can't have spaces
'_' is the escape character and 'x0020' is the UTF code for space, kind of like in HTML
public static string EncodeName(string name);
Converts a name to a valid XML name.
A String specifying the name to be encoded.
A String containing the XML name. If name is null or System.String.Empty, name is returned.
This method translates invalid characters, such as spaces or half-width Katakana, that need to be mapped to XML names without the support or presence of schemas. The invalid characters are translated into escaped numeric entity encodings.
The escape character is '_'. Any XML name character that does not conform to the W3C Extensible Markup Language (XML) 1.0 specification is escaped as _xHHHH_. The HHHH string stands for the four-digit hexadecimal UCS-2 code for the character in most significant bit first order. For example, the name "Order Details" is encoded as "Order_x0020_Details".
The underscore character does not need to be escaped unless it is followed by a character sequence that together with the underscore can be misinterpreted as an escape sequence when decoding the name. No short forms are encoded. For example, the forms "_x20_" and "__" are not encoded.
This method guarantees the name is valid according to the XML specification. It allows colons in any position, which means the name might still be invalid according to the W3C Namespace Specification (Namespaces in XML 1.0 (Third Edition)). To guarantee it is a valid namespace qualified name use the System.Xml.XmlConvert.EncodeLocalName(System.Strin g) method for the prefix and local name parts and join the result with a colon.
See the System.Xml.XmlConvert.EncodeLocalName(System.Strin g) method for an example comparing the System.Xml.XmlConvert.EncodeLocalName(System.Strin g), System.Xml.XmlConvert.EncodeName(System.String), and System.Xml.XmlConvert.EncodeNmToken(System.String) methods.
System.Xml.XmlConvert Class, System.Xml Namespace
I don't know why SIMS does this, but I can confirm that CommandReporter is consistent (i.e. whatever field names it gives you, it will always give you).
Paramdef is useful for reports that contain filters, you can set default values in SIMS, run CommandReporter with PARAMDEF switch and edit the resulting XML to edit the filters (you pass the PARAMDEF XML as an argument to CommandReporter.