StudentAcademicRecord wrong ordering of elements

Asked by Jon Kelley

When using the ADK to generate a StudentAcademicRecord object I get the following error after sending the message to ZIS which seems to me that the ADK is generating the elements in the wrong order (MarkingPeriod before SchoolCourseInfoData).

Any ideas anyone??????

(* 8/16/11 3:20:18 PM EDT *) [I] <b>SIF_Response</b> message received from agent (11536 bytes)

<SIF_Message xmlns="http://www.sifinfo.org/infrastructure/2.x" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0r1">
  <SIF_Response>
    <SIF_Header>
      <SIF_MsgId>1555E252514044AB8FCB0CE46769BC0B</SIF_MsgId>
      <SIF_Timestamp>2011-08-16T15:20:18-04:00</SIF_Timestamp>
      <SIF_Security>
        <SIF_SecureChannel>
          <SIF_AuthenticationLevel>0</SIF_AuthenticationLevel>
          <SIF_EncryptionLevel>0</SIF_EncryptionLevel>
        </SIF_SecureChannel>
      </SIF_Security>
      <SIF_SourceId>Aspen</SIF_SourceId>
      <SIF_DestinationId>SIFQuery</SIF_DestinationId>
    </SIF_Header>
    <SIF_RequestMsgId>83586C60A20B459797968482B9052179</SIF_RequestMsgId>
    <SIF_PacketNumber>1</SIF_PacketNumber>
    <SIF_MorePackets>No</SIF_MorePackets>
    <SIF_ObjectData><StudentAcademicRecord RefId="53544430303031454F66516371595802" SIF_RefId="53544430303031454F66516371595802" SIF_RefObject="StudentPersonal">
  <ReportingDate>2011-08-16</ReportingDate>
  <StudentSchoolEnrollmentData SchoolAttendedRefId="534B4C30303031454F66657671595802">
    <GradeLevel>
      <Code>03</Code>
    </GradeLevel>
  </StudentSchoolEnrollmentData>
  <StudentSchoolEnrollmentData SchoolAttendedRefId="534B4C30303031454F66657671595802"/>
  <StudentSchoolEnrollmentData>
    <GradeLevel>
      <Code>03</Code>
    </GradeLevel>
  </StudentSchoolEnrollmentData>
  <SchoolAttendanceHistory>
    <SchoolAttended RefId="534B4C30303031454F666576726D5802">
      <SchoolInfoData>
        <LocalId>02620065</LocalId>
        <SchoolName>Veterans Memorial School</SchoolName>
      </SchoolInfoData>
      <MarkingSystems>
        <MarkValueInfoData RefId="475253303030303030334F495A6B5802"/>
      </MarkingSystems>
    </SchoolAttended>
    <SchoolAttended RefId="534B4C30303031454F66657671595802">
      <SchoolInfoData>
        <LocalId>02620050</LocalId>
        <SchoolName>Oaklandvale Elementary School</SchoolName>
      </SchoolInfoData>
      <MarkingSystems>
        <MarkValueInfoData RefId="475253303030303030334F495A6B5802"/>
      </MarkingSystems>
    </SchoolAttended>
  </SchoolAttendanceHistory>
  <CurrentCourseActivity>
    <Courses>
      <Course>
        <MarkingPeriod>
          <MarkData MarkValueInfoDataRefId="475253303030303030334F495A6B5802">
            <Numeric>85</Numeric>
          </MarkData>
        </MarkingPeriod>
        <SchoolAttendedRefId>534B4C30303031454F66657671595802</SchoolAttendedRefId>
        <SchoolCourseInfoData>
          <CourseCode>5001e</CourseCode>
          <Description>Social Studies</Description>
        </SchoolCourseInfoData>
      </Course>
    </Courses>
  </CurrentCourseActivity>
</StudentAcademicRecord>
 </SIF_ObjectData>
</SIF_Response>
</SIF_Message>

(* 8/16/11 3:20:18 PM EDT *) [A] <b>SIF_Response</b> acknowledged (not successful)
XML Validation Error. cvc-complex-type.2.4.d: Invalid content was found starting with element 'SchoolAttendedRefId'. No child element is expected at this point.
(* 8/16/11 3:20:18 PM EDT *) [A] <b>SIF_Ack</b> message received from agent (812 bytes)

Question information

Language:
English Edit question
Status:
Open
For:
Open ADK for Java Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jon Nicholson (jonicholson) said :
#1

Have you tried manually editing the above XML to change the order of elements and using the method Zone.sifSend(String) to send it out to the ZIS?

I should think that would at least tell you if the ordering is the cause, or at least give some more information.

Revision history for this message
Jon Kelley (jonkelley79) said :
#2

Using this validator http://compliance.sifinfo.org/validate/index.jsp and switching the
<MarkingPeriod>
          <MarkData MarkValueInfoDataRefId="475253303030303030334F495A6B5802">
            <Numeric>85</Numeric>
          </MarkData>
        </MarkingPeriod>

element to be below the SchoolAttendedRefId and SchoolCourseInfoData elements makes this a valid message.

Revision history for this message
Jon Nicholson (jonicholson) said :
#3

To make a wild guess... It could be an issue in how the StudentAcademicRecord object is constructed.

What I mean is, it appears the SDO classes wrap a SIF DOM, and having quickly looked at the openadk.library.etranscripts.Course class (I assume etranscipts is the right area? I'm not familiar with the US model) the issue you're experiencing may be caused by a specifically calling either setMarkingPeriods(MarkingPeriod) or setMarkingPeriods(MarkingPeriods), followed by a call setSchoolAttendedRefId(String) and setSchoolCourseInfoData(SchoolCourseInfoData) in that order (the call to setMarkingPeriods(...) could be due to the use of the constructor on Course that takes a MarkingPeriod object as an argument).

At a glance, it appears that the ADK does not attempt to reorder the elements before converting to XML, probably on the assumption that whatever code generates the object is doing it in the correct order. However, looking at the docs, I can't see any indication one way or the other. I hope someone who is more familiar with the inner workings of the Open ADK can shed some light on this matter?

Revision history for this message
Jon Kelley (jonkelley79) said :
#4

It looks as though the sequence number is set to 0 for MarkingPeriods, 1 for SchoolAttendedRefId, and 2 for SchoolCourseInfoData which is why the ordering is this way.

Now it is unclear why the sequence number for MarkingPeriod is being set to 1.

Is there anyone on this site that has this level of insight into the ADK?

Thanks.

Revision history for this message
Jon Nicholson (jonicholson) said :
#5

Where did you find the sequence number bit?

I've just been browsing the code again and formed a new theory. Looking at The file:

 /open-adk-java/adk-library/core/src/main/java/openadk/library/SIFElement.java

And found the method:

public void restoreImplementationDef(Element candidate)

The comments there are interesting, and suggests that this is a related issue. So, I started looking at the spec for the US 2.0r1 and the file:

 /open-adk-java/adk-generator/datadef/sif20r1/etranscripts.xml

And there seems to be a discrepancy... In the above XML it appears that The Course element expects a MarkingPeriods child element, but the spec says MarkingPeriod. Do you think that this has been miss-spelled in the above XML? I believe it might cause the MarkingPeriod element to not be reordered correctly as it's not finding the right element def to assign.

A test would be in the above method, add an else block to log/print out why the found element def is null. I'd expect MarkingPeriod to be logged/printed if this is the issue.

Revision history for this message
Jon Kelley (jonkelley79) said :
#6

Good catch.....changing it to use MarkingPeriods causes it to be generated in the correct order but now it is invalid because it is looking for StartDate, EndDate or MarkingPeriod. Seems as though the xml is incorrect causing the generated code to also be incorrect.

I need to fix this somehow. If you or anyone else has any insight let me know.

Revision history for this message
Jon Kelley (jonkelley79) said :
#7

<SIF_Message xmlns="http://www.sifinfo.org/infrastructure/2.x" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="2.0r1">
  <SIF_Response>
    <SIF_Header>
      <SIF_MsgId>AA24898EE4AA4D7E9F4327ECAD3BF64A</SIF_MsgId>
      <SIF_Timestamp>2011-08-24T20:57:24-04:00</SIF_Timestamp>
      <SIF_Security>
        <SIF_SecureChannel>
          <SIF_AuthenticationLevel>0</SIF_AuthenticationLevel>
          <SIF_EncryptionLevel>0</SIF_EncryptionLevel>
        </SIF_SecureChannel>
      </SIF_Security>
      <SIF_SourceId>Aspen</SIF_SourceId>
      <SIF_DestinationId>SIFQuery</SIF_DestinationId>
    </SIF_Header>
    <SIF_RequestMsgId>3541B318797C4ACE8797A3D031E22C90</SIF_RequestMsgId>
    <SIF_PacketNumber>1</SIF_PacketNumber>
    <SIF_MorePackets>No</SIF_MorePackets>
    <SIF_ObjectData><StudentAcademicRecord RefId="53544430303031454F66516371595802" SIF_RefId="53544430303031454F66516371595802" SIF_RefObject="StudentPersonal">
  <ReportingDate>2011-08-24</ReportingDate>
  <StudentSchoolEnrollmentData SchoolAttendedRefId="534B4C30303031454F66657671595802">
    <GradeLevel>
      <Code>03</Code>
    </GradeLevel>
  </StudentSchoolEnrollmentData>
  <CurrentCourseActivity>
    <Courses>
      <Course>
        <SchoolAttendedRefId>53544430303031454F66516371595802</SchoolAttendedRefId>
        <SchoolCourseInfoData>
          <CourseCode>1</CourseCode>
        </SchoolCourseInfoData>
        <MarkingPeriods>
          <MarkingPeriod>
            <MarkData MarkValueInfoDataRefId="53544430303031454F66516371595802">
              <Letter>A</Letter>
            </MarkData>
          </MarkingPeriod>
        </MarkingPeriods>
      </Course>
    </Courses>
  </CurrentCourseActivity>
</StudentAcademicRecord>
 </SIF_ObjectData>
</SIF_Response>
</SIF_Message>

(* 8/24/11 8:57:24 PM EDT *) [A] <b>SIF_Response</b> acknowledged (not successful)
XML Validation Error. cvc-complex-type.2.4.a: Invalid content was found starting with element 'MarkingPeriods'. One of '{&amp;quot;http://www.sifinfo.org/infrastructure/2.x&amp;quot;:StartDate, &amp;quot;http://www.sifinfo.org/infrastructure/2.x&amp;quot;:EndDate, &amp;quot;http://www.sifinfo.org/infrastructure/2.x&amp;quot;:MarkingPeriod}' is expected.
(* 8/24/11 8:57:24 PM EDT *) [A] <b>SIF_Ack</b> message received from agent (812 bytes)

Revision history for this message
Jon Kelley (jonkelley79) said :
#8

Making this change throughout all the etranscripts.xml and rebuilding fixed the generation and validation issue I was having.

- <element name="MarkingPeriods" type="MarkingPeriods" flags="M" />
+ <element name="MarkingPeriod" type="MarkingPeriod" flags="M" />

Could this really have never been discovered?

Should I log a bug and check in this fix?

Revision history for this message
Jon Nicholson (jonicholson) said :
#9

I think your fix is right, I might also remove the MarkingPeriods object from the XML... if it doesn't appear anywhere else in the spec?

I agree, log this as a bug. I wonder how many versions this bug effects, just looking at the 2.4 spec, which requires MarkingPeriod, and the related bit in the appropriate XML file was also MarkingPeriods. So it may well affect the majority of the US versions the ADK supports.

Revision history for this message
david warner (juddtrump) said :
#14

yes that's right the way you are doing

Can you help with this problem?

Provide an answer of your own, or ask Jon Kelley for more information if necessary.

To post a message you must log in.