diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-20 17:01:09 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-20 17:01:09 +0000 |
commit | a7d404cd6db2724d36523e59c87c3007fa86a258 (patch) | |
tree | e938b10cccf606c062fdb4cf569b8245a83b8a37 /bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java | |
parent | c97c49eb4399829603816e4b3e47c74b67d0f27b (diff) | |
parent | ce598ba5142ff7673085dd90865f9323d69574be (diff) | |
download | mocca-1.0.2.tar.gz mocca-1.0.2.tar.bz2 mocca-1.0.2.zip |
[maven-release-plugin] copy for tag mocca-1.0.2mocca-1.0.2
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/tags/mocca-1.0.2@276 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java')
-rw-r--r-- | bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java index 6f41b562..d8295227 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java @@ -29,6 +29,7 @@ import javax.xml.transform.dom.DOMResult; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; +import org.w3c.dom.Node; import org.w3c.dom.NodeList; import at.buergerkarte.namespaces.securitylayer._1.Base64XMLContentType; @@ -56,7 +57,7 @@ public class InfoboxReadResultFileImpl extends SLResultImpl implements /**
* The XML document containing the infobox content.
*/
- Document xmlDocument;
+ protected Document xmlDocument;
/**
* Creates the response document from the given <code>binaryContent</code>.
@@ -95,7 +96,7 @@ public class InfoboxReadResultFileImpl extends SLResultImpl implements JAXBElement<InfoboxReadResponseType> infoboxReadResponse = factory.createInfoboxReadResponse(infoboxReadResponseType);
- JAXBContext context = SLCommandFactory.getJaxbContext();
+ JAXBContext context = SLCommandFactory.getInstance().getJaxbContext();
try {
Marshaller marshaller = context.createMarshaller();
marshaller.marshal(infoboxReadResponse, doc);
@@ -112,22 +113,42 @@ public class InfoboxReadResultFileImpl extends SLResultImpl implements /**
* @return an XMLResult for marshalling the infobox to
*/
- Result getXmlResult(boolean preserveSpace) {
+ public Result getXmlResult(boolean preserveSpace) {
xmlDocument = createResponseDocument(null, preserveSpace);
NodeList nodeList = xmlDocument.getElementsByTagNameNS(SLCommand.NAMESPACE_URI, "XMLContent");
return new DOMResult(nodeList.item(0));
- }
-
+ } + + /** + * Creates a new <code>InfoboxReadResponse</code> document and appends + * the given <code>node</code> as child node of the <code>XMLContent</code> element. + * + * @param node the node to be appended as child node of the <code>XMLContnet</code> element + * @param preserveSpace if <code>true</code> the value of the <code>XMLContent</code>'s <code>space</code> + * attribute is set to <code>preserve</code>. + */ + public void setResultXMLContent(Node node, boolean preserveSpace) { + + xmlDocument = createResponseDocument(null, preserveSpace); + + NodeList nodeList = xmlDocument.getElementsByTagNameNS(SLCommand.NAMESPACE_URI, "XMLContent"); + if (node.getOwnerDocument() != xmlDocument) { + node = xmlDocument.importNode(node, true); + } + nodeList.item(0).appendChild(node); + + } + /**
* Creates a new result document for this <code>InfoboxReadResult</code>
* and sets the given <code>resultBytes</code> as content.
*
* @param resultBytes
*/
- void setResultBytes(byte[] resultBytes) {
+ public void setResultBytes(byte[] resultBytes) {
xmlDocument = createResponseDocument(resultBytes, false);
|