com.edustructures.sifworks
Class SIFParser

java.lang.Object
  extended by com.edustructures.sifworks.SIFParser

public abstract class SIFParser
extends java.lang.Object

Parses a SIF message or Data Object into a SIFElement object graph.

A single instance of SIFParser can be reused by a thread. However, the parse method is synchronized for serial access. If multiple threads wish to parse messages concurrently a unique SIFParser instance should be allocated to each.

Version:
1.0

Field Summary
static int FLG_EXPECT_INNER_ENVELOPE
          Flag that indicates that SIFParser should expect a nested SIF_Message
 
Constructor Summary
SIFParser()
           
 
Method Summary
abstract  SIFElement getParsed()
          Gets the last SIFElement parsed
static void main(java.lang.String[] args)
          Run SIFParser as a command-line program.
static SIFParser newInstance()
          Factory method for creatin a new instance of a SIFParser
abstract  SIFElement parse(java.io.Reader msg, Zone zone)
          Parses a SIF data element into a SIFElement.
abstract  SIFElement parse(java.io.Reader msg, Zone zone, int flags)
          Parses a SIF data element into a SIFElement.
abstract  SIFElement parse(java.io.Reader msg, Zone zone, int flags, SIFVersion version)
          Parses a SIF data element into a SIFElement.
abstract  SIFElement parse(java.lang.String msg, Zone zone)
          Parses a SIF data element into a SIFElement.
abstract  SIFElement parse(java.lang.String msg, Zone zone, int flags)
          Parses a SIF data element into a SIFElement.
abstract  SIFElement parse(java.lang.String msg, Zone zone, int flags, SIFVersion version)
          Parses a SIF data element into a SIFElement.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLG_EXPECT_INNER_ENVELOPE

public static final int FLG_EXPECT_INNER_ENVELOPE
Flag that indicates that SIFParser should expect a nested SIF_Message

See Also:
Constant Field Values
Constructor Detail

SIFParser

public SIFParser()
Method Detail

newInstance

public static SIFParser newInstance()
                             throws ADKException
Factory method for creatin a new instance of a SIFParser

Returns:
A SIFParser that can be used for parsing SIF XML
Throws:
ADKException - If a SIFParser class cannot be instantiated

parse

public abstract SIFElement parse(java.lang.String msg,
                                 Zone zone)
                          throws ADKParsingException,
                                 SIFException,
                                 java.io.IOException
Parses a SIF data element into a SIFElement.

Parameters:
msg - The content to parse
zone - The Zone from which the message was received, or null if not applicable or not known
Returns:
A SIFElement object encapsulating the message payload (e.g. a com.edustructures.sifworks.student.StudentPersonal object)
Throws:
ADKParsingException - is thrown if unable to parse the message
SIFException - is thrown if unable to parse the message
java.io.IOException - is thrown if an error is reported while reading the message content

parse

public abstract SIFElement parse(java.lang.String msg,
                                 Zone zone,
                                 int flags)
                          throws ADKParsingException,
                                 SIFException,
                                 java.io.IOException
Parses a SIF data element into a SIFElement.

Parameters:
msg - The content to parse
zone - The Zone from which the message was received, or null if not applicable or not known
flags - One or more FLG_ constants, or zero if no flags are applicable
Returns:
A SIFElement object encapsulating the message payload (e.g. a com.edustructures.sifworks.student.StudentPersonal object)
Throws:
ADKParsingException - is thrown if unable to parse the message
SIFException - is thrown if unable to parse the message
java.io.IOException - is thrown if an error is reported while reading the message content

parse

public abstract SIFElement parse(java.lang.String msg,
                                 Zone zone,
                                 int flags,
                                 SIFVersion version)
                          throws ADKParsingException,
                                 SIFException,
                                 java.io.IOException
Parses a SIF data element into a SIFElement.

Parameters:
msg - The content to parse
zone - The Zone from which the message was received, or null if not applicable or not known
flags - One or more FLG_ constants, or zero if no flags are applicable
version - The version of SIF that will be associated with the returned object. By default, SIFParser uses the default version of SIF in effect for the agent when parsing messages that do not have a SIF_Message envelope. By specifying a value to this parameter, you can change the version of SIF associated with the returned object in the event there is no SIF_Message envelope present in the XML content. Note that when parsing XML content with a SIF_Message envelope, SIFParser ignores this parameter and instead uses the version indicated by the Version and xmlns attributes
Returns:
A SIFElement object encapsulating the message payload (e.g. a com.edustructures.sifworks.student.StudentPersonal object)
Throws:
ADKParsingException - is thrown if unable to parse the message
SIFException - is thrown if unable to parse the message
java.io.IOException - is thrown if an error is reported while reading the message content

parse

public abstract SIFElement parse(java.io.Reader msg,
                                 Zone zone)
                          throws ADKParsingException,
                                 SIFException,
                                 java.io.IOException
Parses a SIF data element into a SIFElement.

Parameters:
msg - The content to parse
zone - The Zone from which the message was received, or null if not applicable or not known
Returns:
A SIFElement object encapsulating the message payload (e.g. a com.edustructures.sifworks.student.StudentPersonal object)
Throws:
ADKParsingException - is thrown if unable to parse the message
SIFException - is thrown if unable to parse the message
java.io.IOException - is thrown if an error is reported while reading the message content

parse

public abstract SIFElement parse(java.io.Reader msg,
                                 Zone zone,
                                 int flags)
                          throws ADKParsingException,
                                 SIFException,
                                 java.io.IOException
Parses a SIF data element into a SIFElement.

Parameters:
msg - The content to parse
zone - The Zone from which the message was received, or null if not applicable or not known
flags - One or more FLG_ constants, or zero if no flags are applicable
Returns:
A SIFElement object encapsulating the message payload (e.g. a com.edustructures.sifworks.student.StudentPersonal object)
Throws:
ADKParsingException - is thrown if unable to parse the message
SIFException - is thrown if unable to parse the message
java.io.IOException - is thrown if an error is reported while reading the message content

parse

public abstract SIFElement parse(java.io.Reader msg,
                                 Zone zone,
                                 int flags,
                                 SIFVersion version)
                          throws ADKParsingException,
                                 SIFException,
                                 java.io.IOException
Parses a SIF data element into a SIFElement.

Parameters:
msg - The content to parse
zone - The Zone from which the message was received, or null if not applicable or not known
flags - One or more FLG_ constants, or zero if no flags are applicable
version - The version of SIF that will be associated with the returned object. By default, SIFParser uses the default version of SIF in effect for the agent when parsing messages that do not have a SIF_Message envelope. By specifying a value to this parameter, you can change the version of SIF associated with the returned object in the event there is no SIF_Message envelope present in the XML content. Note that when parsing XML content with a SIF_Message envelope, SIFParser ignores this parameter and instead uses the version indicated by the Version and xmlns attributes
Returns:
A SIFElement object encapsulating the message payload (e.g. a com.edustructures.sifworks.student.StudentPersonal object)
Throws:
ADKParsingException - is thrown if unable to parse the message
SIFException - is thrown if unable to parse the message
java.io.IOException - is thrown if an error is reported while reading the message content

getParsed

public abstract SIFElement getParsed()
Gets the last SIFElement parsed

Returns:
A SIFElement object encapsulating the message payload (e.g. a com.edustructures.sifworks.student.StudentPersonal object). Note if the parse method was unsuccessful, the element may be incomplete.

main

public static void main(java.lang.String[] args)
Run SIFParser as a command-line program. This may be useful to Customer Support staff in determining if an arbitrary SIF XML document is invalid from the ADK's perspective.

Usage: SIFParser [/v n.n] file

Use the /v option to specify a version of SIF (e.g. "/v 1.5r1"). Defaults to the latest version of SIF supported by the ADK.

Parameters:
args - Command-Line arguments ([/v n.n] file)


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.