Jump to content

Recommended Posts

Posted (edited)

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.xml"

 

 

(comparable syntax works fine for CSV files and when run from CLI)

 

Have not found specific reference to this question in other posts here.

 

TIA

xmlvariation.pdf

Edited by bede
add link to previous post
Posted

Hi Bede

 

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

 

XmlConvert.EncodeName Method

public static string EncodeName(string name);

 

 

Summary

Converts a name to a valid XML name.

 

Parameters

name

A String specifying the name to be encoded.

Return Value

A String containing the XML name. If name is null or System.String.Empty, name is returned.

 

Description

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.String) method for the prefix and local name parts and join the result with a colon.

 

 

Example

See the System.Xml.XmlConvert.EncodeLocalName(System.String) method for an example comparing the System.Xml.XmlConvert.EncodeLocalName(System.String), System.Xml.XmlConvert.EncodeName(System.String), and System.Xml.XmlConvert.EncodeNmToken(System.String) methods.

 

See Also

System.Xml.XmlConvert Class, System.Xml Namespace

Posted

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.

  • 5 months later...
Posted
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.

 

 

I'm having the exact same problem.

Did you find a solution to this?

 

Thanks in anticipation,

Steve

Posted

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.

Posted

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: http://www.edugeek.net/forums/mis-systems/86701-clr-params-string.html

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...