Package org.cybergarage.xml

Examples of org.cybergarage.xml.Node


      String nodeName = "node";
      String nodeValue = "value";
      String nodeAttrName = "attr";
      String nodeAttrValue = "attrvalue";
     
      Node orgNode = new Node();
      orgNode.setName(nodeName);
      orgNode.setValue(nodeValue);
      orgNode.setAttribute(nodeAttrName, nodeAttrValue);
     
      Node newNode = new Node();
      newNode.set(orgNode);
      assertTrue(orgNode.equals(newNode));
      assertTrue(newNode.equals(orgNode));

      String oldNodeName = "oldnode";
      String oldNodeAttrName = "oldcattr";
      String oldNodeAttrValue = "oldcattrvalue";
      Node settedNode = new Node(oldNodeName);
      settedNode.setAttribute(oldNodeAttrName, oldNodeAttrValue);
      settedNode.set(orgNode);     
      assertTrue(orgNode.equals(settedNode));
      assertTrue(settedNode.equals(orgNode));
    }
View Full Code Here


      String childNodeName = "cnode";
      String childNodeValue = "cvalue";
      String nodeAttrName = "attr";
      String nodeAttrValue = "attrvalue";
     
      Node orgNode = new Node(nodeName);
      orgNode.setNode(childNodeName, childNodeValue);
      orgNode.setAttribute(nodeAttrName, nodeAttrValue);
     
      Node newNode = new Node();
      newNode.set(orgNode);     
      assertTrue(orgNode.equals(newNode));
      assertTrue(newNode.equals(orgNode));
     
      String oldNodeName = "oldnode";
      String oldNodeAttrName = "oldcattr";
      String oldNodeAttrValue = "oldcattrvalue";
      String oldChildNodeName = "oldcnode";
      String oldChildNodeValue = "oldcvalue";
      Node settedNode = new Node(oldNodeName);
      settedNode.setAttribute(oldNodeAttrName, oldNodeAttrValue);
      settedNode.setNode(oldChildNodeName, oldChildNodeValue);
      settedNode.set(orgNode);     
      assertTrue(orgNode.equals(settedNode));
      assertTrue(settedNode.equals(orgNode));
    }
View Full Code Here

  public static final String MAJOR_VALUE="1";
  public static final String MINOR="minor";
  public static final String MINOR_VALUE="0";
 
  public Service(){
    this(new Node(ELEM_NAME));
   
    Node sp = new Node(SPEC_VERSION);
   
    Node M =new Node(MAJOR);
    M.setValue(MAJOR_VALUE);
    sp.addNode(M);
       
    Node m =new Node(MINOR);
    m.setValue(MINOR_VALUE);
    sp.addNode(m);
   
    //Node scpd = new Node(SCPD_ROOTNODE,SCPD_ROOTNODE_NS); wrong!
    Node scpd = new Node(SCPD_ROOTNODE);
    scpd.addAttribute("xmlns",SCPD_ROOTNODE_NS);
    scpd.addNode(sp);
    getServiceData().setSCPDNode(scpd);
  }
View Full Code Here

  //  Device/Root Node
  ////////////////////////////////////////////////

  private Node getDeviceNode()
  {
    Node node = getServiceNode().getParentNode();
    if (node == null)
      return null;
    return node.getParentNode();
  }
View Full Code Here

  private final static String CONFIG_ID = "configId";
 
  public void updateConfigId()
  {
    Node scpdNode = getSCPDNode();
    if (scpdNode == null)
      return;
   
    String scpdXml = scpdNode.toString();
    int configId = UPnP.caluculateConfigId(scpdXml);
    scpdNode.setAttribute(CONFIG_ID, configId);
  }
View Full Code Here

    scpdNode.setAttribute(CONFIG_ID, configId);
  }

  public int getConfigId()
  {
    Node scpdNode = getSCPDNode();
    if (scpdNode == null)
      return 0;
    return scpdNode.getAttributeIntegerValue(CONFIG_ID);
  }
View Full Code Here

  public boolean loadSCPD(String scpdStr) throws InvalidDescriptionException
  {
    try {
      Parser parser = UPnP.getXMLParser();
      Node scpdNode = parser.parse(scpdStr);
      if (scpdNode == null)
        return false;
      ServiceData data = getServiceData();
      data.setSCPDNode(scpdNode);
    }
View Full Code Here

  }

  public boolean loadSCPD(File file) throws ParserException
  {
    Parser parser = UPnP.getXMLParser();
    Node scpdNode = parser.parse(file);
    if (scpdNode == null)
      return false;
   
    ServiceData data = getServiceData();
    data.setSCPDNode(scpdNode);
View Full Code Here

   * @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);
View Full Code Here

  }

  private Node getSCPDNode()
  {
    ServiceData data = getServiceData();
    Node scpdNode = data.getSCPDNode();
    if (scpdNode != null)
      return scpdNode;
   
    // Thanks for Jaap (Sep 18, 2010)
    Device rootDev = getRootDevice();
View Full Code Here

TOP

Related Classes of org.cybergarage.xml.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.