|
Novell exteNd Director 5.0 API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.novell.afw.util.EboXmlUtil
Utilities for dealing with XML
Constructor Summary | |
EboXmlUtil()
|
Method Summary | |
static void |
addDirectiveToXSL(org.w3c.dom.Document xslDom,
String directiveName,
String attributeName,
String attributeValue)
Add an xsl:import or xsl:include etc. |
static org.w3c.dom.Node |
addNodeAfterSibling(org.w3c.dom.Node siblingNode,
String nodeName,
org.w3c.dom.Node content)
create a new Element with nodeName and insert it after the siblingNode (same level); if the node name is null, insert the content node after the sibling node; both Nodes need to be part of the same document |
static org.w3c.dom.Node |
addNodeAfterSibling(org.w3c.dom.Node siblingNode,
String nodeName,
org.w3c.dom.Node content,
boolean contentIsLocal)
create a new Element with nodeName and insert it after the siblingNode (same level); if the node name is null, insert the content node after the sibling node |
static org.w3c.dom.Node |
addNodeBeforeSibling(org.w3c.dom.Node siblingNode,
String nodeName,
org.w3c.dom.Node content)
create a new Element with nodeName and insert it before the siblingNode (same level) |
static org.w3c.dom.Node |
addNodeBeforeSibling(org.w3c.dom.Node siblingNode,
String nodeName,
org.w3c.dom.Node content,
boolean contentIsLocal)
create a new Element with nodeName and insert it before the siblingNode (same level); if the node name is null, insert the content node before the sibling node |
static org.w3c.dom.Node |
appendChildNode(org.w3c.dom.Node parentNode,
org.w3c.dom.Node contentNode)
import a node into the current document directly under the passed parent Node |
static org.w3c.dom.Node |
appendChildNode(org.w3c.dom.Node parentNode,
org.w3c.dom.Node contentNode,
boolean contentIsLocal)
import a node into the current document directly under the passed parent Node |
static org.w3c.dom.Attr |
createAttribute(org.w3c.dom.Document doc,
String attributeName,
String attributeValue)
create an attribute standalone (not added to any node) |
static org.w3c.dom.Attr |
createAttribute(org.w3c.dom.Element el,
String attributeName,
String attributeValue)
create an attribute and add it to the Node provided |
static org.w3c.dom.Node |
createCDATANode(org.w3c.dom.Node parentNode,
String nodeName,
String content)
create a CDATA section as a child to the provided parentNode |
static org.w3c.dom.Node |
createChildNode(org.w3c.dom.Node parentNode,
String nodeName)
Create a child node and append it to the provided parent node |
static org.w3c.dom.Node |
createChildNode(org.w3c.dom.Node parentNode,
String nodeName,
org.w3c.dom.Node contentNode)
create a child node (to parentNode) and populate it with the delivered content (if != null) |
static org.w3c.dom.Node |
createChildNode(org.w3c.dom.Node parentNode,
String nodeName,
org.w3c.dom.Node contentNode,
boolean contentIsLocal)
create a child node (to parentNode) and populate it with the delivered content (if != null) |
static org.w3c.dom.Document |
createDocument()
create a new org.w3c.dom.Document with validation turned off and name space awareness turned on |
static org.w3c.dom.Document |
createDocument(org.xml.sax.InputSource inputSrc,
boolean isValidating,
boolean isNamespaceAware,
org.xml.sax.ErrorHandler errorHandler,
org.xml.sax.EntityResolver entityResolver)
Creates a new Document from an InputSource allowing the validation, namespace, error handler and entity resolver to be set. |
static org.w3c.dom.Document |
createDocument(InputStream stream)
create a Document from a String representation (reading the stream with UTF-8, with name space awareness on and validation off) |
static org.w3c.dom.Document |
createDocument(InputStream stream,
String encoding,
boolean validation,
boolean namespace)
create a Document from a stream representation of the XML content use the requested char-set encoding, validation and name space awareness |
static org.w3c.dom.Document |
createDocument(Reader reader,
boolean validation,
boolean namespace)
create a Document from a reader representation of the XML content use the requested validation and name space awareness |
static org.w3c.dom.Document |
createDocument(String strDoc)
Creates a Document from a String representing a valid XML document (no validation, but name space aware) |
static org.w3c.dom.Document |
createDocument(URL documentURL)
create a Document from a URL (get the content from the URL); name space aware, but no validation |
static org.w3c.dom.Node |
createDocumentRootNode(org.w3c.dom.Document parentDocument,
String nodeName,
org.w3c.dom.Node contentNode)
create a child node (to parentDocument) and populate it with the delivered content (if != null) |
static org.w3c.dom.Node |
createDocumentRootNode(org.w3c.dom.Document parentDocument,
String nodeName,
org.w3c.dom.Node contentNode,
boolean contentIsLocal)
create a child node (to parentDocument) and populate it with the delivered content (if != null) |
static org.w3c.dom.Node |
createNode(org.w3c.dom.Document document,
String nodeName,
org.w3c.dom.Node contentNode)
create a Node standalone (not added to any parent) |
static org.w3c.dom.Node |
createNode(org.w3c.dom.Document document,
String nodeName,
org.w3c.dom.Node contentNode,
boolean contentIsLocal)
create a Node standalone (not added to any parent) |
static org.w3c.dom.Node |
createTextNode(org.w3c.dom.Document doc,
org.w3c.dom.Node parentNode,
String nodeName,
String content)
create a text node |
static org.w3c.dom.Node |
createTextNode(org.w3c.dom.Node parentNode,
String nodeName,
String content)
create a text node |
static org.w3c.dom.Attr |
getAttribute(String attributeName,
org.w3c.dom.Node node)
get an attribute of a node (if present) |
static String |
getAttributeValue(String attributeName,
org.w3c.dom.Node node)
get the value of an attribute of a node (if present) |
static javax.xml.parsers.DocumentBuilder |
getBuilder()
get a javax.xml.parsers.DocumentBuilder from the javax.xml.parsers.DocumentBuilderFactory validation turned off and name space awareness turned on if you need a DocumentBuilder with different features, use the getBuilder(boolean validation, boolean nameSpaceAware) method (this method will cache the DocumentBuilder after the fist hit |
static javax.xml.parsers.DocumentBuilder |
getBuilder(boolean validation,
boolean nameSpaceAware)
get a javax.xml.parsers.DocumentBuilder from the javax.xml.parsers.DocumentBuilderFactory |
static javax.xml.transform.Templates |
getTemplates(javax.xml.transform.Source source)
compile the provided style sheet into templates |
static javax.xml.transform.Transformer |
getTransformer()
get a new Transformer from the TransformerFactory with indent turned on |
static javax.xml.transform.Transformer |
getTransformer(org.w3c.dom.Document doc)
get a new Transformer for the passed Document (the xsl) from the TransformerFactory with indent turned on |
static javax.xml.transform.Transformer |
getTransformer(Properties transProps)
get a new Transformer from the TransformerFactory with the passed output properties |
static javax.xml.transform.Transformer |
getTransformer(javax.xml.transform.Source strSource)
get a new Transformer for the passed Source (the xsl) from the TransformerFactory with indent turned on |
static javax.xml.transform.Transformer |
getTransformer(javax.xml.transform.Templates templates)
get a new Transformer for the passed compiled xsl template (with indent turned on) |
static String |
serialize(org.w3c.dom.Node doc)
serialize a Document to String (using a Transformer) |
static void |
serialize(org.w3c.dom.Node doc,
OutputStream output)
serialize a Document to the provided OutputStream (using a Transformer) |
static void |
serialize(org.w3c.dom.Node doc,
OutputStream output,
javax.xml.transform.Transformer transformer)
serialize a Document to the provided OutputStream (using the passed Transformer) |
static String |
serialize(org.w3c.dom.Node doc,
javax.xml.transform.Transformer transformer)
serialize a Document to String (using the passed Transformer) |
static void |
serialize(org.w3c.dom.Node doc,
Writer writer)
serialize a Document to the provided Writer (using a Transformer) |
static void |
serialize(org.w3c.dom.Node doc,
Writer writer,
javax.xml.transform.Transformer transformer)
serialize a Document to the provided Writer (using a Transformer) |
static void |
xslTransform(org.w3c.dom.Document contentDom,
org.w3c.dom.Document styleDom,
Writer out)
Transforms an xml with the provided xsl document and writes it to the writer. |
static void |
xslTransform(org.w3c.dom.Document contentDom,
javax.xml.transform.Transformer transformer,
OutputStream out)
Transforms an xml document with the provided xsl style (compiled version) and write it to the provided writer |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public EboXmlUtil()
Method Detail |
public static javax.xml.parsers.DocumentBuilder getBuilder() throws javax.xml.parsers.ParserConfigurationException
public static javax.xml.parsers.DocumentBuilder getBuilder(boolean validation, boolean nameSpaceAware) throws javax.xml.parsers.ParserConfigurationException
validation
- true if validation should be turned on, otherwise use falsenameSpaceAware
- true if name space awareness should be turned on, otherwise use falsepublic static org.w3c.dom.Document createDocument() throws javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document createDocument(String strDoc) throws org.w3c.dom.DOMException, IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
strDoc
- the string representing the xmlpublic static org.w3c.dom.Document createDocument(InputStream stream) throws org.w3c.dom.DOMException, IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
stream
- the InputStream that represents the XML Contentpublic static org.w3c.dom.Document createDocument(InputStream stream, String encoding, boolean validation, boolean namespace) throws org.w3c.dom.DOMException, IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
stream
- the stream (InputStream,...) to represent the XMLencoding
- the Char encoding that should be used to read from the streamnamespace
- use namespace awareness (true) , or not (false)validation
- use validation (true), or not (false)public static org.w3c.dom.Document createDocument(Reader reader, boolean validation, boolean namespace) throws org.w3c.dom.DOMException, IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
reader
- the reader pointing to the 'raw' xmlnamespace
- use namespace awareness (true) , or not (false)validation
- use validation (true), or not (false)public static org.w3c.dom.Document createDocument(URL documentURL) throws IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
documentURL
- the URL pointing to the Documentpublic static org.w3c.dom.Document createDocument(org.xml.sax.InputSource inputSrc, boolean isValidating, boolean isNamespaceAware, org.xml.sax.ErrorHandler errorHandler, org.xml.sax.EntityResolver entityResolver) throws org.w3c.dom.DOMException, IOException, org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
inputSrc
- the InputSource representing the xmlisValidating
- the boolean determining if validating is used against the xmlisNamespaceAware
- the boolean determining if the NameSpaceAware feature is seterrorHandler
- the ErrorHandler to be used if suppliedentityResolver
- the entityResolver to be used if suppliedpublic static org.w3c.dom.Node createDocumentRootNode(org.w3c.dom.Document parentDocument, String nodeName, org.w3c.dom.Node contentNode)
parentDocument
- the Document that will receive the new Element and the contentnodeName
- the name of the Element to createcontentNode
- the Node that will be appended as a child to the created Elementpublic static org.w3c.dom.Node createDocumentRootNode(org.w3c.dom.Document parentDocument, String nodeName, org.w3c.dom.Node contentNode, boolean contentIsLocal)
parentDocument
- the Document that will receive the new Element and the contentnodeName
- the name of the Element to createcontentNode
- the Node that will be imported (if external) or appended (if local) as a child to the created Element (incl. subtree)contentIsLocal
- a boolean indicating wether the contentNode is external to the document and has to be imported (false), or if it can be appended (true)public static org.w3c.dom.Node createNode(org.w3c.dom.Document document, String nodeName, org.w3c.dom.Node contentNode)
document
- Document used to create the Element (not null!)nodeName
- name of the node to be created (not null!)contentNode
- content in form of a Node to be appended as child (if not null) ; including the subtreepublic static org.w3c.dom.Node createNode(org.w3c.dom.Document document, String nodeName, org.w3c.dom.Node contentNode, boolean contentIsLocal)
document
- Document used to create the Element (not null!)nodeName
- name of the node to be created (not null!)contentNode
- content in form of a Node to be imported or appended as child (if not null)contentIsLocal
- a boolean indicating wether the contentNode is external to the document and has to be imported (false), or if it can be appended (true)public static org.w3c.dom.Node createChildNode(org.w3c.dom.Node parentNode, String nodeName, org.w3c.dom.Node contentNode)
parentNode
- the parent Node (not null!)nodeName
- the name for the new Element (not null!)contentNode
- org.w3c.dom.Node that contains the content to be appended (incl. subtree) to the parent Document (or null)public static org.w3c.dom.Node createChildNode(org.w3c.dom.Node parentNode, String nodeName, org.w3c.dom.Node contentNode, boolean contentIsLocal)
parentNode
- the parent Node (not null!)nodeName
- the name for the new Element (not null!)contentNode
- org.w3c.dom.Node that contains the content to be imported (incl. subtree) or appended (if local) to the parent Document (or null)contentIsLocal
- a boolean indicating wether the contentNode is external to the document and has to be imported (false), or if it can be appended (true)public static org.w3c.dom.Node createChildNode(org.w3c.dom.Node parentNode, String nodeName)
nodeName
- the name for the new nodeparentNode
- the parent org.w3c.dom.Node that will receive the childpublic static org.w3c.dom.Node createTextNode(org.w3c.dom.Document doc, org.w3c.dom.Node parentNode, String nodeName, String content)
doc
- the Document to contain the new text node (not null!)parentNode
- the Node under which the new text node should be placed (or null)nodeName
- the name of the new text node (not null!)content
- the text itselfpublic static org.w3c.dom.Node createTextNode(org.w3c.dom.Node parentNode, String nodeName, String content)
parentNode
- the Node under which the new text node should be placed (not null!)nodeName
- the name of the new text node (not null!)content
- the text itselfpublic static org.w3c.dom.Attr createAttribute(org.w3c.dom.Element el, String attributeName, String attributeValue)
el
- the element that will receive the attribute (not null!)attributeName
- name of the attribute to be created (not null!)attributeValue
- value of the attribute to be createdpublic static org.w3c.dom.Attr createAttribute(org.w3c.dom.Document doc, String attributeName, String attributeValue)
doc
- the Document used to create the attributeattributeName
- name of the attribute to be createdattributeValue
- value of the attribute to be createdpublic static String getAttributeValue(String attributeName, org.w3c.dom.Node node)
attributeName
- the name of the attribute you want to getnode
- the Node where the attribute livespublic static org.w3c.dom.Attr getAttribute(String attributeName, org.w3c.dom.Node node)
attributeName
- the name of the attribute you want to getnode
- the Node where the attribute livespublic static org.w3c.dom.Node createCDATANode(org.w3c.dom.Node parentNode, String nodeName, String content)
parentNode
- Node (parent) of the element to be created (not null!)nodeName
- the name you want to give your Node (or null if the textnode should be appended to the parent node directly)content
- the content of the node (the text)public static org.w3c.dom.Node addNodeBeforeSibling(org.w3c.dom.Node siblingNode, String nodeName, org.w3c.dom.Node content)
siblingNode
- the node that will be used as reference; the new element will be inserted before this nodenodeName
- the name of the element to createcontent
- any subtree that will be appended as child of the new element (if != null)public static org.w3c.dom.Node addNodeBeforeSibling(org.w3c.dom.Node siblingNode, String nodeName, org.w3c.dom.Node content, boolean contentIsLocal)
siblingNode
- the node that will be used as reference; the new element will be inserted before this nodenodeName
- the name of the element to create (or null; if null, content needs to be not null!)content
- any subtree that will be imported or appended (if local) as child of the new element (if != null)contentIsLocal
- a boolean indicating wether the contentNode is external to the document and has to be imported (false), or if it can be appended (true)public static org.w3c.dom.Node addNodeAfterSibling(org.w3c.dom.Node siblingNode, String nodeName, org.w3c.dom.Node content)
siblingNode
- the node that will be used as reference; the new element will be inserted after this nodenodeName
- the name of the element to create (or null; if null, content needs to be not null!)content
- any subtree that will be imported or appended (if local) as child of the new element (if != null)public static org.w3c.dom.Node addNodeAfterSibling(org.w3c.dom.Node siblingNode, String nodeName, org.w3c.dom.Node content, boolean contentIsLocal)
siblingNode
- the node that will be used as reference; the new element will be inserted after this nodenodeName
- the name of the element to create (or null; if null, content needs to be not null!)content
- any subtree that will be imported or appended (if local) as child of the new element (if != null)contentIsLocal
- a boolean indicating wether the contentNode is external to the document and has to be imported (false), or if it can be appended (true)public static org.w3c.dom.Node appendChildNode(org.w3c.dom.Node parentNode, org.w3c.dom.Node contentNode)
parentNode
- the Node under which the content should be placed (not null!)contentNode
- the Node (not null!) that will be imported as a child to the created Node (incl. subtree)public static org.w3c.dom.Node appendChildNode(org.w3c.dom.Node parentNode, org.w3c.dom.Node contentNode, boolean contentIsLocal)
parentNode
- the Node under which the content should be placed (not null!)contentNode
- the Node (not null!) that will be imported as a child to the created Node (incl. subtree)contentIsLocal
- a boolean indicating wether the contentNode is external to the document and has to be imported (false), or if it can be appended (true)public static void serialize(org.w3c.dom.Node doc, OutputStream output) throws IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
doc
- Document (-fragment) to be serializedoutput
- the OutputStream to write topublic static void serialize(org.w3c.dom.Node doc, OutputStream output, javax.xml.transform.Transformer transformer) throws IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
doc
- Document (-fragment) to be serializedoutput
- the OutputStream to write totransformer
- the transformer to usepublic static void serialize(org.w3c.dom.Node doc, Writer writer) throws IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
doc
- Document (-fragment) to be serializedwriter
- the writer to write topublic static void serialize(org.w3c.dom.Node doc, Writer writer, javax.xml.transform.Transformer transformer) throws IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
doc
- Document (-fragment) to be serializedwriter
- the writer to write totransformer
- the transformer to usepublic static String serialize(org.w3c.dom.Node doc) throws IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
doc
- Document (-fragment) to be serializedpublic static String serialize(org.w3c.dom.Node doc, javax.xml.transform.Transformer transformer) throws IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
doc
- Document (-fragment) to be serializedtransformer
- the transformer to usepublic static void addDirectiveToXSL(org.w3c.dom.Document xslDom, String directiveName, String attributeName, String attributeValue) throws javax.xml.transform.TransformerException
xslDom
- the DOM representation of the XSL style sheetdirectiveName
- the tag name (like xsl:import)attributeName
- theattributeValue
- public static void xslTransform(org.w3c.dom.Document contentDom, org.w3c.dom.Document styleDom, Writer out) throws javax.xml.transform.TransformerException, javax.xml.transform.TransformerConfigurationException, FileNotFoundException, IOException
contentDom
- the document to be transformedstyleDom
- the style to apply to the contentout
- the writer to write the result topublic static void xslTransform(org.w3c.dom.Document contentDom, javax.xml.transform.Transformer transformer, OutputStream out) throws javax.xml.transform.TransformerException, javax.xml.transform.TransformerConfigurationException, FileNotFoundException, IOException
contentDom
- the document to be transformedtransformer
- the compiled xsl style sheet that will be applied to the content documentout
- the OutputStream to write the result topublic static javax.xml.transform.Transformer getTransformer() throws javax.xml.transform.TransformerConfigurationException
public static javax.xml.transform.Transformer getTransformer(Properties transProps) throws javax.xml.transform.TransformerConfigurationException
transProps
- a Porperties file containing the desired Output propertiespublic static javax.xml.transform.Transformer getTransformer(javax.xml.transform.Source strSource) throws javax.xml.transform.TransformerConfigurationException
strSource
- a Source (StreamSource, DOMSource, SAXSource) representing the style we need the Transformer forpublic static javax.xml.transform.Transformer getTransformer(javax.xml.transform.Templates templates) throws javax.xml.transform.TransformerConfigurationException
templates
- the pre compile xsl style sheetpublic static javax.xml.transform.Transformer getTransformer(org.w3c.dom.Document doc) throws javax.xml.transform.TransformerException, IOException
doc
- a document representing the style we need the Transformer forpublic static javax.xml.transform.Templates getTemplates(javax.xml.transform.Source source) throws javax.xml.transform.TransformerConfigurationException
source
- a StreamSource, DOMSource, ... that contains the xsl style sheet to compile
|
Novell exteNd Director 5.0 API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |