Package org.apache.xalan.serialize
Class SerializerUtils
java.lang.Object
org.apache.xalan.serialize.SerializerUtils
public class SerializerUtils extends Object
Class that contains only static methods that are used to "serialize",
these methods are used by Xalan and are not in org.apache.xml.serializer
because they have dependancies on the packages org.apache.xpath or org.
apache.xml.dtm or org.apache.xalan.transformer. The package org.apache.xml.
serializer should not depend on Xalan or XSLTC.
-
Constructor Summary
Constructors Constructor Description SerializerUtils() -
Method Summary
Modifier and Type Method Description static voidaddAttribute(SerializationHandler handler, int attr)Copy an DOM attribute to the created output element, executing attribute templates as need be, and processing the xsl:use attribute.static voidaddAttributes(SerializationHandler handler, int src)Copy DOM attributes to the result element.static voidensureNamespaceDeclDeclared(SerializationHandler handler, DTM dtm, int namespace)This function checks to make sure a given prefix is really declared.static booleanisDefinedNSDecl(SerializationHandler serializer, int attr, DTM dtm)Returns whether a namespace is definedstatic voidoutputResultTreeFragment(SerializationHandler handler, XObject obj, XPathContext support)Given a result tree fragment, walk the tree and output it to the SerializationHandler.static voidprocessNSDecls(SerializationHandler handler, int src, int type, DTM dtm)Copy xmlns: attributes in if not already in scope.
-
Constructor Details
-
SerializerUtils
public SerializerUtils()
-
-
Method Details
-
addAttribute
public static void addAttribute(SerializationHandler handler, int attr) throws TransformerExceptionCopy an DOM attribute to the created output element, executing attribute templates as need be, and processing the xsl:use attribute.- Parameters:
handler- SerializationHandler to which the attributes are added.attr- Attribute node to add to SerializationHandler.- Throws:
TransformerException
-
addAttributes
public static void addAttributes(SerializationHandler handler, int src) throws TransformerExceptionCopy DOM attributes to the result element.- Parameters:
src- Source node with the attributes- Throws:
TransformerException
-
outputResultTreeFragment
public static void outputResultTreeFragment(SerializationHandler handler, XObject obj, XPathContext support) throws SAXExceptionGiven a result tree fragment, walk the tree and output it to the SerializationHandler.- Parameters:
obj- Result tree fragment objectsupport- XPath context for the result tree fragment- Throws:
SAXException
-
processNSDecls
public static void processNSDecls(SerializationHandler handler, int src, int type, DTM dtm) throws TransformerExceptionCopy xmlns: attributes in if not already in scope. As a quick hack to support ClonerToResultTree, this can also be used to copy an individual namespace node.- Parameters:
src- Source Node NEEDSDOC @param type NEEDSDOC @param dtm- Throws:
TransformerException
-
isDefinedNSDecl
Returns whether a namespace is defined- Parameters:
attr- Namespace attribute nodedtm- The DTM that owns attr.- Returns:
- True if the namespace is already defined in list of namespaces
-
ensureNamespaceDeclDeclared
public static void ensureNamespaceDeclDeclared(SerializationHandler handler, DTM dtm, int namespace) throws SAXExceptionThis function checks to make sure a given prefix is really declared. It might not be, because it may be an excluded prefix. If it's not, it still needs to be declared at this point. TODO: This needs to be done at an earlier stage in the game... -sb NEEDSDOC @param dtm NEEDSDOC @param namespace- Throws:
SAXException
-