wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
XMLOutputStrategy Class Reference
+ Inheritance diagram for XMLOutputStrategy:

Public Member Functions

 XMLOutputStrategy ($file, $docType, $dtd, $encoding='UTF-8', $indent=2, $linebreak="\n")
 
 writeHeader ()
 
 writeFooter ()
 
 writeObject (&$obj)
 
 writeToFile ($text)
 
 writeObjectContent (&$obj, $curIndent)
 
 isWritingOIDs ()
 
 writeElement (&$obj, $name)
 
 getElementName (&$obj)
 
 getElementValue (&$obj, $name, $value)
 
 writeAttribute (&$obj, $name)
 
 getAttributeName (&$obj, $name)
 
 getAttributeValue (&$obj, $name, $value)
 

Public Attributes

 $_id = 0
 
 $_file = ''
 
 $_docType = ''
 
 $_dtd = ''
 
 $_encoding = ''
 
 $_fp = 0
 
 $_indent = ''
 
 $_linebreak = "\n"
 
 $_tagsToClose = null
 
 $_lastIndent = -1
 
 $_fileOk = false
 

Detailed Description

This OutputStrategy outputs an object's content in a xml file using the default format.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.XMLOutputStrategy.php 1462 2014-02-04 23:52:27Z iherwig
Note
file locking works not on NFS!
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 32 of file class.XMLOutputStrategy.php.

Member Function Documentation

XMLOutputStrategy::XMLOutputStrategy (   $file,
  $docType,
  $dtd,
  $encoding = 'UTF-8',
  $indent = 2,
  $linebreak = "\n" 
)

Constructor.

Parameters
fileThe output file name.
docTypeThe document type.
dtdThe document type definition name.
encodingThe used encoding (default: UTF-8).
indentThe number of spaces to indent (default: 2).
linebreakThe linebreak char to use (default:
).

Definition at line 54 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::writeHeader ( )

Write the xml header.

Implements OutputStrategy.

Definition at line 68 of file class.XMLOutputStrategy.php.

References Log\warn(), and writeToFile().

+ Here is the call graph for this function:

XMLOutputStrategy::writeFooter ( )

Write the xml footer.

Implements OutputStrategy.

Definition at line 97 of file class.XMLOutputStrategy.php.

References writeToFile().

+ Here is the call graph for this function:

XMLOutputStrategy::writeObject ( $obj)

Write the object.

Parameters
objThe object to write.

Implements OutputStrategy.

Definition at line 115 of file class.XMLOutputStrategy.php.

References writeObjectContent(), and writeToFile().

+ Here is the call graph for this function:

XMLOutputStrategy::writeToFile (   $text)

Actually write text to the file.

Note
subclasses will override this to implement any final conversion.
Parameters
textThe text to write

Definition at line 153 of file class.XMLOutputStrategy.php.

Referenced by writeAttribute(), writeElement(), writeFooter(), writeHeader(), writeObject(), and writeObjectContent().

XMLOutputStrategy::writeObjectContent ( $obj,
  $curIndent 
)

Write the object's content including opening tag, excluding closing tag.

Parameters
objThe object to write.
curIndentThe current indent.
Returns
The name of the opening tag

Definition at line 163 of file class.XMLOutputStrategy.php.

References DATATYPE_ATTRIBUTE, DATATYPE_ELEMENT, getElementName(), isWritingOIDs(), writeAttribute(), writeElement(), and writeToFile().

Referenced by writeObject().

+ Here is the call graph for this function:

XMLOutputStrategy::isWritingOIDs ( )

Determine wether the oid should be written to the file. The default implementation returns true.

Note
subclasses will override this to implement special application requirements.
Returns
True/False wether the oid should be written

Definition at line 197 of file class.XMLOutputStrategy.php.

Referenced by writeObjectContent().

XMLOutputStrategy::writeElement ( $obj,
  $name 
)

Write an object value of type DATATYPE_ELEMENT.

Note
subclasses will override this to implement special application requirements.
Parameters
objThe object to write
nameThe name of the value

Definition at line 207 of file class.XMLOutputStrategy.php.

References DATATYPE_ELEMENT, getElementValue(), and writeToFile().

Referenced by writeObjectContent().

+ Here is the call graph for this function:

XMLOutputStrategy::getElementName ( $obj)

Get the xml element name for an object. The default implementation returns the result of the getType() method.

Note
subclasses will override this to implement special application requirements.
Parameters
objThe object to write
Returns
The xml name of the element

Definition at line 222 of file class.XMLOutputStrategy.php.

Referenced by writeObjectContent().

XMLOutputStrategy::getElementValue ( $obj,
  $name,
  $value 
)

Get the xml element value for an object. The default implementation replaces newlines by
and applies htmlspecialchars to the result.

Note
subclasses will override this to implement special application requirements.
Parameters
objThe object to write
nameThe name of the element
valueThe value to write
Returns
The xml value

Definition at line 235 of file class.XMLOutputStrategy.php.

Referenced by writeElement().

XMLOutputStrategy::writeAttribute ( $obj,
  $name 
)

Write an object value of type DATATYPE_ATTRIBUTE.

Note
subclasses will override this to implement special application requirements.
Parameters
objThe object to write
nameThe name of the value

Definition at line 245 of file class.XMLOutputStrategy.php.

References DATATYPE_ATTRIBUTE, getAttributeName(), getAttributeValue(), and writeToFile().

Referenced by writeObjectContent().

+ Here is the call graph for this function:

XMLOutputStrategy::getAttributeName ( $obj,
  $name 
)

Get the xml attribute name for an object value. The default implementation returns the name of the attribute.

Note
subclasses will override this to implement special application requirements.
Parameters
objThe object to write
nameThe name of the attribute
Returns
The xml name of the attribute

Definition at line 261 of file class.XMLOutputStrategy.php.

Referenced by writeAttribute().

XMLOutputStrategy::getAttributeValue ( $obj,
  $name,
  $value 
)

Get the xml attribute value for an object value. The default implementation replaces newlines by
and applies htmlspecialchars to the result.

Note
subclasses will override this to implement special application requirements.
Parameters
objThe object to write
nameThe name of the attribute
valueThe value to write
Returns
The xml value

Definition at line 274 of file class.XMLOutputStrategy.php.

Referenced by writeAttribute().

Member Data Documentation

XMLOutputStrategy::$_id = 0

Definition at line 34 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_file = ''

Definition at line 35 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_docType = ''

Definition at line 36 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_dtd = ''

Definition at line 37 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_encoding = ''

Definition at line 38 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_fp = 0

Definition at line 39 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_indent = ''

Definition at line 40 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_linebreak = "\n"

Definition at line 41 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_tagsToClose = null

Definition at line 42 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_lastIndent = -1

Definition at line 43 of file class.XMLOutputStrategy.php.

XMLOutputStrategy::$_fileOk = false

Definition at line 44 of file class.XMLOutputStrategy.php.


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