// Path: src/main/java/org/psidnell/omnifocus/model/Node.java
// public interface Node {
// 
//     String getName();
// 
//     void setName(String name);
// 
//     String getId();
// 
//     void setId(String id);
// 
//     int getRank();
// 
//     void setRank(int rank);
// 
//     String getType();
// 
//     boolean isRoot();
// 
//     boolean isMarked();
// 
//     void setMarked(boolean marked);
// 
//     void cascadeMarked();
// 
//     void setConfigParams(ConfigParams config);
// 
//     java.util.Date getDateAdded();
// 
//     void setDateAdded(java.util.Date date);
// 
//     org.psidnell.omnifocus.expr.Date getAdded();
// 
//     java.util.Date getDateModified();
// 
//     void setDateModified(java.util.Date date);
// 
//     org.psidnell.omnifocus.expr.Date getModified();
// }
// 
// Path: src/main/java/org/psidnell/omnifocus/util/IOUtils.java
// public class IOUtils {
// 
//     public static Writer systemOutWriter() {
//         return closeProofWriter(new OutputStreamWriter(System.out));
//     }
// 
//     public static Writer closeProofWriter(Writer out) {
//         return new Writer(out) {
//             @Override
//             public void close() throws IOException {
//                 // Don't want to close underlying writer
//             }
// 
//             @Override
//             public void write(char[] cbuf, int off, int len) throws IOException {
//                 out.write(cbuf, off, len);
//             }
// 
//             @Override
//             public void flush() throws IOException {
//                 out.flush();
//             }
//         };
//     }
// }


import java.io.IOException;
import java.io.Writer;
import org.psidnell.omnifocus.model.Node;
import org.psidnell.omnifocus.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
/*
 * Copyright 2015 Paul Sidnell
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.psidnell.omnifocus.format;




/**
 * @author psidnell
 *
 *         Formats the node by dumping the entire tree with Jackson.
 *
 */
public class XMLFormatter implements Formatter {

    private static final Logger LOGGER = LoggerFactory.getLogger(XMLFormatter.class);

    private static final XmlMapper MAPPER = new XmlMapper();

    @Override
// Path: src/main/java/org/psidnell/omnifocus/model/Node.java
// public interface Node {
// 
//     String getName();
// 
//     void setName(String name);
// 
//     String getId();
// 
//     void setId(String id);
// 
//     int getRank();
// 
//     void setRank(int rank);
// 
//     String getType();
// 
//     boolean isRoot();
// 
//     boolean isMarked();
// 
//     void setMarked(boolean marked);
// 
//     void cascadeMarked();
// 
//     void setConfigParams(ConfigParams config);
// 
//     java.util.Date getDateAdded();
// 
//     void setDateAdded(java.util.Date date);
// 
//     org.psidnell.omnifocus.expr.Date getAdded();
// 
//     java.util.Date getDateModified();
// 
//     void setDateModified(java.util.Date date);
// 
//     org.psidnell.omnifocus.expr.Date getModified();
// }
// 
// Path: src/main/java/org/psidnell/omnifocus/util/IOUtils.java
// public class IOUtils {
// 
//     public static Writer systemOutWriter() {
//         return closeProofWriter(new OutputStreamWriter(System.out));
//     }
// 
//     public static Writer closeProofWriter(Writer out) {
//         return new Writer(out) {
//             @Override
//             public void close() throws IOException {
//                 // Don't want to close underlying writer
//             }
// 
//             @Override
//             public void write(char[] cbuf, int off, int len) throws IOException {
//                 out.write(cbuf, off, len);
//             }
// 
//             @Override
//             public void flush() throws IOException {
//                 out.flush();
//             }
//         };
//     }
// }


// Path: src/main/java/org/psidnell/omnifocus/format/XMLFormatter.java
import java.io.IOException;
import java.io.Writer;
import org.psidnell.omnifocus.model.Node;
import org.psidnell.omnifocus.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;

/*
 * Copyright 2015 Paul Sidnell
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.psidnell.omnifocus.format;




/**
 * @author psidnell
 *
 *         Formats the node by dumping the entire tree with Jackson.
 *
 */
public class XMLFormatter implements Formatter {

    private static final Logger LOGGER = LoggerFactory.getLogger(XMLFormatter.class);

    private static final XmlMapper MAPPER = new XmlMapper();

    @Override
    public void format(Node node, Writer out) throws IOException {