|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.scrplugin.xml.IOUtils
public class IOUtils
Utility class for xml/sax handling. It provides support for "older" sax implementations (like the default one shipped with JDK 1.4.2) which have bugs in the namespace handling.
Nested Class Summary | |
---|---|
static class |
IOUtils.NamespaceAsAttributes
A pipe that ensures that all namespace prefixes are also present as 'xmlns:' attributes. |
Constructor Summary | |
---|---|
IOUtils()
|
Method Summary | |
---|---|
protected static void |
addAttribute(AttributesImpl ai,
String name,
Object value)
Helper method to add an attribute. |
static ContentHandler |
getSerializer(File file)
|
protected static void |
indent(ContentHandler ch,
int level)
Helper method to indent the xml elements. |
protected static boolean |
needsNamespacesAsAttributes(Properties format)
Checks if the used Trax implementation correctly handles namespaces set using startPrefixMapping() , but wants them also as 'xmlns:' attributes. |
protected static void |
newline(ContentHandler ch)
Helper method to create a new line. |
static void |
parse(InputStream file,
ContentHandler handler)
Parse a file and send the sax events to the content handler. |
protected static void |
text(ContentHandler ch,
String text)
Helper method writing out a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IOUtils()
Method Detail |
---|
public static final void parse(InputStream file, ContentHandler handler) throws TransformerException
file
- handler
-
TransformerException
public static ContentHandler getSerializer(File file) throws IOException, TransformerException
IOException
TransformerException
protected static boolean needsNamespacesAsAttributes(Properties format) throws TransformerException, SAXException
startPrefixMapping()
, but wants them also as 'xmlns:' attributes.
The check consists in sending SAX events representing a minimal namespaced document
with namespaces defined only with calls to startPrefixMapping
(no
xmlns:xxx attributes) and check if they are present in the resulting text.
TransformerException
SAXException
protected static void addAttribute(AttributesImpl ai, String name, Object value)
ai
- The attributes impl receiving the additional attribute.name
- The name of the attribute.value
- The value of the attribute.protected static void text(ContentHandler ch, String text) throws SAXException
ch
- The content handler.text
-
SAXException
protected static void indent(ContentHandler ch, int level) throws SAXException
ch
- The content handler.level
- The level of indention.
SAXException
protected static void newline(ContentHandler ch) throws SAXException
ch
- The content handler.
SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |