Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.htmlparser.jericho
Class PHPTagTypes

    java.lang.Object
      PHPTagTypes

    public final class PHPTagTypes

extends java.lang.Object

Contains tag types related to the PHP server platform.

There is no specific tag type defined for the ASP-style PHP tag as it is recognised using the common server tag type.

The tag types defined in this class are not registered by default. The `register()` method is provided as a convenient way to register them all at once.

Field Summary
`static StartTagType` | `PHP_SCRIPT` The tag type given to a script-style PHP start tag (`<script language="php"> ... </script>`).
`static StartTagType` | `PHP_SHORT` The tag type given to a short-form PHP tag (`<? ... ?>`).
`static StartTagType` | `PHP_STANDARD` The tag type given to a standard PHP tag (`<?php ... ?>`).

Method Summary
`static boolean` | `defines(TagType tagType)` Indicates whether the specified tag type is defined in this class.
`static void` | `deregister()` Deregisters all of the tag types defined in this class at once.
`static boolean` | `isParsedByPHP(TagType tagType)` Indicates whether the specified tag type is recognised by a PHP parser.
`static void` | `register()` Registers all of the tag types defined in this class at once.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PHP_STANDARD

    public static final StartTagType PHP_STANDARD

  The tag type given to a standard PHP tag (`<?php ... ?>`).

  Note that the standard PHP processor includes as part of the tag any newline characters directly following the closing delimiter, but PHP tags recognised by this library do not include trailing newlines. They must be removed manually if required.

  This library only correctly recognises standard PHP tags that comply with the XML syntax for processing instructions. Specifically, the tag is terminated by the first occurrence of the closing delimiter "`?>`", even if it occurs within a PHP string expression. Unfortunately there is no reliable way to determine the end of a PHP tag without the use of a PHP parser. The following code is an example of a standard PHP tag that is not recognised correctly by this parser because of the presence of the closing delimiter within a string expression:

      <?php echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); ?>

  This is recognised as the PHP tag: `<?php echo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>`
  followed by the plain text: `\n"); ?>`

  Properties:

    Property | Value
    --- | ---
    `Description` | PHP standard tag
    `StartDelimiter` | `<?php`
    `ClosingDelimiter` | `?>`
    `IsServerTag` | `true`
    `NamePrefix` | `?php`
    `CorrespondingEndTagType` | `null`
    `HasAttributes` | `false`
    `IsNameAfterPrefixRequired` | `false`

  Example:
    `<?php echo '<p>Hello World</p>'; ?>`

### PHP_SHORT

    public static final StartTagType PHP_SHORT

  The tag type given to a short-form PHP tag (`<? ... ?>`).

  When this tag type is registered, all XML processing instructions are recognised as short-form PHP tags instead.

  The comments in the documentation of the `PHP_STANDARD` tag type regarding the termination of PHP tags and trailing newlines are also applicable to this tag type.

  Properties:

    Property | Value
    --- | ---
    `Description` | PHP short tag
    `StartDelimiter` | `<?`
    `ClosingDelimiter` | `?>`
    `IsServerTag` | `true`
    `NamePrefix` | `?`
    `CorrespondingEndTagType` | `null`
    `HasAttributes` | `false`
    `IsNameAfterPrefixRequired` | `false`

  Example:
    `<? echo '<p>Hello World</p>'; ?>`

### PHP_SCRIPT

    public static final StartTagType PHP_SCRIPT

  The tag type given to a script-style PHP start tag (`<script language="php"> ... </script>`).

  Properties:

    Property | Value
    --- | ---
    `Description` | PHP script
    `StartDelimiter` | `<script`
    `ClosingDelimiter` | `>`
    `IsServerTag` | `true`
    `NamePrefix` | `script`
    `CorrespondingEndTagType` | `EndTagType.NORMAL`
    `HasAttributes` | `true`
    `IsNameAfterPrefixRequired` | `false`

  Example:
    `<script language="php"> echo '<p>Hello World</p>'; </script>`

Method Detail

### register

    public static void register()

  Registers all of the tag types defined in this class at once.

  The tag types must be registered before the parser will recognise them.

### deregister

    public static void deregister()

  Deregisters all of the tag types defined in this class at once.

### defines

    public static boolean defines(TagType tagType)

  Indicates whether the specified tag type is defined in this class.

  Parameters:
    `tagType` - the `TagType` to test.
  Returns:
    `true` if the specified tag type is defined in this class, otherwise `false`.

### isParsedByPHP

    public static boolean isParsedByPHP(TagType tagType)

  Indicates whether the specified tag type is recognised by a PHP parser.

  This is true if the specified tag type is defined in this class or if it is the common server tag type.

  Parameters:
    `tagType` - the `TagType` to test.
  Returns:
    `true` if the specified tag type is recognised by a PHP parser, otherwise `false`.

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD