MIS Systems Thread, commandreporter XML inconsistency in Technical; We are running SIMS commandreporter successfully to generate csv data out of SIMS.
However, we are aware that it would ...
22nd October 2012, 10:17 PM #1
- Rep Power
commandreporter XML inconsistency
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:
"\\server\c$\Program Files (x86)\SIMS\SIMS .net\commandreporter.exe" /USER:username /PASSWORD:**** /SERVER:server /DATABASE:dbase /REPORT:"_xxxx_StudentClassesx(xx)" /OUTPUT:"\\server2\m$\xxxx\xxxxx\StudentClassesx.xm l"
(comparable syntax works fine for CSV files and when run from CLI)
Have not found specific reference to this question in other posts here.
Last edited by bede; 22nd October 2012 at 10:21 PM.
Reason: add link to previous post
IDG Tech News
23rd October 2012, 03:22 PM #2
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
Info below here System.Xml.XmlConvert Class
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
23rd October 2012, 10:33 PM #3
- Rep Power
Thanks for that XML reference - we recognised the x0020 as 32 = space from the old ASCII days - and UTF equivalent.
The escape sequence makes sense.
What is still a puzzle is why SIMS generates the report one way manually (without escape sequence, but with a caption in the schema), and fully with escape sequence via commandreporter.
Will have another go at paramdef in case there is a setting in there to force one or the other, unless someone else already knows and can help out here.
27th March 2013, 11:45 AM #4
- Rep Power
Originally Posted by bede
I'm having the exact same problem.
Did you find a solution to this?
Thanks in anticipation,
27th March 2013, 12:17 PM #5
- Rep Power
No we did not find a solution in the end, sorry.
We wrote some python to process the xml as it stands ignoring the extra info. Not as elegant but did the job.
Then of course the goalposts changed and so we have not pursued it.
Paramdef did not appear to have a bearing as far as we could understand it in the timeframe we had.
27th March 2013, 12:23 PM #6
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.
There's a good thread about CR and PARAMDEF here: CLR /Params String
By rpycroft in forum Windows
Last Post: 8th December 2007, 12:55 PM
Last Post: 2nd November 2007, 09:45 PM
By Craig_W in forum ICT KS3 SATS Tests
Last Post: 17th May 2007, 08:49 AM
By TechMonkey in forum Web Development
Last Post: 2nd February 2007, 01:40 PM
By kingswood in forum MIS Systems
Last Post: 8th June 2006, 11:28 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread