Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | List of all members
eZXMLInputParser Class Reference
Inheritance diagram for eZXMLInputParser:

## Public Member Functions
| __construct ( $validateErrorLevel=self::ERROR_NONE, $detectErrorLevel=self::ERROR_NONE, $parseLineBreaks=false, $removeDefaultAttrs=false)
| setDOMDocumentClass ( $DOMDocumentClass)
| setParseLineBreaks ( $value)
| setRemoveDefaultAttrs ( $value)
| createRootNode ()
| process ( $text, $createRootNode=true)
| performPass1 (&$data)
| parseTag (&$data, &$pos, &$parent)
| parseAttributes ( $attributeString)
| setAttributes ( $element, $attributes)
| washText ( $textContent)
| entitiesDecode ( $text)
| convertNumericEntities ( $text)
| performPass2 ()
| processSubtree ( $element, &$lastHandlerResult)
| removeAllAttributes (DOMElement $element)
| processBySchemaPresence ( $element)
| processBySchemaTree ( $element)
| fixSubtree ( $element, $mainChild)
| processAttributesBySchema ( $element)
| callInputHandler ( $handlerName, $tagName, &$attributes)
| callOutputHandler ( $handlerName, $element, &$params)
| createAndPublishElement ( $elementName, &$ret)
| processNewElements ( $createdElements)
| getMessages ()
| isValid ()
| handleError ( $type, $message)

## Public Attributes
const | SHOW_NO_ERRORS = 0
const | SHOW_SCHEMA_ERRORS = 1
const | SHOW_ALL_ERRORS = 2
const | ERROR_NONE = 0
| Use these constants for error types. More...
const | ERROR_SYNTAX = 4
const | ERROR_SCHEMA = 8
const | ERROR_DATA = 16
const | ERROR_ALL = 28
| $InputTags = array()
| $OutputTags = array()
| $Namespaces
| $DOMDocumentClass = 'DOMDocument'
| $XMLSchema
| $Document = null
| $Messages = array()
| $eZPublishVersion
| $ParentStack = array()
| $ValidateErrorLevel
| $DetectErrorLevel
| $IsInputValid = true
| $QuitProcess = false
| $TrimSpaces = true
| $AllowMultipleSpaces = false
| $AllowNumericEntities = false
| $StrictHeaders = false
| $ParseLineBreaks = false
| $RemoveDefaultAttrs = false

## Protected Member Functions
| wordMatchSupport ( $newTagName, $attributes, $attributeString)

## Private Member Functions
| findEndOpeningTagPosition ( $data, $tagBeginPos, $offset=0)
| isValidXmlTag ( $code)

## Detailed Description

Definition at line 24 of file ezxmlinputparser.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZXMLInputParser::__construct | ( |  | $validateErrorLevel = `self::ERROR_NONE`,
|  |  | $detectErrorLevel = `self::ERROR_NONE`,
|  |  | $parseLineBreaks = `false`,
|  |  | $removeDefaultAttrs = `false`
| ) |  |

The constructor.

Parameters

  $validate |
  $validateErrorLevel | Determines types of errors that break input processing It's possible to combine any error types, by creating a bitmask of EZ_XMLINPUTPARSER_ERROR_* constants. `true` value means that all errors defined by $detectErrorLevel parameter will break further processing
  $detectErrorLevel | Determines types of errors that will be detected and added to error log ($Messages).

Definition at line 120 of file ezxmlinputparser.php.

References ERROR_ALL, ERROR_NONE, ERROR_SCHEMA, and eZXMLSchema\instance().

## Member Function Documentation

## ◆ callInputHandler()

eZXMLInputParser::callInputHandler | ( |  | $handlerName,
|  |  | $tagName,
|  | & | $attributes
| ) |  |

Definition at line 1162 of file ezxmlinputparser.php.

References eZDebug\writeWarning().

Referenced by parseTag().

## ◆ callOutputHandler()

eZXMLInputParser::callOutputHandler | ( |  | $handlerName,
|  |  | $element,
|  | & | $params
| ) |  |

Definition at line 1181 of file ezxmlinputparser.php.

References eZDebug\writeWarning().

Referenced by parseTag(), processNewElements(), and processSubtree().

## ◆ convertNumericEntities()

eZXMLInputParser::convertNumericEntities | ( |  | $text | ) |

Definition at line 778 of file ezxmlinputparser.php.

Referenced by washText().

## ◆ createAndPublishElement()

eZXMLInputParser::createAndPublishElement | ( |  | $elementName,
|  | & | $ret
| ) |  |

Definition at line 1204 of file ezxmlinputparser.php.

Referenced by eZSimplifiedXMLInputParser\appendLineParagraph(), eZSimplifiedXMLInputParser\appendParagraph(), and eZSimplifiedXMLInputParser\structHandlerBr().

## ◆ createRootNode()

eZXMLInputParser::createRootNode | ( |  | ) |

Definition at line 195 of file ezxmlinputparser.php.

References $Document.

Referenced by process().

## ◆ entitiesDecode()

eZXMLInputParser::entitiesDecode | ( |  | $text | ) |

Definition at line 766 of file ezxmlinputparser.php.

Referenced by washText().

## ◆ findEndOpeningTagPosition()

eZXMLInputParser::findEndOpeningTagPosition | ( |  | $data,
|  |  | $tagBeginPos,
|  |  | $offset = `0`
| ) |  |
| private

Finds the postion of the > character which marks the end of the opening tag that starts at $tagBeginPos in $data. It's not as easy as it seems, because some '>' can also appear in attributes. So we need to iterate over the next '>' characters to find the correct one. See https://jira.ez.no/browse/EZP-26096

Parameters

  string | $data |
  integer | $tagBeginPos |
  integer | $offset | used for recursive call when a > is found in an attribute.

Returns
  integer|false

Definition at line 598 of file ezxmlinputparser.php.

References isValidXmlTag().

Referenced by parseTag().

## ◆ fixSubtree()

eZXMLInputParser::fixSubtree | ( |  | $element,
|  |  | $mainChild
| ) |  |

Definition at line 1077 of file ezxmlinputparser.php.

Referenced by processBySchemaTree().

## ◆ getMessages()

eZXMLInputParser::getMessages | ( |  | ) |

Definition at line 1298 of file ezxmlinputparser.php.

References $Messages.

## ◆ handleError()

eZXMLInputParser::handleError | ( |  | $type,
|  |  | $message
| ) |  |

Definition at line 1309 of file ezxmlinputparser.php.

Referenced by parseTag(), processAttributesBySchema(), processBySchemaPresence(), processBySchemaTree(), eZSimplifiedXMLInputParser\publishHandlerEmbed(), eZSimplifiedXMLInputParser\publishHandlerLink(), setAttributes(), and eZSimplifiedXMLInputParser\structHandlerHeader().

## ◆ isValid()

eZXMLInputParser::isValid | ( |  | ) |

Definition at line 1304 of file ezxmlinputparser.php.

References $IsInputValid.

## ◆ isValidXmlTag()

eZXMLInputParser::isValidXmlTag | ( |  | $code | ) |
| private

Checks whether $code can be considered as a valid XML excerpt. If not, it's probably because we found a '>' in the middle of an attribute.

Parameters

  string | $code |

Returns
  boolean

Definition at line 625 of file ezxmlinputparser.php.

Referenced by findEndOpeningTagPosition().

## ◆ parseAttributes()

eZXMLInputParser::parseAttributes | ( |  | $attributeString | ) |

Definition at line 643 of file ezxmlinputparser.php.

Referenced by parseTag().

## ◆ parseTag()

eZXMLInputParser::parseTag | ( | & | $data,
|  | & | $pos,
|  | & | $parent
| ) |  |

Definition at line 315 of file ezxmlinputparser.php.

References callInputHandler(), callOutputHandler(), findEndOpeningTagPosition(), handleError(), parseAttributes(), setAttributes(), ezpI18n\tr(), washText(), and wordMatchSupport().

Referenced by performPass1().

## ◆ performPass1()

eZXMLInputParser::performPass1 | ( | & | $data | ) |

Definition at line 282 of file ezxmlinputparser.php.

References parseTag().

Referenced by process().

## ◆ performPass2()

eZXMLInputParser::performPass2 | ( |  | ) |

Pass 2: Process the tree, run handlers, rebuild and validate.

Definition at line 820 of file ezxmlinputparser.php.

References processSubtree().

Referenced by process().

## ◆ process()

eZXMLInputParser::process | ( |  | $text,
|  |  | $createRootNode = `true`
| ) |  |

Call this function to process your input

Definition at line 216 of file ezxmlinputparser.php.

References $Document, eZDebugSetting\changeLabel(), createRootNode(), eZDebugSetting\isConditionTrue(), eZDebug\LEVEL_DEBUG, performPass1(), performPass2(), ezpI18n\tr(), and eZDebug\writeDebug().

## ◆ processAttributesBySchema()

eZXMLInputParser::processAttributesBySchema | ( |  | $element | ) |

Definition at line 1096 of file ezxmlinputparser.php.

References handleError(), and ezpI18n\tr().

Referenced by processNewElements(), and processSubtree().

## ◆ processBySchemaPresence()

eZXMLInputParser::processBySchemaPresence | ( |  | $element | ) |

Definition at line 998 of file ezxmlinputparser.php.

References handleError(), and ezpI18n\tr().

Referenced by processNewElements(), and processSubtree().

## ◆ processBySchemaTree()

eZXMLInputParser::processBySchemaTree | ( |  | $element | ) |

Definition at line 1041 of file ezxmlinputparser.php.

References fixSubtree(), handleError(), and ezpI18n\tr().

Referenced by processNewElements(), and processSubtree().

## ◆ processNewElements()

eZXMLInputParser::processNewElements | ( |  | $createdElements | ) |

Definition at line 1218 of file ezxmlinputparser.php.

References callOutputHandler(), eZDebugSetting\changeLabel(), eZDebugSetting\isConditionTrue(), eZDebug\LEVEL_DEBUG, processAttributesBySchema(), processBySchemaPresence(), processBySchemaTree(), removeAllAttributes(), and eZDebug\writeDebug().

Referenced by processSubtree().

## ◆ processSubtree()

eZXMLInputParser::processSubtree | ( |  | $element,
|  | & | $lastHandlerResult
| ) |  |

Definition at line 829 of file ezxmlinputparser.php.

References callOutputHandler(), eZDebugSetting\changeLabel(), eZDebugSetting\isConditionTrue(), eZDebug\LEVEL_DEBUG, processAttributesBySchema(), processBySchemaPresence(), processBySchemaTree(), processNewElements(), removeAllAttributes(), and eZDebug\writeDebug().

Referenced by performPass2().

## ◆ removeAllAttributes()

eZXMLInputParser::removeAllAttributes | ( | DOMElement | $element | ) |

Removes all attribute nodes from element node $element

Definition at line 988 of file ezxmlinputparser.php.

Referenced by processNewElements(), and processSubtree().

## ◆ setAttributes()

eZXMLInputParser::setAttributes | ( |  | $element,
|  |  | $attributes
| ) |  |

Definition at line 672 of file ezxmlinputparser.php.

References handleError(), ezpI18n\tr(), and eZDebug\writeWarning().

Referenced by parseTag().

## ◆ setDOMDocumentClass()

eZXMLInputParser::setDOMDocumentClass | ( |  | $DOMDocumentClass | ) |

Definition at line 177 of file ezxmlinputparser.php.

References $DOMDocumentClass.

## ◆ setParseLineBreaks()

eZXMLInputParser::setParseLineBreaks | ( |  | $value | ) |

Definition at line 183 of file ezxmlinputparser.php.

## ◆ setRemoveDefaultAttrs()

eZXMLInputParser::setRemoveDefaultAttrs | ( |  | $value | ) |

Definition at line 189 of file ezxmlinputparser.php.

## ◆ washText()

eZXMLInputParser::washText | ( |  | $textContent | ) |

Definition at line 749 of file ezxmlinputparser.php.

References convertNumericEntities(), and entitiesDecode().

Referenced by parseTag().

## ◆ wordMatchSupport()

eZXMLInputParser::wordMatchSupport | ( |  | $newTagName,
|  |  | $attributes,
|  |  | $attributeString
| ) |  |
| protected

Returns modified attributes parameter

Definition at line 792 of file ezxmlinputparser.php.

Referenced by parseTag().

## Member Data Documentation

## ◆ $AllowMultipleSpaces

eZXMLInputParser::$AllowMultipleSpaces = false

Definition at line 1344 of file ezxmlinputparser.php.

## ◆ $AllowNumericEntities

eZXMLInputParser::$AllowNumericEntities = false

Definition at line 1345 of file ezxmlinputparser.php.

## ◆ $DetectErrorLevel

eZXMLInputParser::$DetectErrorLevel

Definition at line 1337 of file ezxmlinputparser.php.

## ◆ $Document

eZXMLInputParser::$Document = null

Definition at line 1330 of file ezxmlinputparser.php.

Referenced by createRootNode(), and process().

## ◆ $DOMDocumentClass

eZXMLInputParser::$DOMDocumentClass = 'DOMDocument'

Definition at line 1327 of file ezxmlinputparser.php.

Referenced by setDOMDocumentClass().

## ◆ $eZPublishVersion

eZXMLInputParser::$eZPublishVersion

Definition at line 1332 of file ezxmlinputparser.php.

## ◆ $InputTags

eZXMLInputParser::$InputTags = array()

Definition at line 66 of file ezxmlinputparser.php.

## ◆ $IsInputValid

eZXMLInputParser::$IsInputValid = true

Definition at line 1339 of file ezxmlinputparser.php.

Referenced by isValid().

## ◆ $Messages

eZXMLInputParser::$Messages = array()

Definition at line 1331 of file ezxmlinputparser.php.

Referenced by getMessages().

## ◆ $Namespaces

eZXMLInputParser::$Namespaces

Initial value:
= array( 'image' => 'http://ez.no/namespaces/ezpublish3/image/',
'xhtml' => 'http://ez.no/namespaces/ezpublish3/xhtml/',
'custom' => 'http://ez.no/namespaces/ezpublish3/custom/',
'tmp' => 'http://ez.no/namespaces/ezpublish3/temporary/' )

Definition at line 104 of file ezxmlinputparser.php.

## ◆ $OutputTags

eZXMLInputParser::$OutputTags = array()

Definition at line 102 of file ezxmlinputparser.php.

## ◆ $ParentStack

eZXMLInputParser::$ParentStack = array()

Definition at line 1334 of file ezxmlinputparser.php.

## ◆ $ParseLineBreaks

eZXMLInputParser::$ParseLineBreaks = false

Definition at line 1349 of file ezxmlinputparser.php.

## ◆ $QuitProcess

eZXMLInputParser::$QuitProcess = false

Definition at line 1340 of file ezxmlinputparser.php.

## ◆ $RemoveDefaultAttrs

eZXMLInputParser::$RemoveDefaultAttrs = false

Definition at line 1350 of file ezxmlinputparser.php.

## ◆ $StrictHeaders

eZXMLInputParser::$StrictHeaders = false

Definition at line 1346 of file ezxmlinputparser.php.

## ◆ $TrimSpaces

eZXMLInputParser::$TrimSpaces = true

Definition at line 1343 of file ezxmlinputparser.php.

## ◆ $ValidateErrorLevel

eZXMLInputParser::$ValidateErrorLevel

Definition at line 1336 of file ezxmlinputparser.php.

## ◆ $XMLSchema

eZXMLInputParser::$XMLSchema

Definition at line 1329 of file ezxmlinputparser.php.

## ◆ ERROR_ALL

const eZXMLInputParser::ERROR_ALL = 28

Definition at line 36 of file ezxmlinputparser.php.

Referenced by __construct(), and eZSimplifiedXMLInput\validateInput().

## ◆ ERROR_DATA

const eZXMLInputParser::ERROR_DATA = 16

Definition at line 35 of file ezxmlinputparser.php.

Referenced by eZSimplifiedXMLInputParser\publishHandlerEmbed(), and eZSimplifiedXMLInputParser\publishHandlerLink().

## ◆ ERROR_NONE

const eZXMLInputParser::ERROR_NONE = 0

Use these constants for error types.

Definition at line 32 of file ezxmlinputparser.php.

Referenced by __construct().

## ◆ ERROR_SCHEMA

const eZXMLInputParser::ERROR_SCHEMA = 8

Definition at line 34 of file ezxmlinputparser.php.

Referenced by __construct(), and eZSimplifiedXMLInputParser\structHandlerHeader().

## ◆ ERROR_SYNTAX

const eZXMLInputParser::ERROR_SYNTAX = 4

Definition at line 33 of file ezxmlinputparser.php.

## ◆ SHOW_ALL_ERRORS

const eZXMLInputParser::SHOW_ALL_ERRORS = 2

Definition at line 29 of file ezxmlinputparser.php.

## ◆ SHOW_NO_ERRORS

const eZXMLInputParser::SHOW_NO_ERRORS = 0

Deprecated:
  (back-compatibility)

Definition at line 27 of file ezxmlinputparser.php.

## ◆ SHOW_SCHEMA_ERRORS

const eZXMLInputParser::SHOW_SCHEMA_ERRORS = 1

Definition at line 28 of file ezxmlinputparser.php.

The documentation for this class was generated from the following file:

- ezxmlinputparser.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.