VFXP - Very Fast XML Parser

API Reference

// The Document Class
//
class VFXP_Document {
	
	// Parses XML from a file
	//
	void parseFromFile(string $filename);
	
	// Parses XML from a string
	//
	void parseFromString(string $content);
	
	// Returns a reference to the root Element
	//
	VFXP_Element & rootElement();
	
}

// The Document Element
//
class VFXP_Element {
	
	// Returns the name of the element
	//
	string name();
	
	// Returns the value of the element
	//
	string value();
	
	// Returns true if there is at least one child with the given name
	//
	bool hasChildren(string $elementname = NULL);
	
	// Returns a reference to the first element with the given name, or NULL if not found.
	//
	VFXP_Element & firstChild(string $elementname = NULL);
	
	// Returns the value of the first child with the given name, or NULL if not found.
	//
	string childValue(string $elementname = NULL);
	
	// Returns an array of references to the subelements having a given name.
	//
	array children(string $elementname = NULL);

	// Returns an associative array of couples (child-name => child-value)
	//
	array childrenAssociative();
	
	// Returns a reference to the array-map of the attribute-name=>attribute-value pairs
	//
	array & attributes();
	
	// Returns the value of the given attribute, or NULL if not found
	//
	string attributeValue(string $attributename);

	/**
	 * Sets the value of a child node, creating it if it's missing,
	 * using a simil-xpath syntax
	 * Supported xpath syntax:
	 *   subelementname[/subsubelementname]*
	 */
	setValueXP(string $path, string $value);

	/**
	 * Searches for a single node, using a simil xpath syntax:
	 * Supported xpath syntax examples:
	 *   element[2]/subelement[subsubelement=value]
	 */
	EpstXpElement getNodeXP(string $path);

}