The Official Blog of Patcoola

Im just a dude watching over my parents,
and trying to make cartoons and video games from home.

XML API [JavaScript]

Important!

Dear visitors,

This blog and the Tigarus.com network will be changing our website software in May (2024). There will be some down time and there will be a change to the webpage addresses.

We will also be removing the Anime blogs. The Rocksmith Songs website will be unavailable of a few weeks or months while I move the database to the new software.

At the moment we are running on Wordpress, the new software is an in-house project which is 57 times faster. It will also provide more freedom for development.

Thank you for understanding.

, By Patcoola

Script Title: XML API
Programming Language: JavaScript
Date Created: 2020-03-31

Purpose: An easy to use interface to navigate XML documents.

Description: A XML application programming interface to load and navigate XML documents. Provides many useful functions.

Advertisement

Donate Now!

Hi there, I spend a lot of time making this blog.

It would be great if you would consider donating.


Methods

xml.loader ( {

url: String
method: String [GET | POST], default GET
async: Boolean, default true
exec: Function

} );

Functions

xml.node(element).hasAttribute(string);

// Checks if element has an attribute, returns a Boolean

xml.node(element).getAttribute(string);

// Returns the value of an attribute as a string

xml.node(element).hasByTagName(string);

// Checks if a parent node contents an element with a given tag name, returns a Boolean

xml.node(element).getByTagName(string);

// Returns a DOM of elements with a given tag name within an element

xml.doc(string).getID(string);

// Returns an element with a given ID from an XML document

xml.read(xml);

// Manually select and process an XML document into the API

xml.getList();

// Lists the XML documents in the API, returns a one dimensional array

xml.getRoots(string);

// Lists the parent elements in an XML document, returns a two dimensional array [ Element Name, node ]

xml.count();

// Returns the number of XML documents in the API

xml.remove(string);

// Removes an XML document from the API

xml.getValue(element);

// Returns the value of an element, value data type is set by the data-type attribute or by a definitions table

xml.scan(element);

// Scans an element and returns a two dimensional array [ Element Name, node ]

xml.keys(element);

// Scans an elements and returns the nodes as objects { name: node }

xml.stringToXML(string);

// Converts an XML string into an XML document, returns an XML document

Example Usage

xml.loader ( {

url: “cuesheet.xml”,

exec: helloworld

} );

function helloworld () {

alert ( “Hello world the document was loaded!” );

}

 

Advertisement

Donate Now!

Hi there, I spend a lot of time making this blog.

It would be great if you would consider donating.


 

Post Meta

Share Post

 

Comments: Write Comment

Be the first to write a comment.


Leave a Comment


All comments are reviewed before publishing. Comments must be related to the page topic, must not be spam, and must comply with the criminal code of Canada.