JDOM_Parser methods
JDOM_Parser methods

Figure 23. The JDOM_Parser metaclass
The following methods are provided by the JDOM_Parser metaclass:
parse (pXMLFilePath : in String);
This method is used to run the parsing of an XML file whose complete path is provided as an incoming parameter. Parser options must be set before running this operation.
sawErrors():
boolean;
This method is used to check if the parser is in an incorrect state or not.
getErrors() :
String;
This method retrieves the complete string of errors encountered by the parser.
getDocument():
JDOM_Document;
This method returns the JDOM_Document object representing the root of the document tree. This object provides primary access to the document's data.
setReuseGrammar(pReuseGrammar
: in boolean);
This method does not exist on the DOM API. It indicates whether or not the existing grammar should be reused for the next parsing run. If true, there can be no internal subsets.
setDoNamespaces
(pDoNameSpace : in boolean);
This method enables or disables the parser's namespace processing. If set to true, the parser starts enforcing all the constraints and rules specified by the NameSpace specification. By default, this is set to false.
setExitOnFirstFatalError
(pExitOnFirstFatalError :
in boolean);
This method changes the behavior of the parser with regard to the first fatal error. If set to true, the parser will exit at the first fatal error. If set to false, then it will report the error and continue processing. By default, this is set to true.
setValidationConstraintFatal
(pValidationConstraintFatal
: in boolean);
This changes the processing mode of a validation constraint. If set to true, validation constraints which are not respected are considered as being fatal errors. If set to true, the error is reported in the normal way. By default, this is set to false.
setCreateEntityReferenceNodes
(pCreateEntityReferenceNodes
: in boolean);
This method allows the user to specify whether the parser should create entity reference nodes in the JDOM tree being produced. When the "create'" flag is true, the JDOM tree contains entity reference nodes. When the "create" flag is false, no entity reference nodes are included in the JDOM tree.
The replacement text of the entity is included in either case, either as a child of the Entity Reference node or in place at the location of the reference.
setIncludeIgnorableWhitespace
(pIncludeIgnorableWhitespace
: in boolean);
This method allows the user to specify whether a "validating" parser should include ignorable whitespaces as text nodes. It has no effect on non-validating parsers, which always include non-markup text.
If set to true, ignorable whitespaces will be added to the JDOM tree as text nodes. The isIgnorableWhitespace method available on a JDOM_Node representing a text node will return true for those text nodes only.
If set to false, all ignorable whitespaces will be discarded and no text node added to the JDOM tree.
The use of this flag can clash with the use of the "xml:space" attribute. Similarly, this flag can clash with the use of the "preserve" keyword in diagrams.
By default, this is set to true.
setValidationScheme(pValidation
: in boolean);
This sets the validation mode of the parser. When set to false, validation is de-activated, whereas when set to true, validation is activated. By default, this is set to true.
If the validation scheme is set to false, external entities (such as DOCTYPE files) are not loaded. This parameter should be used if your XML files use an external DTD located on the web and if your client cannot download it.
setDoSchema
(pDoSchema : in boolean);
This method enables or disables the parser's schema processing. By default, this is set to false.
setValidationSchemaFullChecking
(pValidationSchemaFullChecking
: in boolean);
This method activates or deactivates the exhaustive validation of constraints which can be applied to schemas. Exhaustive schema validation can be greedy in terms of memory or runtime.
If this option is set to false, only basic rules are checked. Currently, particle unique attribution constraint checking and derivation restriction checking are managed by this option.
This option is ignored if the parser does not validate schemas.
By default, this is set to false.
setToCreateXMLDeclTypeNode
(pToCreateXMLDeclTypeNode
: in boolean);
XMLDecl-type nodes can be attached to the JDOM tree if this option has been activated. By default, this is set to false.
setExternalSchemaLocation
(pExternalSchemaLocation
: in string);
This method redefines the values of schemaLocation attributes belonging to the document or the "import" element. The new location is given by this method.
Only the last call is recorded.
The syntax to be used to the same as for the document's schemaLocation attribute.
The user can specify more than one XML Schema in the list.
setExternalNoNamespaceSchemaLocation
(pExternalNoNamespaceSchemaLocation : in string);
This redefines the document's noNamespaceSchemaLocation attribute externally.
Only the last call is recorded.
The syntax to be used is the same as for the document's noNamespaceSchemaLocation attribute.