+ Post New Thread
Results 1 to 6 of 6
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 ...
  1. #1

    Join Date
    Jun 2009
    Posts
    11
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Question 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.

    TIA
    Attached Files Attached Files
    Last edited by bede; 22nd October 2012 at 09:21 PM. Reason: add link to previous post

  2. #2

    Join Date
    Jan 2007
    Posts
    100
    Thank Post
    0
    Thanked 34 Times in 23 Posts
    Rep Power
    21
    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.Strin g) method for the prefix and local name parts and join the result with a colon.


    Example
    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.

    See Also
    System.Xml.XmlConvert Class, System.Xml Namespace

  3. #3

    Join Date
    Jun 2009
    Posts
    11
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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.

  4. #4

    Join Date
    Mar 2013
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by bede View Post
    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

  5. #5

    Join Date
    Jun 2009
    Posts
    11
    Thank Post
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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.

  6. #6

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,565
    Thank Post
    1,470
    Thanked 1,223 Times in 832 Posts
    Rep Power
    752
    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

  7. Thanks to LosOjos from:

    bede (13th April 2013)

SHARE:
+ Post New Thread

Similar Threads

  1. ISA 2004 Proxy Block List XML - Importable...
    By rpycroft in forum Windows
    Replies: 3
    Last Post: 8th December 2007, 11:55 AM
  2. Replies: 14
    Last Post: 2nd November 2007, 08:45 PM
  3. Create XML PLASC file
    By Craig_W in forum ICT KS3 SATS Tests
    Replies: 0
    Last Post: 17th May 2007, 07:49 AM
  4. Any XML gurus?
    By TechMonkey in forum Web Development
    Replies: 4
    Last Post: 2nd February 2007, 12:40 PM
  5. Attendance figures from SIMS inconsistent
    By kingswood in forum MIS Systems
    Replies: 2
    Last Post: 8th June 2006, 10:28 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •