Search in sources :

Example 21 with Node

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

the class Service method loadSCPD.

/**
 * @since 1.8.0
 */
public boolean loadSCPD(InputStream input) throws ParserException {
    Parser parser = UPnP.getXMLParser();
    Node scpdNode = parser.parse(input);
    if (scpdNode == null)
        return false;
    ServiceData data = getServiceData();
    data.setSCPDNode(scpdNode);
    return true;
}
Also used : Node(org.cybergarage.xml.Node) ServiceData(org.cybergarage.upnp.xml.ServiceData) Parser(org.cybergarage.xml.Parser)

Example 22 with Node

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

the class StateVariable method getStateVariableData.

// //////////////////////////////////////////////
// UserData
// //////////////////////////////////////////////
public StateVariableData getStateVariableData() {
    Node node = getStateVariableNode();
    StateVariableData userData = (StateVariableData) node.getUserData();
    if (userData == null) {
        userData = new StateVariableData();
        node.setUserData(userData);
        userData.setNode(node);
    }
    return userData;
}
Also used : Node(org.cybergarage.xml.Node) StateVariableData(org.cybergarage.upnp.xml.StateVariableData)

Example 23 with Node

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

the class SOAP method createEnvelopeBodyNode.

// //////////////////////////////////////////////
// createEnvelopeBodyNode
// //////////////////////////////////////////////
public static final Node createEnvelopeBodyNode() {
    // <Envelope>
    Node envNode = new Node(SOAP.XMLNS + SOAP.DELIM + SOAP.ENVELOPE);
    envNode.setAttribute("xmlns" + SOAP.DELIM + SOAP.XMLNS, SOAP.XMLNS_URL);
    envNode.setAttribute(SOAP.XMLNS + SOAP.DELIM + "encodingStyle", SOAP.ENCSTYLE_URL);
    // <Body>
    Node bodyNode = new Node(SOAP.XMLNS + SOAP.DELIM + SOAP.BODY);
    envNode.addNode(bodyNode);
    return envNode;
}
Also used : Node(org.cybergarage.xml.Node)

Example 24 with Node

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

the class SOAPRequest method postMessage.

// //////////////////////////////////////////////
// post
// //////////////////////////////////////////////
public SOAPResponse postMessage(String host, int port) {
    HTTPResponse httpRes = post(host, port);
    SOAPResponse soapRes = new SOAPResponse(httpRes);
    byte[] content = soapRes.getContent();
    if (content.length <= 0)
        return soapRes;
    try {
        ByteArrayInputStream byteIn = new ByteArrayInputStream(content);
        Parser xmlParser = SOAP.getXMLParser();
        Node rootNode = xmlParser.parse(byteIn);
        soapRes.setEnvelopeNode(rootNode);
    } catch (Exception e) {
        Debug.warning(e);
    }
    return soapRes;
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) HTTPResponse(org.cybergarage.http.HTTPResponse) Node(org.cybergarage.xml.Node) ParserException(org.cybergarage.xml.ParserException) Parser(org.cybergarage.xml.Parser)

Example 25 with Node

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

the class SOAPResponse method getMethodResponseNode.

public Node getMethodResponseNode(String name) {
    Node bodyNode = getBodyNode();
    if (bodyNode == null)
        return null;
    String methodResName = name + SOAP.RESPONSE;
    return bodyNode.getNodeEndsWith(methodResName);
}
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