|
Oracle Fusion Middleware Java API Reference for Oracle PDK Java 11g Release 1 (11.1.1) E10691-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.portal.utils.xml.v2.XMLUtil
public class XMLUtil
Class containing utility methods for parsing and manipulating XML documents.
Constructor Summary | |
---|---|
XMLUtil()
|
Method Summary | |
---|---|
static oracle.xml.parser.v2.XMLDocument |
applyXSL(oracle.xml.parser.v2.XMLDocument xmldoc,
oracle.xml.parser.v2.XSLStylesheet xsl,
java.io.OutputStream errOut)
Apply the given stylesheet to the given XML document, reporting errors and warnings to the given OutputStream . |
static int |
compareVersions(java.lang.String version1,
java.lang.String version2)
Compare the given version number strings. |
static java.lang.String |
escapeForXMLAttribute(java.lang.String text)
Properly escapes text for inclusion as XML attribute value. |
static java.lang.String |
escapeForXMLText(java.lang.String text)
Properly escapes text for inclusion in as XML text. |
static java.lang.String |
escapeXML(java.lang.String text,
boolean isAttribute)
General utility to escape text for inclusion in XML - i.e. escapes &, >, and < if regular XML text or escapes &, >, <, ', and " if an XML attribute value. |
static java.lang.String |
escapeXML(java.lang.String text,
boolean isAttribute,
boolean ignorePredefinedEnties)
General utility to escape text for inclusion in XML - i.e. escapes &, >, and < if regular XML text or escapes &, >, <, ', and " if an XML attribute value. |
static java.lang.String |
escapeXMLAttribute(java.lang.String text)
Deprecated. As of 9.0.5, use escapeForXMLAttribute
to properly escape attribute values |
static java.lang.String |
escapeXMLText(java.lang.String text)
Deprecated. As of 9.0.5, use escapeForXMLText
to properly escape XML text |
static boolean |
getBooleanValue(java.lang.String value)
Convert the given String encoding of a boolean value ( "true" or "false" ) to a boolean . |
static java.util.Iterator |
getStyleSheetPIs(oracle.xml.parser.v2.XMLDocument doc)
Get an Iterator of ProcessingInstruction s from the given XML document which
have a target of "xml-stylesheet" . |
static java.util.Iterator |
getTargetPIs(oracle.xml.parser.v2.XMLDocument doc,
java.lang.String targetName)
Get an Iterator of ProcessingInstruction s from the given XML document which
have the specified target (for example, "xml-stylesheet" ). |
static int |
getVersionMajor(java.lang.String version)
Given a version number string, get the integer corresponding to the 'major version'. |
static java.util.Iterator |
getXslDocs(oracle.xml.parser.v2.XMLDocument doc)
Get an Iterator of XSLStylesheet s referenced by processing
instructions in the given XML document which have a target of
"xml-stylesheet" . |
static oracle.xml.parser.v2.XMLDocument |
parseDocument(java.io.InputStream docInputStream,
java.io.OutputStream errOut)
Parse an XML document from the given InputStream , reporting
errors and warnings to the given OutputStream . |
static oracle.xml.parser.v2.XMLDocument |
parseDocument(java.io.Reader docReader,
java.io.OutputStream errOut)
Parse an XML document from the given Reader , reporting
errors and warnings to the given OutputStream . |
static oracle.xml.parser.v2.XMLDocument |
parseDocument(java.net.URL docURL,
java.io.OutputStream errOut)
Parse an XML document from the given URL , reporting
errors and warnings to the given OutputStream . |
static java.util.Map |
parsePI(org.w3c.dom.ProcessingInstruction pi)
Given a ProcessingInstruction whose data contains
attribute/value pairs, return a Map which contains
the attributes as keys and their corresponding values as values. |
static oracle.xml.parser.v2.XSLStylesheet |
parseStylesheet(java.net.URL docURL,
java.io.OutputStream errOut)
Parse an XSL stylesheet from the given URL , reporting
errors and warnings to the given OutputStream . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLUtil()
Method Detail |
---|
public static oracle.xml.parser.v2.XMLDocument parseDocument(java.io.InputStream docInputStream, java.io.OutputStream errOut) throws java.io.IOException, org.xml.sax.SAXException
InputStream
, reporting
errors and warnings to the given OutputStream
.
docInputStream
- InputStream
from which the document
should be readerrOut
- OutputStream
to which parsing errors and
warnings should be reported
java.io.IOException
- if an I/O error occurs
org.xml.sax.SAXException
- if a parsing error occurspublic static oracle.xml.parser.v2.XMLDocument parseDocument(java.io.Reader docReader, java.io.OutputStream errOut) throws java.io.IOException, org.xml.sax.SAXException
Reader
, reporting
errors and warnings to the given OutputStream
.
docReader
- Reader
from which the document
should be readerrOut
- OutputStream
to which parsing errors and
warnings should be reported
java.io.IOException
- if an I/O error occurs
org.xml.sax.SAXException
- if a parsing error occurspublic static oracle.xml.parser.v2.XMLDocument parseDocument(java.net.URL docURL, java.io.OutputStream errOut) throws java.io.IOException, org.xml.sax.SAXException
URL
, reporting
errors and warnings to the given OutputStream
.
docURL
- URL
from which the document
should be readerrOut
- OutputStream
to which parsing errors and
warnings should be reported
java.io.IOException
- if an I/O error occurs
org.xml.sax.SAXException
- if a parsing error occurspublic static oracle.xml.parser.v2.XSLStylesheet parseStylesheet(java.net.URL docURL, java.io.OutputStream errOut) throws java.io.IOException, org.xml.sax.SAXException, oracle.xml.parser.v2.XSLException
URL
, reporting
errors and warnings to the given OutputStream
.
docURL
- URL
from which the stylesheet
should be readerrOut
- OutputStream
to which parsing errors and
warnings should be reported
java.io.IOException
- if an I/O error occurs
org.xml.sax.SAXException
- if a parsing error occurs
oracle.xml.parser.v2.XSLException
- if the document is not a valid stylesheetpublic static oracle.xml.parser.v2.XMLDocument applyXSL(oracle.xml.parser.v2.XMLDocument xmldoc, oracle.xml.parser.v2.XSLStylesheet xsl, java.io.OutputStream errOut) throws java.io.IOException, oracle.xml.parser.v2.XSLException
OutputStream
.
xmldoc
- a parsed XML documentxsl
- a parsed XSL stylesheeterrOut
- OutputStream
to which stylesheet processing
errors should be reported
java.io.IOException
oracle.xml.parser.v2.XSLException
public static java.util.Iterator getTargetPIs(oracle.xml.parser.v2.XMLDocument doc, java.lang.String targetName)
Iterator
of ProcessingInstruction
s from the given XML document which
have the specified target (for example, "xml-stylesheet"
).
doc
- the XML documenttargetName
- the target of the processing instructions to be returned
Iterator
of ProcessingInstruction
s from the given XML document which
have the specified target.public static java.util.Iterator getStyleSheetPIs(oracle.xml.parser.v2.XMLDocument doc)
Iterator
of ProcessingInstruction
s from the given XML document which
have a target of "xml-stylesheet"
.
doc
- the XML document
Iterator
of ProcessingInstruction
s from the given XML document which
have a target of "xml-stylesheet"
.public static java.util.Iterator getXslDocs(oracle.xml.parser.v2.XMLDocument doc) throws java.io.IOException, org.xml.sax.SAXException, oracle.xml.parser.v2.XSLException
Iterator
of XSLStylesheet
s referenced by processing
instructions in the given XML document which have a target of
"xml-stylesheet"
.
doc
- the XML document
Iterator
of XSLStylesheet
s referenced by processing
instructions in the given XML document which have a target of
"xml-stylesheet"
.
java.io.IOException
org.xml.sax.SAXException
oracle.xml.parser.v2.XSLException
public static java.util.Map parsePI(org.w3c.dom.ProcessingInstruction pi) throws org.xml.sax.SAXException
ProcessingInstruction
whose data contains
attribute/value pairs, return a Map
which contains
the attributes as keys and their corresponding values as values.
pi
- a processing instruction
Map
mapping processing instruction attributes
to values
org.xml.sax.SAXException
public static boolean getBooleanValue(java.lang.String value)
"true"
or "false"
) to a boolean
.
value
- String representation of a boolean value
true
if the string is not null
and
matches the string "true"
in a case-insensitive comparisonpublic static int getVersionMajor(java.lang.String version)
"3.2.1"
would return the integer 3
.
version
- a version number string, e.g. "3.2.1"
java.lang.NumberFormatException
- if the string does not contain a valid
integer major versionpublic static int compareVersions(java.lang.String version1, java.lang.String version2)
version1
- First version number string to compare. Should consist
of decimal characters separated by dots, e.g. "3.2.1".version2
- Second version number string to compare. Should consist
of decimal characters separated by dots, e.g. "3.2.1".
public static java.lang.String escapeXMLAttribute(java.lang.String text)
escapeForXMLAttribute
to properly escape attribute values
escapeForXMLAttribute(String)
escapeForXMLAttribute} unless you are really sure you want this behaviour.
text
- the String to escape
public static java.lang.String escapeXMLText(java.lang.String text)
escapeForXMLText
to properly escape XML text
escapeForXMLText
unless you are really sure you want this behaviour.
text
- the String to escape
public static java.lang.String escapeForXMLAttribute(java.lang.String text)
text
- the String to escape
public static java.lang.String escapeForXMLText(java.lang.String text)
text
- the String to escape
public static java.lang.String escapeXML(java.lang.String text, boolean isAttribute)
text
- the String to escapeisAttribute
- indicates if the text should be escaped for inclusion
as an attributes value. If false
then regular text
is assumed.
public static java.lang.String escapeXML(java.lang.String text, boolean isAttribute, boolean ignorePredefinedEnties)
text
- the String to escapeisAttribute
- indicates if the text should be escaped for inclusion
as an attributes value. If false
then regular text
is assumed.ignorePredefinedEnties
- flag indicating whether references to the
predefined XML entities (amp, lt, gt, apos, quot) in the text should
be ignored and not escaped
|
Oracle Fusion Middleware Java API Reference for Oracle PDK Java 11g Release 1 (11.1.1) E10691-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |