Welcome
DXML
1.2.2.1
Dynamic XML is an extension of the XML functions for AMS. It allows the programmer to load and work with multiple XML files at the same time.
Notes on Compatibility:
DXML was designed to be compatible with the original XML functions, it can used with the other XML functions as long as you use the extra compatibility functions provided, although there is really no need to use the normal XML functions as all of them are included in DXML.
Free to use and distribute.
Centauri Soldier
www.AMSPublic.com
centaurisoldier@AMSPublic.com
Copyright © 2010 AMSPublic.com
Place the "DXML" Folder in your "AutoPlay Media Studio/Plugins/Actions" folder.
DXML.Count
DXML.GetActive
DXML.GetAttribute
DXML.GetAttributeNames
DXML.GetElementNames
DXML.GetElementXML
DXML.GetLoaded
DXML.GetValue
DXML.GetXML
DXML.InsertXML
DXML.IsSaved
DXML.ReadFromFile
DXML.ReadFromString
DXML.RemoveAttribute
DXML.RemoveElement
DXML.Save
DXML.SaveAll
DXML.SetActive
DXML.SetAttribute
DXML.SetFilePath
DXML.SetValue
DXML.SortByElement
DXML.StringToXMLAtt
DXML.UnloadTable
DXML.XMLAttToString
(number) DXML.Count ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element", (string) ElementName = "*" ) |
Counts the number of elements below a given XML path that match a given element name.
(string) The name of the XML table
(string) The full path to the element whose children you want to count.
(string) The element name (tag name) that you want to search for. Only elements that match will be counted. Use * to match any name.
(number) The number of matching child elements found. If an error occurs, -1 is returned. You can use Application.GetLastError to determine whether this action failed, and why
(string) DXML.GetActive () |
Returns the active XML table.
(string) Returns a string.
If an error occurs or there is no active table then a blank string is returned.
(string) DXML.GetAttribute ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element", (string) AttributeName = "MyAttribute" ) |
Returns the value of an element's attribute.
(string) The name of the XML table.
(string) The full path to the element whose attribute names you want to retrieve.
(string) The full path to the element whose attribute you want to retrieve.
(string) The value of the specified element's attribute. If an element has no attribute or an error occurs, an empty string ("") is returned. You can use Application.GetLastError to determine whether this action failed, and why.
(table) DXML.GetAttributeNames ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element" ) |
Returns the names of an element's attributes in a numerically indexed table.
(string) The name of the XML table.
(string) The full path to the element whose attribute names you want to retrieve.
(table) A numerically indexed table containing the names of the specified element's attributes. If the element doesn't contain any attributes or an error occurs, nil is returned. You can use Application.GetLastError to determine whether this action failed, and why.
(table) DXML.GetElementNames ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element", (boolean) FullPaths = false, (boolean) IncludeIndices = false ) |
Returns a numerically indexed table containing the names of all child elements contained within a specific element.
(string) The name of the XML table.
(string) The full path to the element whose child elements you want to find.
(boolean) Whether to return the full paths of the child elements, or just the element names:
Value | Description |
true | Return the full paths of the child elements. |
false | (Default) Return just the element names. (Default) |
(boolean) Whether to append the delimiter and index (e.g. ":3") to each element name:
Value | Description |
true | Append the delimiter and index to each element name. |
false | (Default) Return just the element names. (Default) |
(table) A numerically indexed table containing the names of all child elements contained within the specified element. If there are no child elements or an error occurs, nil is returned. You can use Application.GetLastError to determine whether this action failed, and why.
(string) DXML.GetElementXML ( | (string) XMLTables = "Test", (string) XMLPath = "root/element/element" ) |
Returns the raw XML of an element, i.e. the plain-text XML code for the element and all of its children.
(string) The name of the XML table.
(string) The full path to the element whose XML you want to retrieve.
(string) The XML code for the entire element and all of its children. If the element doesn't exist, or an error occurs, an empty string ("") is returned. You can use Application.GetLastError to determine whether this action failed, and why.
(table) DXML.GetLoaded () |
Returns all the loaded XML files.
(table) Returns a numerically indexed table containing the names of all the loaded XML files.
If an error occurs or there are no loaded files then nil is returned.
(string) DXML.GetValue ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element" ) |
Returns the value of an element.
(string) The name of the XML table.
(string) The full path to the element whose value you want to retrieve.
(string) The value of the specified element. If the element contains no value, or an error occurs, an empty string ("") is returned. You can use Application.GetLastError to determine whether this action failed, and why.
(string) DXML.GetXML ( | (string) XMLTable = "Test" ) |
Returns the specified XML document as a string.
(string) The name fo the XML table.
(string) A string containing the specified XML table. If the table does not exist or an error occurs, an empty string ("") is returned. You can use Application.GetLastError to determine whether this action failed, and why.
DXML.InsertXML ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element", (string) Text = " (variant) InsertionMode = XML.INSERT_AFTER ) |
Inserts raw XML code into a specific location in the specified XML table.
(string) The name of the XML table.
(string) The path to the element where you want to insert the XML text. You can insert the XML before this element, insert it after this element, or replace the element (and all its children) with the new XML text.
(string) The XML text that you want to insert.
(variant) The insertion mode to use:
CONSTANT | VALUE | DESCRIPTION |
XML.INSERT_BEFORE | 0 | Insert the new XML text before the specified element. |
XML.INSERT_AFTER | 1 | Insert the new XML text after the specified element. |
XML.REPLACE | 2 | Replace the specified element's XML text with the new XML text. |
This action dose not return any value.
(boolean) DXML.IsSaved ( | (string) XMLTable = "Test" ) |
Determines whether or not an XML table has been saved since it was last changed.
(string) The name of the XML table.
(boolean) retuns true it the specified table has been saved since its last change and false if it has not.
If an error occurs or the table does not exist then false is returned.
DXML.ReadFromFile ( | (string) File = "C:\\MyFile.XML", (string) XMLTable = "Test" ) |
Loads an XML file into memory.
(string) The full path to the XML file.
(string) The name of the XML table in which to load the XML file contents.
This action dose not return any value.
DXML.ReadFromString ( | (string) File = "C:\\MyFile.xml", (string) XMLTable = "Test", (string) String = " |
Loads an XML string into memory.
(string) The full path to the file where the XML string will be saved.
Note: This argument is not required but if it is not set then the XML data cannot be saved to file without first calling DXML.SetFilePath().
(string) The name of the XML table in which to load the XML string.
(string) The String which will be loaded.
This action dose not return any value.
DXML.RemoveAttribute ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element", (string) AttributeName = "MyAttribute" ) |
Removes a specific attribute from an element.
(string) The name of the XML table.
(string) The path to the element whose attribute you want to remove.
(string) The name of the attribute you want to remove.
This action dose not return any value.
DXML.RemoveElement ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element" ) |
Removes a specific element (and its children) from the specified XML table.
(string) The name of the XML table.
(string) The path to the element you want to remove.
This action dose not return any value.
(boolean) DXML.Save ( | (string) XMLTable = "Test" ) |
Saves the specified XML table to it's relevant file.
Note: File paths are stored when XML documents are loaded. If XML is created without loading a file then a file path must be specified using the DXML.SetFilePath() function.
(string) The name of the XML table.
(boolean) Returns true if the file was saved and false if it was not.
(table) DXML.SaveAll () |
Saves all XML tables to their appropriate files.
(table) Returns a numerically indexed table containing all of the XML table names that were not saved to file (most likely because no file path was specified).
If all tables were saved to file or no tables exist then nil is returned.
DXML.SetActive ( | (string) XMLTable = "Test" ) |
Manually sets the active XML table.
Note: This action is automatically called by all DXML functions which need it and is not required (to be called manually) for DXML functions to operate properly. This function is here for the sake of versatility.
(string) The name of the XML table to make the active table.
This action dose not return any value.
DXML.SetAttribute ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element", (string) AttributeName = "MyAttribute", (string) AttributeValue = "MyValue" ) |
Sets the value of an element's attribute.
(string) The name of the XML table.
(string) The path to the element whose attribute you want to set.
(string) The name of the attribute you want to set.
(string) The value you want the attribute to have.
This action dose not return any value.
DXML.SetFilePath ( | (string) XMLTable = "Test", (string) File = "C:\\NewFile.xml" ) |
Sets or changes the file save path for a specified XML table.
Note: File paths are nomally set during XML string or file loading. This action is used if the file path was not set during the loading process or to simply change where a file will be saved.
(string) The name of the XML table.
(string) The full file path to which the specified table's file path will be changed.
This action dose not return any value.
DXML.SetValue ( | (string) XMLTable = "Test", (string) XMLPath = "root/element/element", (string) Value = "MyValue", (boolean) WriteCDATA = false ) |
Sets the value of an element.
(string) The name of the XML table.
(string) The full path to the element whose value you want to set.
(string) The value you want the element to have.
(boolean) Whether to write the data as a CDATA section:
Value | Description |
true | Write the data as a CDATA section. |
false | (Default) Don't write the data as CDATA. (Default) |
This action dose not return any value.
DXML.SortByElement ( | (string) XMLTable = "Test", (string) Path = "root/element/element" ) |
Alphabetically sorts an XML table according to the values of the specified element.
(string) The name of the XML table to sort.
(string) The path to the element that will be the sorting target.
This action dose not return any value.
(string) DXML.StringToXMLAtt ( | (string) Input = " (string) Control Character = "¬" ) |
Converts a string into another string that will be able to be stored as an xml string, replacing xml control characters(line breaks, ", ', \, <, >, =) with a different and specific control character which is numerically indexed automatically to identify each character type.
(string) The string to convert.
(string) The character which will replace all of the xml control characters in the string.
CONSTANT | VALUE | DESCRIPTION |
"•" | "•" | NA |
"¤" | "¤" | NA |
"¥" | "¥" | NA |
"¬" | "¬" | NA |
(string) Returns the converted string.
DXML.UnloadTable ( | (string) XMLTable = "Test" ) |
Removes a specified XML table from memory.
(string) The name of the XML table to remove from memory.
This action dose not return any value.
(string) DXML.XMLAttToString ( | (string) Input = "Here¬3s some text.", (string) Control Character = "¬" ) |
Converts a string, previously converted by the DXML.StringToXMLAtt() function, back to a normal string using the specified control character.
(string) The previously-converted xml string to convert back to a normal string.
(string) The control character used during the initial encoding process.
CONSTANT | VALUE | DESCRIPTION |
"•" | "•" | NA |
"¤" | "¤" | NA |
"¥" | "¥" | NA |
"¬" | "¬" | NA |
(string) Returns the converted string.
Copyright © 2010 AMSPublic.com
This File Was Generated With AMS ActionFile Editor