Package org.infoset.xml

Examples of org.infoset.xml.ItemConstructor.createDocument()


            try {
               Iterator<RemoteApp> apps = db.getRemoteApps();
               Writer out = new OutputStreamWriter(os,"UTF-8");
               ItemDestination dest = new WriterItemDestination(out,"UTF-8");
               ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
               dest.send(constructor.createDocument());
               dest.send(constructor.createElement(AdminXML.NM_APPS));
               while (apps.hasNext()) {
                  RemoteApp app = apps.next();
                  app.marshall();;
                  DocumentSource.generate(app.getElement(),false,dest);
View Full Code Here


            try {
               Iterator<SyncTarget> targets = db.getSyncTargets();
               Writer out = new OutputStreamWriter(os,"UTF-8");
               ItemDestination dest = new WriterItemDestination(out,"UTF-8");
               ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
               dest.send(constructor.createDocument());
               dest.send(constructor.createElement(AdminXML.NM_TARGETS));
               while (targets.hasNext()) {
                  SyncTarget target = targets.next();
                  target.marshall();
                  DocumentSource.generate(target.getElement(),false,dest);
View Full Code Here

      throws XMLException
   {
      String baseURIValue = baseURI.toString();
      URI baseDir = URI.create(baseURIValue.substring(0,baseURIValue.lastIndexOf('/')+1));
      ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
      dest.send(constructor.createDocument(baseURI));
      Element top = constructor.createElement(AdminXML.NM_SERVER);
      if (autoconfCheck!=((long)(180*1000))) {
         top.setAttributeValue("autoconf-check",Long.toString(autoconfCheck/1000));
      }
      dest.send(top);
View Full Code Here

      if (obj instanceof XMLObject) {
         OutputStreamWriter w = new OutputStreamWriter(os,getCharacterSet().toString());
         try {
            WriterItemDestination dest = new WriterItemDestination(w,getCharacterSet().toString());
            ItemConstructor constructor =InfosetFactory.getDefaultInfoset().createItemConstructor();
            dest.send(constructor.createDocument());
            ((XMLObject)obj).generate(constructor, dest,contents);
            dest.send(constructor.createDocumentEnd());
         } catch (XMLException ex) {
            throw new IOException(ex.getMessage());
         }
View Full Code Here

         }
         getContext().getLogger().info("Backing up to file "+outFile.getAbsolutePath());
         OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(outFile),"UTF-8");
         ItemDestination dest = new WriterItemDestination(w,"UTF-8");
         ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor(outFile.toURI());
         dest.send(constructor.createDocument(outFile.toURI()));
         dest.send(constructor.createElement(XML.DATABASE_NAME));
         dest.send(constructor.createCharacters("\n"));
         dest.send(constructor.createElement(XML.PERMISSIONS_NAME));
         dest.send(constructor.createCharacters("\n"));
         Iterator<Permission> permissions = db.getPermissions();
View Full Code Here

  
   public static Document createFeedDocument(String title,UUID id,Date created)
      throws XMLException
   {
      ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
      Document doc = constructor.createDocument();
      Element top = doc.createDocumentElement(AtomResource.FEED_NAME);
      top.addNamespaceBinding("app",APP_NAMESPACE);
      top.addElement(TITLE_NAME).addCharacters(title);
      top.addElement(ID_NAME).addCharacters("urn:uuid:"+id.toString());
      String dateString = toXSDDate(created);
View Full Code Here

  
   public static Document createEntryDocument(String title,UUID id,Date created,String authorName)
      throws XMLException
   {
      ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
      Document doc = constructor.createDocument();
      Element top = doc.createDocumentElement(AtomResource.ENTRY_NAME);
      top.addElement(TITLE_NAME).addCharacters(title);
      top.addElement(ID_NAME).addCharacters("urn:uuid:"+id.toString());
      String dateString = toXSDDate(created);
      top.addElement(PUBLISHED_NAME).addCharacters(dateString);
View Full Code Here

   public void generate(ItemDestination dest,String value)
      throws XMLException
   {
      //getContext().getLogger().info("Generating feed for term "+term);
      ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
      dest.send(constructor.createDocument());
      dest.send(constructor.createElement(AtomResource.FEED_NAME));
      dest.send(constructor.createCharacters("\n"));
      link(constructor,dest,"self",getRequest().getResourceRef().toString());
      dest.send(constructor.createCharacters("\n"));
      text(constructor,dest,AtomResource.TITLE_NAME,"Term "+term);
View Full Code Here

  
   public static void toXML(User user,ItemDestination dest)
      throws XMLException
   {
      ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
      dest.send(constructor.createDocument());
      Element userE = constructor.createElement(NM_USER);
      userE.setAttributeValue("alias",user.getAlias());
      userE.setAttributeValue("id",user.getId().toString());
      dest.send(userE);
      if (user.getName()!=null) {
View Full Code Here

   public void getIntrospection(Storage storage,String xmlBase,String basePath,CollectionLocator locator,ItemDestination dest)
      throws SQLException,IOException,XMLException
   {
      Iterator<Feed> feeds = getFeeds();
      ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
      dest.send(constructor.createDocument());
      Element service = constructor.createElement(XML.SERVICE);
      service.addNamespaceBinding(Name.NO_PREFIX,AtomResource.APP_NAMESPACE);
      service.addNamespaceBinding("atom",AtomResource.ATOM_NAMESPACE);
      if (xmlBase!=null) {
         service.setBaseURI(URI.create(xmlBase));
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.