IPro Online Your Text Processing PHP Libraries 


   


 IPro Libraries > IPro Tag > get_tag_data


add_tag_attribute
explode_tag
get_tag
get_tags
get_tag_attr_names
get_tag_attr_values
get_tag_attributes
get_tag_data
get_tag_datum
get_tag_element
get_tag_elements
get_tag_name
get_tag_names
get_tag_poss
repl_tag_attribute
repl_tag_name
rmv_comment_tag
rmv_empty_tag
rmv_tag
rmv_tag_attribute
rmv_tag_element
tok_by_tag
tok_by_deftag


array get_tag_data (string text, string tag [, string mode ])
Extract all tag data of a tag from text.

 

 Description  Demo  Example      
 

Description

array get_tag_data (string text, string tag [, string mode ])

get_tag_data () extracts all tag data of a tag from text. Tag data is the content in between a start tag and its corresponding end tag.

If tag consists only tag name, all data of the given tag name will be extracted from the input text. If tag consists of tag name and attributes, only data of those tag that match the given tag name and attributes will be extracted from the input text.

If matching mode is AND, tag data will be extracted if all attributes of the tag match with tag. If matching mode is OR, tag data will be extracted if any attribute of the tag match with tag.

Mode:

  • MATCH_OR - Matching mode is OR.
  • MATCH_AND - Matching mode is AND.
  • Note: This function may return Boolean FALSE. Use the === operator to test the return value.

    Parameters

    text
    The input text.
    tag
    The tag to extract tag data.
    mode
    Optional. The default mode is MATCH_AND.

    Return Values

    get_tag_data () returns an array of extracted tag data if successful, otherwise it returns FALSE if no tag data was extracted.

    Errors/Exceptions

    get_tag_data () prints an error message if error occurs.

    i. Incorrect number of input arguments.
    ERROR! Wrong argument count for get_tag_data.

    ii. Incorrect input type for text.
    ERROR! Wrong datatype for first argument in get_tag_data, a string is expected.

    iii. Incorrect input type for tag.
    ERROR! Wrong datatype for second argument in get_tag_data, a string is expected.

    iv. Incorrect input type for mode.
    ERROR! Invalid third argument for get_tag_data, a matching mode (MATCH_AND or MATCH_OR) is expected.


    Copyright 2012 by Mice3 Software. All Rights Reserved.Site Map  |  Terms of Service | About Mice3