Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

%XML_OpenDocument function


Function
The function reads defined XML document from the disk.


Declaration


Blok kódu
languageesl
themeConfluence
INT %XML_OpenDocument(
    TEXT in fileName, 
    BOOL in validate
   TEXT in features := ""[,
   BOOL in preserveWhitespace := @TRUE]]
 )


Parameters


fileNameName of the XML file on the disk.
validate@TRUE - XML document validation (if the XML document contains DTD).
@FALSE - no XML document validation (if the XML document contains DTD).
featuresOptional parameter of the Text type which allows to change the default values of some SAX
Parser´s some
Parser's parameters and to influence its behaviour and also the content of loaded document in memory.
The parameters are recorded in pairs - name and numerical value. The parts are separated by blank space.
If the value is 0 (zero) the parameter is disabled.
If user write the invalid name of parameter it does not mean an error.
A complete list of parameters is mentioned here http://xerces.apache.org/xerces2-j/features.html.

The actual version supports following two parameters:


http://xml.org/sax/features/namespaces


TruePerform namespace processing: prefixes will be stripped off element and attribute names and replaced with the corresponding namespace URIs. By default, the two will simply be
concatenated
linked, but the namespace-sep core property allows the application to specify a delimiter string for separating the URI part and the local part.  
FalseDo not perform namespace processing.
Defaulttrue
NoteIf the validation feature is set to true, then the document must contain a grammar that supports the use of namespaces.


or

http://xml.org/sax/features/namespace-prefixes


TrueReport the original prefixed names and attributes used for namespace declarations.  
FalseDo not report attributes used for Namespace declarations, and optionally do not report original prefixed names.
Defaultfalse
preserveFeatures


preserveWhitespace@TRUE - text nods containing so-called white
signs
spaces (space, tab, ..) will remain as they were in XML document.
@FALSE - text nods containing so-called
whit signs
white spaces will be ignored when the document is parsed.


Return value
Handle to an opened XML document. If document is not opened, the return value will be invalid.


Description
The function reads the given XML document from the disk and  returns its handle.

The following character encodings of the XML document are supported:
  • UTF-8
  • UTF-16
  • US-ASCII
  • ISO-8859-1
  • Latin1
  • ISO-8859-2
  • Latin2
  • ISO-8859-3
  • ISO-8859-4
  • WINDOWS-1250
Example


Blok kódu
languageesl
themeRDark
 INT _doc
 _doc := %XML_OpenDocument("c:\data.xml", @TRUE)
 


Example 2
Opening of an XML document with parameter (http://xml.org/sax/features/namespace-prefixes) of SAX Parser:


 



Blok kódu
languageesl
themeRDark
 TEXT _features
 _features := "http://xml.org/sax/features/namespace-prefixes 1"
 _hXML := %XML_OpenDocument (_fileName, @FALSE, _features)


Note:
If the parameter namespace-prefixes is set, xmlns* attributes will not be ignored at XML document reading. This XML file was read with enabled parameter http://xml.org/sax/features/namespace-prefixes.

Demo of XML