Class XmlRendererBlockVisitorANF
- java.lang.Object
-
- com.microstrategy.web.blocks.DefaultBlockVisitor
-
- com.microstrategy.web.blocks.renderers.XmlRendererBlockVisitorENF
-
- com.microstrategy.web.blocks.renderers.XmlRendererBlockVisitorANF
-
- All Implemented Interfaces:
BlockVisitor
public class XmlRendererBlockVisitorANF extends XmlRendererBlockVisitorENF
This class renders a Block tree in XML format, specifically Attribute Normal Form, where the scalar properties are represented as attributes.
Here are the rules for converting an arbitrary Block tree into an XML structure:
- The name of the root element is determined by calling the method
getDocumentElementName(Block)
. The default implementation returns "root". - The scalar properties are represented as attributes. Scalar-based properties use the name of the BlockProperty as the attribute name and the value of the BlockProperty as the attribute value.
- Block-based properties use the name of the BlockProperty as the element name. The properties of this child Block become the attributes of it using the rule described above.
- List-based properties use the name of the BlockProperty as the element
name. However, as the elements of a list have no names (and
are only listed one after another), the name of the element that is used for
this list element is found by calling
getBlockInListElementName(Block)
. The default implementation returns "block".
- Since:
- MicroStrategy Web 9.0.1
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockContext
blockContext
protected XMLBuilder
xmlBuilder
-
Constructor Summary
Constructors Constructor Description XmlRendererBlockVisitorANF(BlockContext blockContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getBlockInListElementName(Block block)
Returns the element name to use for a Block in a List.protected java.lang.String
getDocumentElementName(Block rootBlock)
Returns the element name to use for the document element.protected java.lang.String
getNestedListElementName()
Returns the element name to use for a BlockList which appears nested inside another BlockList.java.lang.String
getXML()
Gets the XML generated as a String.void
visitScalarProperty(BlockProperty blockProperty, Block parent, boolean firstAssignedProperty)
Invoked for each scalar (non-Block, non-BlockList) Block Property.-
Methods inherited from class com.microstrategy.web.blocks.renderers.XmlRendererBlockVisitorENF
visitBlockEnd, visitBlockStart, visitCompositeProperty, visitListEnd, visitListStart
-
Methods inherited from class com.microstrategy.web.blocks.DefaultBlockVisitor
visitUnassignedProperty
-
-
-
-
Field Detail
-
xmlBuilder
protected XMLBuilder xmlBuilder
-
blockContext
protected BlockContext blockContext
-
-
Constructor Detail
-
XmlRendererBlockVisitorANF
public XmlRendererBlockVisitorANF(BlockContext blockContext)
-
-
Method Detail
-
visitScalarProperty
public void visitScalarProperty(BlockProperty blockProperty, Block parent, boolean firstAssignedProperty)
Description copied from interface:BlockVisitor
Invoked for each scalar (non-Block, non-BlockList) Block Property. In particular, it is only invoked for BlockProperty instances whose value is non-null
.- Specified by:
visitScalarProperty
in interfaceBlockVisitor
- Overrides:
visitScalarProperty
in classXmlRendererBlockVisitorENF
- Parameters:
blockProperty
- TheBlockProperty
that has an assigned value.parent
- TheBlock
that contains this BlockProperty.firstAssignedProperty
- Whether or not this is the first assigned property of the Block.
-
getXML
public java.lang.String getXML()
Gets the XML generated as a String.- Returns:
- The String representation of the XML generated.
-
getDocumentElementName
protected java.lang.String getDocumentElementName(Block rootBlock)
Returns the element name to use for the document element.- Parameters:
rootBlock
- The root block being converted to XML.- Returns:
- The element name to use.
-
getBlockInListElementName
protected java.lang.String getBlockInListElementName(Block block)
Returns the element name to use for a Block in a List.- Parameters:
block
- The block being converted to XML.- Returns:
- The element name to use.
-
getNestedListElementName
protected java.lang.String getNestedListElementName()
Returns the element name to use for a BlockList which appears nested inside another BlockList.- Returns:
- The element name to use.
-
-