Package org.apache.fop.fo
Class XMLObj
java.lang.Object
org.apache.fop.fo.FONode
org.apache.fop.fo.XMLObj
- All Implemented Interfaces:
Cloneable,EventListener,ContentHandlerFactory.ObjectBuiltListener
- Direct Known Subclasses:
SVGObj,UnknownXMLObj
Abstract class modelling generic, non-XSL-FO XML objects. Such objects are
stored in a DOM.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.fop.fo.FONode
FONode.FONodeIterator, FONode.GatherContextInfoFunction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DocumentDOM document containing this nodeprotected ElementDOM element representing this nodeprotected StringName of the nodeFields inherited from class org.apache.fop.fo.FONode
FO_URI, FOX_URI, locator, log, nodeChangeBarList, parent, siblings, startOfNodeChangeBarList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddChildNode(FONode child) Adds a node as a child of this node.voidaddElement(Document doc, Element parent) Add an element to the DOM documentvoidbuildTopLevel(Document doc, Element svgRoot) Add the top-level element to the DOM documentprotected voidcharacters(char[] data, int start, int length, PropertyList pList, Locator locator) Adds characters.Create an empty DOM documentgetDimension(Point2D view) Returns the dimensions of the generated area in pts.Retrieve the intrinsic alignment-adjust of the child element.Returns the local name (i.e.voidnotifyObjectBuilt(Object obj) Notifies the listener when the object is fully built.voidprocessNode(String elementName, Locator locator, Attributes attlist, PropertyList propertyList) Initialize the node with its name, location information, and attributes The attributes must be used immediately as the sax attributes will be altered for the next element.protected voidvalidateChildNode(Locator loc, String nsURI, String localName) Checks to make sure, during SAX processing of input document, that the incoming node is valid for this (parent) node (e.g., checking to see thatfo:tableis not an immediate child offo:root) called fromFOTreeBuilder.startElement(String, String, String, Attributes)before constructing the childFObj.Methods inherited from class org.apache.fop.fo.FONode
addCharacters, attachSiblings, bind, canHaveMarkers, charIterator, clone, clone, collectDelimitedTextRanges, collectDelimitedTextRanges, createPropertyList, decorateWithContextInfo, endOfNode, errorText, finalizeNode, gatherContextInfo, getBuilderContext, getChangeBarList, getChildNodes, getChildNodes, getContentHandlerFactory, getContextInfo, getContextInfoAlt, getExtensionAttachment, getFOEventHandler, getFOValidationEventProducer, getLocator, getLocatorString, getLogger, getName, getName, getNameId, getNamespaceURI, getNodePrefix, getNodeString, getNormalNamespacePrefix, getParent, getRoot, getStructureTreeElement, getUserAgent, inMarker, invalidChildError, invalidChildError, invalidPropertyValueError, isBidiRangeBlockItem, isChangeBarElement, isDelimitedTextRangeBoundary, missingChildElementError, missingChildElementError, missingPropertyError, nodesOutOfOrderError, nodesOutOfOrderError, notSupportedChildError, removeChild, setLocator, setStructureTreeElement, startOfNode, tooManyNodesError, tooManyNodesError, tooManyNodesError, validateChildNode, warningText
-
Field Details
-
element
DOM element representing this node -
doc
DOM document containing this node -
name
Name of the node
-
-
Constructor Details
-
XMLObj
Base constructor- Parameters:
parent-FONodethat is the parent of this object
-
-
Method Details
-
validateChildNode
protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException Checks to make sure, during SAX processing of input document, that the incoming node is valid for this (parent) node (e.g., checking to see thatfo:tableis not an immediate child offo:root) called fromFOTreeBuilder.startElement(String, String, String, Attributes)before constructing the childFObj.
Here, blocks XSL-FO's from having non-FO parents.- Overrides:
validateChildNodein classFONode- Parameters:
loc- location in the FO source filensURI- namespace of incoming nodelocalName- name of the incoming node (without namespace prefix)- Throws:
ValidationException- if incoming node not valid for parent
-
processNode
public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList propertyList) throws FOPException Initialize the node with its name, location information, and attributes The attributes must be used immediately as the sax attributes will be altered for the next element.- Overrides:
processNodein classFONode- Parameters:
elementName- element name (e.g., "fo:block")locator- Locator object (ignored by default)attlist- Collection of attributes passed to us from the parser.propertyList- the property list of the parent node- Throws:
FOPException- for errors or inconsistencies in the attributes
-
getDOMDocument
- Returns:
- DOM document representing this foreign XML
-
getDimension
Returns the dimensions of the generated area in pts.- Parameters:
view- Point2D instance to receive the dimensions- Returns:
- the requested dimensions in pts.
-
getIntrinsicAlignmentAdjust
Retrieve the intrinsic alignment-adjust of the child element.- Returns:
- the intrinsic alignment-adjust.
-
getLocalName
Returns the local name (i.e. without namespace prefix) of the node- Specified by:
getLocalNamein classFONode- Returns:
- the local name of this node
-
addElement
Add an element to the DOM document- Parameters:
doc- DOM document to which to add an elementparent- the parent element of the element that is being added
-
buildTopLevel
Add the top-level element to the DOM document- Parameters:
doc- DOM documentsvgRoot- non-XSL-FO element to be added as the root of this document
-
createBasicDocument
Create an empty DOM document- Returns:
- DOM document
-
addChildNode
Adds a node as a child of this node. The default implementation of this method just ignores any child node being added.- Overrides:
addChildNodein classFONode- Parameters:
child- child node to be added to the childNodes of this node
-
characters
protected void characters(char[] data, int start, int length, PropertyList pList, Locator locator) throws FOPException Adds characters. Does nothing by default. To be overridden in subclasses that allow#PCDATAcontent.- Overrides:
charactersin classFONode- Parameters:
data- array of characters containing text to be addedstart- starting array element to addlength- number of elements to addpList- currently applicable PropertyListlocator- location in the XSL-FO source file.- Throws:
FOPException- if there's a problem during processing
-
notifyObjectBuilt
Notifies the listener when the object is fully built.- Specified by:
notifyObjectBuiltin interfaceContentHandlerFactory.ObjectBuiltListener- Parameters:
obj- the newly built object
-