public class IfsSimpleXmlParser extends Object implements XmlParserInterface
The parser defines a simple mapping between XML tags and iFS objects.
The parser is the reverse of the SimpleXmlRenderer. Output from the SimpleXmlRenderer can be run through the IfsSimpleXmlParser to re-create the relevant objects.
Constructor and Description |
---|
IfsSimpleXmlParser(LibrarySession session)
Constructs a IfsSimpleXmlParser
|
Modifier and Type | Method and Description |
---|---|
protected SimpleXmlParserImpl |
getImplementation(ParserCallback callback,
Hashtable options)
Creates a SimpleXmlParserImpl to parse the document with.
|
protected LibraryObjectDefinition |
handleUnknownTag(Element unknownElement,
LibraryObjectDefinition lod)
Handles an unknown tag.
|
LibraryObject |
parse(IfsXmlParser ifsxmlparser,
InputStream stream,
ParserCallback callback,
Hashtable options)
Parses the specified InputStream representing an XML document.
|
LibraryObject |
parse(IfsXmlParser ifsxmlparser,
Reader reader,
ParserCallback callback,
Hashtable options)
Parses the specified Reader representing an XML document.
|
protected LibraryObject |
traverseTree(Document doc,
ParserCallback callback,
Hashtable options)
Traverses the DOM tree and creates the appropriate LibraryObjects.
|
public static final String IGNORE_UNSETTABLE_OPTION
public static final String SIMPLE_USER_TAG
public static final String OBJECT_LIST_TAG
public static final String ARRAY_ELEMENT_TAG
public static final String CATEGORIES_TAG
public static final String FOLDER_PATH_TAG
public static final String UPDATE_TAG
public static final String OPTIONS_TAG
public static final String POLICIES_TAG
public static final String POLICY_TAG
public static final String MEMBERS_TAG
public static final String PROPERTIES_TAG
public static final String DATATYPE_TAG
public static final String DOMAINTYPE_ATTRIBUTE
public static final String PROPERTY_VALUE_TAG
public static final String CONTENT_TAG
public static final String MEDIA_TAG
public static final String FORMAT_TAG
public static final String ATTRIBUTES_TAG
public static final String ACES_TAG
public static final String ACCESS_LEVEL_TAG
public static final String GRANTEE_TAG
public static final String PERMISSIONBUNDLES_TAG
public static final String PASSWORD_TAG
public static final String ACTION_ATTRIBUTE
public static final String FORMAT_ATTRIBUTE
public static final String DATATYPE_ATTRIBUTE
public static final String DEFINITION_ATTRIBUTE
public static final String CLASSNAME_ATTRIBUTE
public static final String REFERENCE_TYPE_ATTRIBUTE
public static final String REFERENCE_BY_PATH
public static final String REFERENCE_BY_ID
public static final String REFERENCE_BY_NAME
public static final String REFERENCE_BY_VALUEDEFAULT
public static final String VALUEDEFAULT_VALUE_TAG
public static final String VALUEDOMAIN_VALUE_TAG
public static final String REFERENCE_BY_EXISTING
public static final String REMOVE_ACTION
public static final String ADD_ACTION
protected LibrarySession m_Session
protected IfsXmlParser m_Parser
protected InputStream m_InputStream
protected Reader m_Reader
protected String m_CharacterEncoding
public IfsSimpleXmlParser(LibrarySession session)
session
- the LibrarySessionprotected LibraryObjectDefinition handleUnknownTag(Element unknownElement, LibraryObjectDefinition lod) throws IfsException
unknownElement
- the Element which could not be indentifiedlod
- the LibraryObjectDefinition being processedIfsException
- when operation failspublic LibraryObject parse(IfsXmlParser ifsxmlparser, InputStream stream, ParserCallback callback, Hashtable options) throws IfsException
XmlParserInterface
parse
in interface XmlParserInterface
ifsxmlparser
- this object is the entry point parser and can be
used by the content-specific parsers to construct
the DOM object, using the Oracle DOM parserstream
- the InputStreamcallback
- an application object that interacts with the
the parsing process; optional, can be nulloptions
- any parser-specific optionsIfsException
- (IFS-12601) if the operation failspublic LibraryObject parse(IfsXmlParser ifsxmlparser, Reader reader, ParserCallback callback, Hashtable options) throws IfsException
XmlParserInterface
parse
in interface XmlParserInterface
ifsxmlparser
- this object is the entry point parser and is used
by the content-specific parsers to construct the
DOM object, using the Oracle DOM parserreader
- the Readercallback
- an application object that interacts with the
the parsing process; optional, can be nulloptions
- any parser-specific optionsIfsException
- (IFS-12602) if the operation failsprotected LibraryObject traverseTree(Document doc, ParserCallback callback, Hashtable options) throws IfsException
For each LibraryObject created, the implementation must call the appropriate callback methods (if any).
The creation of LOs is transactional. That is either all LOs will be created or none will. There is an exception to this rule. Creating certain LOs casues a database commit. When this occurs a transaction can no longer be aborted. What this means for traverseTree is once one of these objects is created then all the objects created before that object in the transaction will also be committed. Now, if later in the transaction creating an object fails, the transaction can't be aborted. Forcing the transaction to be commited. Meaning all objects up to the failure will exist. The XML source may no longer be valid considering at least one object in the source already exists. LibraryObjects that cause commits currently are DirectoryUser and ClassObject. The javadoc should be consulted for up-to-date information about a particular LO.
doc
- the XMLDocument (DOM tree created from the Parser's
InputStream/Reader) to traversecallback
- an application object that interacts with the parsing
process; optional, can be nulloptions
- the Hashtable containing any Parser-specific options
for this parserIfsException
- if the operation failsprotected SimpleXmlParserImpl getImplementation(ParserCallback callback, Hashtable options) throws IfsException
IfsException
Copyright © 2023. All rights reserved.