diff options
author | Ade Lee <alee@redhat.com> | 2012-01-11 12:57:53 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-01-11 13:49:04 -0500 |
commit | 10cfe7756e967ac91c66d33b392aeab9cf3780fb (patch) | |
tree | d5ac9b58442265d2ce5ef60e31f041ddacba1b4f /pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java | |
parent | edcb24f65cc3700e75d0a1d14dc2483f210b0ee4 (diff) | |
download | pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.gz pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.xz pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.zip |
Formatting (no line wrap in comments or code)
Diffstat (limited to 'pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java')
-rw-r--r-- | pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java b/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java index a012f1a08..8890d79fe 100644 --- a/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java +++ b/pki/base/util/src/com/netscape/cmsutil/xml/XMLObject.java @@ -16,6 +16,7 @@ // All rights reserved. // --- END COPYRIGHT BLOCK --- package com.netscape.cmsutil.xml; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -43,8 +44,7 @@ import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.SAXException; -public class XMLObject -{ +public class XMLObject { private Document mDoc = null; public XMLObject() throws ParserConfigurationException { @@ -53,15 +53,15 @@ public class XMLObject mDoc = docBuilder.newDocument(); } - public XMLObject(InputStream s) - throws SAXException, IOException, ParserConfigurationException { + public XMLObject(InputStream s) + throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); mDoc = docBuilder.parse(s); } - public XMLObject(File f) - throws SAXException, IOException, ParserConfigurationException { + public XMLObject(File f) + throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); mDoc = docBuilder.parse(f); @@ -77,14 +77,14 @@ public class XMLObject public Node createRoot(String name) { Element root = mDoc.createElement(name); mDoc.appendChild(root); - return (Node)root; + return (Node) root; } public Node getRoot() { return mDoc.getFirstChild(); } - /** + /** * If you have duplicate containers, then this method will return the * first container in the list. */ @@ -98,7 +98,7 @@ public class XMLObject public Node createContainer(Node containerParent, String containerName) { Element node = mDoc.createElement(containerName); containerParent.appendChild(node); - return (Node)node; + return (Node) node; } public void addItemToContainer(Node container, String tagname, String value) { @@ -109,7 +109,7 @@ public class XMLObject } public String getValue(String tagname) { - Node n = getContainer(tagname); + Node n = getContainer(tagname); if (n != null) { NodeList c = n.getChildNodes(); @@ -125,7 +125,7 @@ public class XMLObject public Vector getAllValues(String tagname) { Vector v = new Vector(); NodeList nodes = mDoc.getElementsByTagName(tagname); - for (int i=0; i<nodes.getLength(); i++) { + for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); NodeList c = n.getChildNodes(); if (c.getLength() > 0) { @@ -141,7 +141,7 @@ public class XMLObject Vector v = new Vector(); NodeList c = container.getChildNodes(); int len = c.getLength(); - for (int i=0; i<len; i++) { + for (int i = 0; i < len; i++) { Node subchild = c.item(i); if (subchild.getNodeName().equals(tagname)) { NodeList grandchildren = subchild.getChildNodes(); @@ -166,8 +166,8 @@ public class XMLObject return bos.toByteArray(); } - public void output(OutputStream os) - throws TransformerConfigurationException, TransformerException { + public void output(OutputStream os) + throws TransformerConfigurationException, TransformerException { TransformerFactory tranFactory = TransformerFactory.newInstance(); Transformer aTransformer = tranFactory.newTransformer(); Source src = new DOMSource(mDoc); @@ -183,5 +183,5 @@ public class XMLObject transformer.transform(src, dest); String xmlString = dest.getWriter().toString(); return xmlString; - } + } } |