Search in sources :

Example 51 with Node

use of org.cybergarage.xml.Node in project i2p.i2p by i2p.

the class Device method addService.

/**
 * Add a Service to device without checking for duplicate or syntax error
 *
 * @param s
 *            Add Service s to the Device
 */
public void addService(Service s) {
    Node serviceListNode = getDeviceNode().getNode(ServiceList.ELEM_NAME);
    if (serviceListNode == null) {
        serviceListNode = new Node(ServiceList.ELEM_NAME);
        getDeviceNode().addNode(serviceListNode);
    }
    serviceListNode.addNode(s.getServiceNode());
}
Also used : Node(org.cybergarage.xml.Node)

Example 52 with Node

use of org.cybergarage.xml.Node in project i2p.i2p by i2p.

the class Device method setURLBase.

private void setURLBase(String value) {
    if (isRootDevice() == true) {
        Node node = getRootNode().getNode(URLBASE_NAME);
        if (node != null) {
            node.setValue(value);
            return;
        }
        node = new Node(URLBASE_NAME);
        node.setValue(value);
        int index = 1;
        if (getRootNode().hasNodes() == false)
            index = 1;
        getRootNode().insertNode(node, index);
    }
}
Also used : Node(org.cybergarage.xml.Node)

Example 53 with Node

use of org.cybergarage.xml.Node in project i2p.i2p by i2p.

the class Device method addIcon.

public boolean addIcon(Icon icon) {
    Node deviceNode = getDeviceNode();
    if (deviceNode == null)
        return false;
    Node iconListNode = deviceNode.getNode(IconList.ELEM_NAME);
    if (iconListNode == null) {
        iconListNode = new Node(IconList.ELEM_NAME);
        deviceNode.addNode(iconListNode);
    }
    Node iconNode = new Node(Icon.ELEM_NAME);
    if (icon.getIconNode() != null) {
        iconNode.set(icon.getIconNode());
    }
    iconListNode.addNode(iconNode);
    if (icon.hasURL() && icon.hasBytes()) {
        iconBytesMap.put(icon.getURL(), icon.getBytes());
    }
    return true;
}
Also used : Node(org.cybergarage.xml.Node)

Example 54 with Node

use of org.cybergarage.xml.Node in project i2p.i2p by i2p.

the class SOAPRequest method print.

// //////////////////////////////////////////////
// print
// //////////////////////////////////////////////
public void print() {
    Debug.message(toString());
    if (hasContent() == true)
        return;
    Node rootElem = getRootNode();
    if (rootElem == null)
        return;
    Debug.message(rootElem.toString());
}
Also used : Node(org.cybergarage.xml.Node)

Example 55 with Node

use of org.cybergarage.xml.Node in project i2p.i2p by i2p.

the class SOAPResponse method print.

// //////////////////////////////////////////////
// print
// //////////////////////////////////////////////
public void print() {
    Debug.message(toString());
    if (hasContent() == true)
        return;
    Node rootElem = getRootNode();
    if (rootElem == null)
        return;
    Debug.message(rootElem.toString());
}
Also used : Node(org.cybergarage.xml.Node)

Aggregations

Node (org.cybergarage.xml.Node)58 ParserException (org.cybergarage.xml.ParserException)7 ArrayList (java.util.ArrayList)5 ServiceData (org.cybergarage.upnp.xml.ServiceData)5 Parser (org.cybergarage.xml.Parser)5 IOException (java.io.IOException)4 File (java.io.File)3 Device (org.cybergarage.upnp.Device)3 DeviceData (org.cybergarage.upnp.xml.DeviceData)3 UPnPDevice (org.osgi.service.upnp.UPnPDevice)3 URL (java.net.URL)2 Log (net.i2p.util.Log)2 InvalidDescriptionException (org.cybergarage.upnp.device.InvalidDescriptionException)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1