parse_file_from_path


Description:

public bool parse_file_from_path (string xmlfile) throws Error

This method reads information from xmlfile and populate this object.

The xmlfile should correspond to the following DTD format:

<!ELEMENT schema (table+, view*)>
<!ATTLIST schema name CDATA #IMPLIED>

<!ELEMENT table (comment?,column+, fkey*, constraint*)>
<!ATTLIST table temptable (TRUE|FALSE) "FALSE">
<!ATTLIST table name CDATA #REQUIRED>
<!ATTLIST table space CDATA #IMPLIED>

<!ELEMENT column (comment?, value?, check?)>
<!ATTLIST column name CDATA #REQUIRED>
<!ATTLIST column type CDATA #REQUIRED>
<!ATTLIST column pkey (TRUE|FALSE) "FALSE">
<!ATTLIST column unique (TRUE|FALSE) "FALSE">
<!ATTLIST column autoinc (TRUE|FALSE) "FALSE">
<!ATTLIST column nnul (TRUE|FALSE) "FALSE">

<!ELEMENT comment (#PCDATA)>
<!ELEMENT value (#PCDATA)>
<!ATTLIST value size CDATA #IMPLIED>
<!ATTLIST value scale CDATA #IMPLIED>

<!ELEMENT check (#PCDATA)>

<!ELEMENT constraint (#PCDATA)>

<!ELEMENT fkey (fk_field?)>
<!ATTLIST fkey reftable CDATA #IMPLIED>
<!ATTLIST fkey onupdate (RESTRICT|CASCADE|SET_NULL|NO_ACTION|SET_DEFAULT) #IMPLIED>
<!ATTLIST fkey ondelete (RESTRICT|CASCADE|SET_NULL|NO_ACTION|SET_DEFAULT) #IMPLIED>

<!ELEMENT fk_field (#PCDATA)>
<!ATTLIST fk_field name CDATA #REQUIRED>
<!ATTLIST fk_field reffield CDATA #REQUIRED>

<!ELEMENT view (definition)>
<!ATTLIST view name CDATA #REQUIRED>
<!ATTLIST view replace (TRUE|FALSE) "FALSE">
<!ATTLIST view temp (TRUE|FALSE) "FALSE">
<!ATTLIST view ifnotexists (TRUE|FALSE) "TRUE">

<!ELEMENT definition (#PCDATA)>

Up to day description of the xml file schema can be found in DTD file libgda-db-catalog.dtd

The given xmlfile will be checked before parsing and false will be returned if fails. The xmlfile will be validated internally using validate_file_from_path. he same method can be used to validate xmlfile before parsing it.

Parameters:

this

an instance of DbCatalog

xmlfile

xml file to parse