use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class Action method getArgumentList.
// //////////////////////////////////////////////
// argumentList
// //////////////////////////////////////////////
public ArgumentList getArgumentList() {
ArgumentList argumentList = new ArgumentList();
Node argumentListNode = getActionNode().getNode(ArgumentList.ELEM_NAME);
if (argumentListNode == null)
return argumentList;
int nodeCnt = argumentListNode.getNNodes();
for (int n = 0; n < nodeCnt; n++) {
Node node = argumentListNode.getNode(n);
if (Argument.isArgumentNode(node) == false)
continue;
Argument argument = new Argument(getServiceNode(), node);
argumentList.add(argument);
}
return argumentList;
}
use of org.cybergarage.xml.Node in project i2p.i2p by i2p.
the class JaxpParser method parse.
// //////////////////////////////////////////////
// parse (Node)
// //////////////////////////////////////////////
public org.cybergarage.xml.Node parse(org.cybergarage.xml.Node parentNode, org.w3c.dom.Node domNode, int rank) {
int domNodeType = domNode.getNodeType();
// if (domNodeType != Node.ELEMENT_NODE)
// return;
String domNodeName = domNode.getNodeName();
String domNodeValue = domNode.getNodeValue();
NamedNodeMap attrs = domNode.getAttributes();
int arrrsLen = (attrs != null) ? attrs.getLength() : 0;
if (domNodeType == org.w3c.dom.Node.TEXT_NODE) {
// Change to use Node::addValue() instead of the setValue(). (2008/02/07)
// parentNode.setValue(domNodeValue);
parentNode.addValue(domNodeValue);
return parentNode;
}
if (domNodeType != org.w3c.dom.Node.ELEMENT_NODE)
return parentNode;
org.cybergarage.xml.Node node = new org.cybergarage.xml.Node();
node.setName(domNodeName);
node.setValue(domNodeValue);
if (parentNode != null)
parentNode.addNode(node);
NamedNodeMap attrMap = domNode.getAttributes();
if (attrMap != null) {
int attrLen = attrMap.getLength();
// Debug.message("attrLen = " + attrLen);
for (int n = 0; n < attrLen; n++) {
org.w3c.dom.Node attr = attrMap.item(n);
String attrName = attr.getNodeName();
String attrValue = attr.getNodeValue();
node.setAttribute(attrName, attrValue);
}
}
org.w3c.dom.Node child = domNode.getFirstChild();
if (child == null) {
node.setValue("");
return node;
}
do {
parse(node, child, rank + 1);
child = child.getNextSibling();
} while (child != null);
return node;
}
use of org.cybergarage.xml.Node in project felix by apache.
the class BuildDevice method buildRootNode.
private static Node buildRootNode() {
Node root = new Node(RootDescription.ROOT_ELEMENT);
root.setAttribute("xmlns", RootDescription.ROOT_ELEMENT_NAMESPACE);
Node spec = new Node(RootDescription.SPECVERSION_ELEMENT);
Node maj = new Node(RootDescription.MAJOR_ELEMENT);
maj.setValue("1");
Node min = new Node(RootDescription.MINOR_ELEMENT);
min.setValue("0");
spec.addNode(maj);
spec.addNode(min);
root.addNode(spec);
return root;
}
use of org.cybergarage.xml.Node in project felix by apache.
the class BuildDevice method createCyberLinkDevice.
public static Device createCyberLinkDevice(ServiceReference sr) {
Node root = buildRootNode();
Device devUPnP = buildRootDeviceNode(root, sr);
return devUPnP;
}
use of org.cybergarage.xml.Node in project felix by apache.
the class BuildDevice method buildDevice.
private static void buildDevice(String id, Device parent, ServiceReference sr) {
Node dev = new Node(Device.ELEM_NAME);
DeviceData dd = new DeviceData();
dd.setDescriptionURI(id + "/gen-desc.xml");
dev.setUserData(dd);
Device devUPnP = new Device(dev);
devUPnP.setDeviceType(extractDeviceType(sr));
devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
devUPnP.setManufactureURL((String) sr.getProperty(UPnPDevice.MANUFACTURER_URL));
devUPnP.setModelDescription((String) sr.getProperty(UPnPDevice.MODEL_DESCRIPTION));
devUPnP.setModelName((String) sr.getProperty(UPnPDevice.MODEL_NAME));
devUPnP.setModelNumber((String) sr.getProperty(UPnPDevice.MODEL_NUMBER));
devUPnP.setModelURL((String) sr.getProperty(UPnPDevice.MODEL_URL));
devUPnP.setSerialNumber((String) sr.getProperty(UPnPDevice.SERIAL_NUMBER));
devUPnP.setUDN((String) sr.getProperty(UPnPDevice.UDN));
devUPnP.setUPC((String) sr.getProperty(UPnPDevice.UPC));
devUPnP.setLocation(id + "/gen-desc.xml");
addServices(id, devUPnP, sr);
addDevices(id, devUPnP, sr);
// twa: essential!!!!!!!
parent.addDevice(devUPnP);
devUPnP.setPresentationURL((String) sr.getProperty(UPnPDevice.PRESENTATION_URL));
}
Aggregations