Package org.exist.dom

Examples of org.exist.dom.DocumentAtExist


      XMLReader reader = parser.getXMLReader();
      SAXAdapter adapter = new SAXAdapter();
      reader.setContentHandler(adapter);
      reader.parse(src);
   
      DocumentAtExist document = (DocumentAtExist) adapter.getDocument();
//      document.setContext(new XSLContext(broker));
      //return receiver.getDocument();
      return compile((ElementAtExist) document.getDocumentElement(), broker);
    } catch (ParserConfigurationException e) {
          LOG.debug(e);
      throw new XPathException(e);
    } catch (SAXException e) {
          LOG.debug(e);
View Full Code Here


   */
  public NodeList getChildNodes() {
    if (nl != null)
      return nl;
   
    DocumentAtExist document = getDocumentAtExist();
   
    nl = new NodeListImpl();
    int nextNode = document.getFirstChildFor(getNodeNumber());
    while (nextNode > getNodeNumber()) {
      NodeAtExist n = document.getNode(nextNode);

      if (n instanceof ElementAtExist) {
        n = new XSLElement((ElementAtExist) n);
      }
     
      nl.add(n);
            nextNode = document.getNextNodeNumber(nextNode);
        }
    return nl;
  }
View Full Code Here

        if (conf != null) {
            return conf;
        }

        //XXX: locking required
        DocumentAtExist document = null;
        try {
            document = collection.getDocument(broker, fileURL);
           
        } catch (final PermissionDeniedException pde) {
            throw new ConfigurationException(pde.getMessage(), pde);
        }
       
        if (document == null) {
            if (broker.isReadOnly()) {
                //database in read-only mode & there no configuration file,
                //create in memory document & configuration
                try {
                    final StringWriter writer = new StringWriter();
                    final SAXSerializer serializer = new SAXSerializer(writer, null);
                    serializer.startDocument();
                    serialize(instance, serializer);
                    serializer.endDocument();
                    final String data = writer.toString();
                    if (data == null || data.length() == 0) {
                        return null;
                    }
                    return parse(new ByteArrayInputStream(data.getBytes(UTF_8)));
                   
                } catch (final SAXException saxe) {
                    throw new ConfigurationException(saxe.getMessage(), saxe);
                }
            }
           
            try {
                document = save(instance, broker, collection, fileURL);
               
            } catch (final IOException e) {
                LOG.error(e.getMessage(), e);
                //TODO : throw exception ? -pb
                return null;
            }
        }
       
        if (document == null) {
            return null; //possibly on corrupted database, find better solution (recovery flag?)
        }
       
        final ElementAtExist confElement = (ElementAtExist) document.getDocumentElement();
        if (confElement == null) {
            return null; //possibly on corrupted database, find better solution (recovery flag?)
        }
       
        conf = new ConfigurationImpl(confElement);
View Full Code Here

TOP

Related Classes of org.exist.dom.DocumentAtExist

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.