Examples of XMLElement


Examples of org.newdawn.slick.util.xml.XMLElement

   * @throws SlickException Indicates a failure
   */
  public static void main(String[] argv) throws SlickException {
    XMLParser parser = new XMLParser();
   
    XMLElement root = parser.parse("testdata/test.xml");
   
    assertEquals(root.getName(), "testRoot");
    System.out.println(root);
    assertNotNull(root.getChildrenByName("simple").get(0).getContent());
    System.out.println(root.getChildrenByName("simple").get(0).getContent());
   
    XMLElement parent = root.getChildrenByName("parent").get(0);
    assertEquals(parent.getChildrenByName("grandchild").size(),0);
    assertEquals(parent.getChildrenByName("child").size(),2);
   
    assertEquals(parent.getChildrenByName("child").get(0).getChildren().size(),2);
    XMLElement child = parent.getChildrenByName("child").get(0).getChildren().get(0);
   
    String name = child.getAttribute("name");
    String test = child.getAttribute("nothere","defaultValue");
    int age = child.getIntAttribute("age");
   
    assertEquals(name, "bob");
    assertEquals(test, "defaultValue");
    assertEquals(age, 1);
   
    XMLElement other = root.getChildrenByName("other").get(0);
    float x = (float) other.getDoubleAttribute("x");
    float y = (float) other.getDoubleAttribute("y", 1.0f);
    float z = (float) other.getDoubleAttribute("z", 83.0f);
   
    assertEquals(x, 5.3f);
    assertEquals(y, 5.4f);
    assertEquals(z, 83.0f);
   
    try {
      z = (float) other.getDoubleAttribute("z");
      fail("Attribute z as a double should fail");
    } catch (SlickException e) {
      // expect exception
    }
  }
View Full Code Here

Examples of org.one.stone.soup.xml.XmlElement

   
    try{
      InputStream iStream = socket.getInputStream();
      OutputStream oStream = socket.getOutputStream();
     
      XmlElement header = XmlLoader.getStandardParser().parseElement(iStream);
     
      if( sessions.get( header.getAttributeValueByName("id") )!=null )
      {
        socket.close();
        return null;
      }
     
      iStream.read();
      iStream.read();
     
      width = iStream.read();
      width = width << 8;
      width += iStream.read();
     
      height = iStream.read();
      height = height << 8;
      height += iStream.read();

      int frameSize = width*height;
      String sessionId = header.getAttributeValueByName("id");
     
      ScreenMulticaster multicaster = new ScreenMulticaster(socket,frameSize,sessionId,this);
     
      sessions.put( header.getAttributeValueByName("id"),multicaster );
     
      return header.getAttributeValueByName("id");
    }
    catch(Exception e)
    {
      e.printStackTrace();
     
View Full Code Here

Examples of org.opcfoundation.ua.builtintypes.XmlElement

            JAXBElement<?> jaxbElement = JAXBElement.class.cast(value);

            StringWriter sw = new StringWriter();
            marshaller.marshal(jaxbElement, sw);

            XmlElement xmlElement = new XmlElement(sw.toString());
            XmlDecoder xmlDecoder = new XmlDecoder(xmlElement, ENCODER_CONTEXT);
            Object o = xmlDecoder.getVariantContents();

            return new DataValue(new Variant(o));
        } catch (Throwable t) {
View Full Code Here

Examples of org.teiid.query.sql.symbol.XMLElement

        create.setElementSymbolsAsColumns(columns);
        helpTest("Create local TEMPORARY table tempTable (c1 varchar, c2 tinyint, c3 smallint, c4 real, c5 decimal)", "CREATE LOCAL TEMPORARY TABLE tempTable (c1 varchar, c2 tinyint, c3 smallint, c4 real, c5 decimal)", create); //$NON-NLS-1$
    }
   
    @Test public void testXmlElement() throws Exception {
      XMLElement f = new XMLElement("table", Arrays.asList((Expression)new Constant("x")));
      helpTestExpression("xmlelement(name \"table\", 'x')", "XMLELEMENT(NAME \"table\", 'x')", f);
    }
View Full Code Here

Examples of org.teiid.query.sql.symbol.XMLElement

      XMLElement f = new XMLElement("table", Arrays.asList((Expression)new Constant("x")));
      helpTestExpression("xmlelement(name \"table\", 'x')", "XMLELEMENT(NAME \"table\", 'x')", f);
    }

    @Test public void testXmlElement1() throws Exception {
      XMLElement f = new XMLElement("table", Arrays.asList((Expression)new Constant("x")));
      helpTestExpression("xmlelement(\"table\", 'x')", "XMLELEMENT(NAME \"table\", 'x')", f);
    }
View Full Code Here

Examples of org.teiid.query.sql.symbol.XMLElement

      XMLElement f = new XMLElement("table", Arrays.asList((Expression)new Constant("x")));
      helpTestExpression("xmlelement(\"table\", 'x')", "XMLELEMENT(NAME \"table\", 'x')", f);
    }
   
    @Test public void testXmlElementWithAttributes() throws Exception {
      XMLElement f = new XMLElement("y", new ArrayList<Expression>());
      f.setAttributes(new XMLAttributes(Arrays.asList(new DerivedColumn("val", new Constant("a")))));
      helpTestExpression("xmlelement(y, xmlattributes('a' as val))", "XMLELEMENT(NAME y, XMLATTRIBUTES('a' AS val))", f);
    }
View Full Code Here

Examples of org.xmlpull.infoset.XmlElement

            String valueString;
            if (value == null) {
                valueString = "";
            } else {
                if (value instanceof XmlElement) {
                    XmlElement valueElement = (XmlElement) value;
                    valueString = XMLUtil.xmlElementToString(valueElement);
                } else {
                    // Only string comes here for now.
                    valueString = value.toString();
                }
View Full Code Here

Examples of org.xmlpull.infoset.XmlElement

     */
    public Workflow getOGCEWorkflow(QName workflowTemplateId) throws RepositoryException, GraphException,
            ComponentException, Exception {
        AiravataAPI registry = connectToRegistry();
        String xml = registry.getWorkflowManager().getWorkflowAsString(workflowTemplateId.getLocalPart());
        XmlElement xwf = XMLUtil.stringToXmlElement(xml);
        Workflow workflow = new Workflow(xwf);
        return workflow;
    }
View Full Code Here

Examples of org.xmlpull.infoset.XmlElement

    public Workflow getWorkflow(QName qname) throws AiravataAPIInvocationException {
        AiravataAPI registry = connectToRegistry();
        String xml = registry.getWorkflowManager().getWorkflowAsString(qname.getLocalPart());
        Workflow workflow = null;
        try {
            XmlElement xwf = XMLUtil.stringToXmlElement(xml);
            workflow = new Workflow(xwf);
        } catch (GraphException e) {
            e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
        } catch (ComponentException e) {
            e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
View Full Code Here

Examples of org.xmlpull.infoset.XmlElement

            String valueString;
            if (value == null) {
                valueString = "";
            } else {
                if (value instanceof XmlElement) {
                    XmlElement valueElement = (XmlElement) value;
                    valueString = XMLUtil.xmlElementToString(valueElement);
                } else {
                    // Only string comes here for now.
                    valueString = value.toString();
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.