Class XMLToFlist

java.lang.Object
com.portal.pcm.XMLToFlist
All Implemented Interfaces:
XMLConstants

public class XMLToFlist extends Object implements XMLConstants
Processes XML of the form
<?xml version="1.0" encoding="UTF-8"?>
<flist>
  <POID xmlns="">0.0.0.1 /account 1234</POID>
  <AR_ACCOUNT_OBJ xmlns="">0.0.0.1 /account 9876</AR_ACCOUNT_OBJ>
  <INCLUDE_CHILDREN xmlns="">123</INCLUDE_CHILDREN>
  <NAMEINFO elem="1">
      <ADDRESS>10200 South De Anza Blvd</ADDRESS>
      <CITY>Cupertino</CITY>
      <CANON_COMPANY>Portal Software</CANON_COMPANY>
      <CANON_COUNTRY>USA</CANON_COUNTRY>
  </NAMEINFO>
  <WRITE_ACCESS xmlns="">some string</WRITE_ACCESS>
</flist>
 
To use, get an instance of converter and specify an input stream containing the xml data via convert. The generated flist is retrieved using getFList. Note: The XML formats this converter currently supports are PIN_XML_BY_SHORT_NAME and PIN_XML_BY_NAME. It is also possible to invoke this converter from the command line. See main method for usage.
  • Field Details

  • Constructor Details

    • XMLToFlist

      protected XMLToFlist(int xmlType)
      Instantiate XML to Flist converter. The constructor is protected, use getInstance factory method to get an appropriate instance.
      Parameters:
      xmlType - Known XML types are defined in XMLConstants. The XML formats this converter currently supports is XMLConstants.PIN_XML_BY_SHORT_NAME. XMLConstants.PIN_XML_BY_NAME.
      See Also:
  • Method Details

    • getInstance

      public static XMLToFlist getInstance()
      Factory method to get an instance of the converter for default, PIN_XML_BY_SHORT_NAME, XML format.
    • getInstance

      public static XMLToFlist getInstance(int xmlType)
      Factory method to get an instance of the converter for specified, XML format.
      Parameters:
      xmlType - Known XML types are defined in XMLConstants. The XML formats this converter currently supports is XMLConstants.PIN_XML_BY_SHORT_NAME. XMLConstants.PIN_XML_BY_NAME.
    • convert

      public void convert(InputSource xmlInputSource) throws IOException, SAXException, ParserConfigurationException
      Set the source of the XML document. This memeber function is used to support the old XML schema being supported.
      Parameters:
      xmlInputSource - Input source containing XML content to be parsed
      Throws:
      IOException - If any IO errors occur.
      SAXException - If any parse errors occur.
      IllegalArgumentException - If the InputStream is null
      ParserConfigurationException
      See Also:
    • getFList

      public FList getFList()
      Get the flist represented by the XML.
      Returns:
      FList form of the XML
    • changeDoc

      public void changeDoc(InputStream xmlInputStream) throws IOException, SAXException, ParserConfigurationException
      Sets the source of the XML document for the new schema support. This member function is being used to support the new standardized XML schema support.
      Parameters:
      xmlInputStream - Input stream containing XML content to be parsed
      Throws:
      IOException - If any IO errors occur.
      SAXException - If any parse errors occur.
      IllegalArgumentException - If the InputStream is null
      ParserConfigurationException
      See Also:
    • getTimeStampInUnixFormat

      public static String getTimeStampInUnixFormat(String srcFormat, String src)
      This method gets timestamp in unix format, taking the input in a format specified by the first argument.
      Parameters:
      srcFormat - Input date format
      src - Input date in srcFormat
      Returns:
      Converts String in the UNIX timestamp with the adjusted Timezone
    • maskTree

      public static Node maskTree(Node inNode)
      This method masks sensitive data in the xml
      Parameters:
      inNode - data requiring masking
      Returns:
      masked data
    • main

      public static void main(String[] args)
      Invokes the XML to flist converter from the command line. Outputs the created flist in testnap format on the console and writes it to file. The output filename is the input filename with ".flist.txt" appended to it.

      Usage: java com.portal.pcm.XMLToFlist -[n]ew filename