include XMLPL package.
This commit is contained in:
131
packages/xml/xml_driver.pl
Normal file
131
packages/xml/xml_driver.pl
Normal file
@@ -0,0 +1,131 @@
|
||||
/* xml_driver.pl : Contains xml_parse/[2,3] a bi-directional XML parser written in
|
||||
|
||||
* Prolog.
|
||||
|
||||
*
|
||||
|
||||
* Copyright (C) 2001-2005 Binding Time Limited
|
||||
|
||||
* Copyright (C) 2005-2011 John Fletcher
|
||||
|
||||
*
|
||||
|
||||
* Current Release: $Revision: 3.3 $
|
||||
|
||||
*
|
||||
|
||||
* TERMS AND CONDITIONS:
|
||||
|
||||
*
|
||||
|
||||
* This program is offered free of charge, as unsupported source code. You may
|
||||
|
||||
* use it, copy it, distribute it, modify it or sell it without restriction,
|
||||
|
||||
* but entirely at your own risk.
|
||||
|
||||
*
|
||||
|
||||
* xml_parse( {+Controls}, +?Chars, ?+Document ) parses Chars to/from a data
|
||||
|
||||
* structure of the form xml(<atts>, <content>). <atts> is a list of
|
||||
|
||||
* <atom>=<string> attributes from the (possibly implicit) XML signature of the
|
||||
|
||||
* document. <content> is a (possibly empty) list comprising occurrences of :
|
||||
|
||||
*
|
||||
|
||||
* pcdata(<string>) : Text
|
||||
|
||||
* comment(<string>) : An xml comment;
|
||||
|
||||
* element(<tag>,<atts>,<content>) : <tag>..</tag> encloses <content>
|
||||
|
||||
* : <tag /> if empty
|
||||
|
||||
* instructions(<atom>, <string>) : Processing <? <atom> <params> ?>"
|
||||
|
||||
* cdata( <string> ) : <![CDATA[ <string> ]]>
|
||||
|
||||
* doctype(<atom>, <doctype id>) : DTD <!DOCTYPE .. >
|
||||
|
||||
*
|
||||
|
||||
* The conversions are not completely symmetrical, in that weaker XML is
|
||||
|
||||
* accepted than can be generated. Specifically, in-bound (Chars -> Document)
|
||||
|
||||
* does not require strictly well-formed XML. Document is instantiated to the
|
||||
|
||||
* term malformed(Attributes, Content) if Chars does not represent well-formed
|
||||
|
||||
* XML. The Content of a malformed/2 structure can contain:
|
||||
|
||||
*
|
||||
|
||||
* unparsed( <string> ) : Text which has not been parsed
|
||||
|
||||
* out_of_context( <tag> ) : <tag> is not closed
|
||||
|
||||
*
|
||||
|
||||
* in addition to the standard term types.
|
||||
|
||||
*
|
||||
|
||||
* Out-bound (Document -> Chars) parsing _does_ require that Document defines
|
||||
|
||||
* strictly well-formed XML. If an error is detected a 'domain' exception is
|
||||
|
||||
* raised.
|
||||
|
||||
*
|
||||
|
||||
* The domain exception will attempt to identify the particular sub-term in
|
||||
|
||||
* error and the message will show a list of its ancestor elements in the form
|
||||
|
||||
* <tag>{(id)}* where <id> is the value of any attribute _named_ id.
|
||||
|
||||
*
|
||||
|
||||
* At this release, the Controls applying to in-bound (Chars -> Document)
|
||||
|
||||
* parsing are:
|
||||
|
||||
*
|
||||
|
||||
* extended_characters(<bool>) : Use the extended character
|
||||
|
||||
* : entities for XHTML (default true)
|
||||
|
||||
*
|
||||
|
||||
* format(<bool>) : Strip layouts when no character data
|
||||
|
||||
* : appears between elements.
|
||||
|
||||
* : (default true)
|
||||
|
||||
*
|
||||
|
||||
* remove_attribute_prefixes(<bool>) : Remove namespace prefixes from
|
||||
|
||||
* : attributes when it's the same as the
|
||||
|
||||
* : prefix of the parent element
|
||||
|
||||
* : (default false).
|
||||
|
||||
*
|
||||
|
||||
* allow_ampersand(<bool>) : Allow unescaped ampersand
|
||||
|
||||
* : characters (&) to occur in PCDATA.
|
||||
|
||||
* : (default false).
|
||||
|
||||
*
|
||||
|
||||
* [<bool> is one of 'true' or 'false']
|
Reference in New Issue
Block a user