Package net.n3.nanoxml

Examples of net.n3.nanoxml.IXMLElement


    private XMLElement loadXML(final File file) throws ConfigureException {
        try {
            final FileReader r = new FileReader(file);
            try {
                StdXMLReader xr = new StdXMLReader(r);
                IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
                parser.setReader(xr);
                return (XMLElement) parser.parse();
            } finally {
                r.close();
View Full Code Here


     * @return a TestSetSpecification holding everything parsed.
     * @throws Exception
     */
    public TestSetSpecification parse(TestHarness harness, InputStream in, String base)
        throws Exception {
        StdXMLReader xr = new StdXMLReader(in);
        IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
        parser.setReader(xr);
        TestSetSpecification res;
        IXMLElement root = (IXMLElement) parser.parse();
        if (root.getName().equals("testSpec")) {
View Full Code Here

        // initialize the parser
        StdXMLParser parser = new StdXMLParser();
        parser.setBuilder(new StdXMLBuilder());
        parser.setValidator(new NonValidator());
        parser.setReader(new StdXMLReader(input));

        // get the data
        data = (XMLElement) parser.parse();

        // extract the spec to this specific panel instance
View Full Code Here

      parser.setBuilder(this.adapter);
      parser.setResolver(this.entityResolver);
      Reader reader = source.getCharacterStream();

      if (reader != null) {
         parser.setReader(new StdXMLReader(reader));
      } else {
         InputStream stream = source.getByteStream();

         if (stream != null) {
            String encoding = source.getEncoding();

            if (encoding != null) {
               try {
                  reader = new InputStreamReader(stream, encoding);
                  parser.setReader(new StdXMLReader(reader));
               } catch (UnsupportedEncodingException exception) {
                  throw new SAXException(exception);
               }
            } else { // if encoding == null
               parser.setReader(new StdXMLReader(stream));
            }
         } else { // if stream == null
            parser.setReader(new StdXMLReader(source.getPublicId(),
                                              source.getSystemId()));
         }
      }

      try {
View Full Code Here

      throws SAXException,
             IOException
   {
      IXMLParser parser = this.createParser();
      parser.setBuilder(this.adapter);
      parser.setReader(new StdXMLReader(null, systemId));

      try {
         parser.parse();
         this.adapter.endDocument();
      } catch (IOException exception) {
View Full Code Here

        // initialize the parser
        StdXMLParser parser = new StdXMLParser();
        parser.setBuilder(new StdXMLBuilder());
        parser.setValidator(new NonValidator());
        parser.setReader(new StdXMLReader(input));

        // get the data
        data = (XMLElement) parser.parse();

        // extract the spec to this specific panel instance
View Full Code Here

  }

  public XMLBeanWriter(Object bean) throws XMLException
  {
    super();
    _rootElement = new XMLElement(XMLConstants.ROOT_ELEMENT_NAME);
    if (bean != null)
    {
      addToRoot(bean);
    }
  }
View Full Code Here

    }
    catch (IntrospectionException ex)
    {
      throw new XMLException(ex);
    }
    elem = new XMLElement(name != null ? name : XMLConstants.BEAN_ELEMENT_NAME);
    if (info != null)
    {
      if (bean instanceof IXMLAboutToBeWritten)
      {
        ((IXMLAboutToBeWritten) bean).aboutToBeWritten();
      }
      PropertyDescriptor[] propDesc = info.getPropertyDescriptors();
      elem = new XMLElement(name != null ? name : XMLConstants.BEAN_ELEMENT_NAME);
      elem.setAttribute(XMLConstants.CLASS_ATTRIBUTE_NAME,
                      bean.getClass().getName());
      for (int i = 0; i < propDesc.length; ++i)
      {
        processProperty(propDesc[i], bean, elem);
View Full Code Here

        {
          final boolean isStringArray = returnType.getName().equals("[Ljava.lang.String;");
          Object[] props = (Object[]) getter.invoke(bean, (Object[])null);
          if (props != null)
          {
            IXMLElement indexElem = new XMLElement(propName);
            indexElem.setAttribute(XMLConstants.INDEXED, "true");
            beanElem.addChild(indexElem);
            for (int i = 0; i < props.length; ++i)
            {
              if (isStringArray)
              {
                StringWrapper sw = new StringWrapper((String)props[i]);
                indexElem.addChild(createElement(sw,
                      XMLConstants.BEAN_ELEMENT_NAME));
              }
              else
              {
                indexElem.addChild(createElement(props[i],
                        XMLConstants.BEAN_ELEMENT_NAME));
              }
            }
          }
        }
        else if (returnType == boolean.class
            || returnType == int.class
            || returnType == short.class
            || returnType == long.class
            || returnType == float.class
            || returnType == double.class
            || returnType == char.class)
        {
          IXMLElement propElem = new XMLElement(propName);
          propElem.setContent("" + getter.invoke(bean, (Object[])null));
          beanElem.addChild(propElem);
        }
        else if (returnType == String.class)
        {
          IXMLElement propElem = new XMLElement(propName);
          propElem.setContent((String) getter.invoke(bean, (Object[])null));
          beanElem.addChild(propElem);
        }
        else
        {
          beanElem.addChild(createElement(getter.invoke(bean, (Object[])null), propName));
View Full Code Here

        request.setHeaderField("Host", con.getHostHeaderValue()); //$NON-NLS-1$
        if (depth != null)
            request.setHeaderField("Depth", depth); //$NON-NLS-1$
        request.setHeaderField("Content-Type", "text/xml; charset=\"UTF-8\""); //$NON-NLS-1$ //$NON-NLS-2$

        IXMLElement root = new XMLElement(WebDAVConstants.PROPFIND_ELEM, WebDAVConstants.XML_DAV_NAMESPACE);
        root.addChild(new XMLElement(WebDAVConstants.ALLPROP_ELEM));

        StringWriter xml = new StringWriter();
        XMLWriter writer = new XMLWriter(xml);
        writer.write(root);
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.IXMLElement

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.