public abstract class FlistToXML extends Object implements XMLConstants
To use, get an instance of converter and specify the flist to convert
to xml via convert
. The XML document can be retrieved as
a org.w3c.dom.Document
object using getXMLDoc
,
as a string using getXMLDocAsString
or written to a file
using serializeToFile
.
Note: This converter currently supports two formats: PIN_XML_BY_SHORT_NAME and PIN_XML_TYPE.
It is also possible to invoke this converter from the command line. See
main
method for usage.
Modifier and Type | Field and Description |
---|---|
static int |
INPUT_FLIST
Used in the convert() method - indicates that the given FList is
the input FList for the given opcode.
|
protected Document |
mDoc |
protected static String |
NEWLINE |
static int |
OUTPUT_FLIST
Used in the convert() method - indicates that the given FList is
the output FList for the given opcode.
|
PIN_XML_BY_NAME, PIN_XML_BY_SHORT_NAME, PIN_XML_TYPE
Modifier | Constructor and Description |
---|---|
protected |
FlistToXML()
Instantiate Flist to XML converter.
|
Modifier and Type | Method and Description |
---|---|
void |
convert(FList f)
Convert the specified flist to XML.
|
void |
convert(FList f,
String opcode,
int type)
Convert the specified flist to XML.
|
void |
convertNew(FList f)
Convert the specified flist to XML, with New schema
|
void |
convertNew(FList f,
String opcode,
int type)
Convert the specified flist to XML with New Schema.
|
protected abstract Element |
createElement(Field field,
int is_new)
This method should create an element for a flist field.
|
static FlistToXML |
getInstance()
Factory method to get an instance of the converter to default,
PIN_XML_BY_SHORT_NAME, XML format.
|
static FlistToXML |
getInstance(int xmlType)
Factory method to get an instance of the converter for specified,
XML format.
|
protected String |
getNameXMLForm(String source)
This method converts the input name to Hungarian notation and
also removes the prefix 'PIN_', like
PCM_ABC_XYZ to AbcXyz
|
Document |
getXMLDoc()
Returns the created XML document as org.w3c.dom.Document object.
|
String |
getXMLDocAsString()
Returns the created XML document as a string.
|
static void |
main(String[] args)
Invokes the flist to XML converter from the command line.
|
void |
serializeToFile(File file)
Serialize XML document to a file.
|
protected Document mDoc
public static final int INPUT_FLIST
public static final int OUTPUT_FLIST
protected static final String NEWLINE
protected FlistToXML()
getInstance
factory method to get an appropriate
instance.
Flists can be converted to two XML formats:
XMLConstants.PIN_XML_BY_SHORT_NAME
and
XMLConstants.PIN_XML_TYPE
.
XML types are defined in XMLConstants. *
XMLConstants
public static FlistToXML getInstance()
public static FlistToXML getInstance(int xmlType)
xmlType
- Known XML types are defined in XMLConstants. Two
XML formats are currently supports:
XMLConstants.PIN_XML_BY_SHORT_NAME
and
XMLConstants.PIN_XML_TYPE
public void convert(FList f) throws ParserConfigurationException, EBufException
f
- The FList to convert to XMLParserConfigurationException
EBufException
public void convertNew(FList f) throws ParserConfigurationException, EBufException
f
- The FList to convert to XMLParserConfigurationException
EBufException
public void convert(FList f, String opcode, int type) throws ParserConfigurationException, EBufException
f
- The FList to convert to XMLopcode
- The opcode this FList is for - may be null. If null then
a schema reference is not generatedtype
- Either FlistToXML.INPUT_FLIST or FlistToXML.OUTPUT_FLIST to
indicate if the FList is the input or output FList for the opcode.ParserConfigurationException
EBufException
public void convertNew(FList f, String opcode, int type) throws ParserConfigurationException, EBufException
f
- The FList to convert to XMLopcode
- The opcode this FList is for - may be null. If null then
a schema reference is not generatedtype
- Either FlistToXML.INPUT_FLIST or FlistToXML.OUTPUT_FLIST to
indicate if the FList is the input or output FList for the opcode.ParserConfigurationException
EBufException
public Document getXMLDoc()
public String getXMLDocAsString()
public void serializeToFile(File file) throws TransformerException
file
- Where to serializeTransformerException
protected abstract Element createElement(Field field, int is_new)
field
- Flist field for which an element node is being createdis_new
- int to specify which schema to use, (=1 for new schema).FlistToXMLByType
,
FlistToXMLShortName
public static void main(String[] args)
Usage: java com.portal.pcm.FlistToXML [-n]ew [-type|-shortname] flistfilename
Copyright © 2003, 2023, Oracle and/or its affiliates.