-------------------------------------------------------- ------------------------ -- XML/Ada - An XML suite for Ada95 -- -- -- -- Copyright (C) 2001-2012, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 3, or (at your option) any later -- -- version. This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- ------------------------------------------------------------------------------ package DOM.Core.Documents is function Doc_Type (Doc : document) return document_type; -- Return the DTD associated with Doc. -- This might return null if there is no such DTD. function Implementation (Doc : document) return dom_implementation; -- Return the DOM_Implementation to which Doc belongs. function Get_Element (Doc : document) return element; -- Return the top-element of DOC function Create_Element (Doc : document; Tag_Name : dom_string) return element; -- Create a new element, and its default attributes. -- See also Create_Element_NS -- Invalid_Character_Err is raised if Tag_Name contains invalid -- characters. function Create_Element_NS (Doc : document; Namespace_URI : dom_string; Qualified_Name : dom_string) return element; function Create_Element_NS (Doc : document; Symbols : Sax.Utils.symbol_table; Namespace_URI : Sax.Symbols.symbol; Prefix : Sax.Symbols.symbol; Local_Name : Sax.Symbols.symbol) return element; -- Create a new element, and its default attributes. -- Invalid_Character_Err is raised if Tag_Name contains invalid -- characters. -- Namespace_Err raised if Qualified_Name is incorrect. -- The version with Symbols is more efficient. -- Symbol_Table is the table in which the symbols were allocated, to ensure -- they are valid while the document is in use. function Create_Document_Fragment (Doc : document) return document_fragment; -- Create an empty document fragment; function Create_Text_Node (Doc : document; Data : dom_string) return text; -- Create a text node given a specific string function Create_Text_Node (Doc : document; Data : dom_string_access) return text; -- As above but with a pre-allocated Data which must not be freed function Create_Comment (Doc : document; Data : dom_string) return comment; -- Create a comment node given a specific string function Create_Cdata_Section (Doc : document; Data : dom_string) return cdata_section; -- Create a Cdata section for a specific string -- Not_Supported_Err is raised for HTML documents function Create_Processing_Instruction (Doc : document; Target : dom_string; Data : dom_string) return processing_instruction; -- Create a processing instruction. -- Invalid_Character_Err raised if Target is invalid. -- Not_Supported_Err raised for HTML documents function Create_Attribute (Doc : document; Name : dom_string) return attr; -- Create a new attribute. -- Use Set_Attribute to associate it with an element. -- See Create_Attribute_NS to create an attribute with a namespace. -- Invalid_Character_Err raised if Name is invalid function Create_Attribute_NS (Doc : document; Namespace_URI : dom_string; Qualified_Name : dom_string) return attr; function Create_Attribute_NS (Doc : document; Symbols : Sax.Utils.symbol_table; Namespace_URI : Sax.Symbols.symbol; Prefix : Sax.Symbols.symbol; Local_Name : Sax.Symbols.symbol) return attr; -- Create a new attribute. -- Use Set_Attribute to associate it with an element. -- Invalid_Character_Err raised if Name is invalid -- Namespace_Err raised if Qualified_Name is incorrect. function Create_Entity_Reference (Doc : document; Name : dom_string) return entity_reference; -- Create a new entity reference. -- If the referenced entity is known, the child list of the entity -- reference is made the same as that of the Entity. -- Invalid_Character_Err raised if Target is invalid. -- Not_Supported_Err raised for HTML documents function Get_Elements_By_Tag_Name (Doc : document; Tag_Name : dom_string := "*") return node_list; -- Returns a NodeList of all the Elements with a given tag name in the -- order in which they would be encountered in a preorder traversal -- of the Document tree. -- The special case "*" matches all tags function Get_Elements_By_Tag_Name_NS (Doc : document; Namespace_URI : dom_string := "*"; Local_Name : dom_string := "*") return node_list; -- Returns a NodeList of all the matching Elements. -- "*" matches all namespaces or all local names function Get_Element_By_Id (Doc : document; Element_Id : dom_string) return node; -- Return the element whose id is Element_Id. The first matching element -- is returned. -- The DOM implementation must know which attributes are of type Id, or -- null is returned. -- For documents resulting from parsing an XML input source, this will only -- work if the parser was configured with validation features on. -- Otherwise, it will not know what attributes should be considered as ID, -- and thus will not be able to retrieve them. function Import_Node (Doc : document; Import_Node : node; Deep : Boolean) return node; -- Imports a copy of Import_Node into Doc. -- It returns the imported node. -- This behaves mostly as if there had been a merge of the two XML -- files that contained the document and the imported node, but also takes -- into account the possibly different DTDs. end DOM.Core.Documents;