congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ToXmlContentHandler
Code IndexAdd Tabnine to your IDE (free)

How to use
ToXmlContentHandler
in
org.apache.jackrabbit.commons.xml

Best Java code snippets using org.apache.jackrabbit.commons.xml.ToXmlContentHandler (Showing top 20 results out of 315)

origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Escapes and outputs the given characters.
 */
public void ignorableWhitespace(char[] ch, int start, int length)
    throws SAXException {
  characters(ch, start, length);
}
origin: apache/jackrabbit

/**
 * Escapes and outputs the given characters.
 */
public void characters(char[] ch, int start, int length)
    throws SAXException {
  closeStartTagIfOpen();
  write(ch, start, length, false);
}
origin: apache/jackrabbit

/**
 * Starts the XML serialization by outputting the <?xml?> header.
 */
public void startDocument() throws SAXException {
  processingInstruction("xml", declaration);
}
origin: org.onehippo.cms7/hippo-repository-engine

@Override
public void exportDocumentView(String absPath, OutputStream out, boolean binaryAsLink, boolean noRecurse)
    throws IOException, PathNotFoundException, RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(out);
    exportDocumentView(absPath, handler, binaryAsLink, noRecurse);
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException("Error serializing document view XML", e);
    }
  }
}
origin: apache/jackrabbit

/**
 * Serializes a processing instruction.
 */
public void processingInstruction(String target, String data)
    throws SAXException {
  closeStartTagIfOpen();
  try {
    writer.write("<?");
    writer.write(target);
    if (data != null) {
      writer.write(" ");
      writer.write(data);
    }
    writer.write("?>");
  } catch (IOException e) {
    throw new SAXException(
        "Failed to output XML processing instruction: " + target, e);
  }
}
origin: org.onehippo.jcr.console/hippo-jcr-console-api

  @Override
  public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
    if (rootStarted) {
      super.startElement(uri, localName, qName, attributes);
    } else if (usedNamespaceURISet == null) {
      super.startElement(uri, localName, qName, attributes);
      rootStarted = true;
    } else {
      Set<String> ignoringQNameSet = new HashSet<String>();
      for (int i = 0; i < attributes.getLength(); i++) {
        String attrQName = attributes.getQName(i);
        if (attrQName.startsWith("xmlns:") && !"xmlns:sv".equals(attrQName)) {
          String namespaceURI = attributes.getValue(i);
          if (!usedNamespaceURISet.contains(namespaceURI)) {
            ignoringQNameSet.add(attributes.getQName(i));
          }
        }
      }
      FilteredOutDelegatingAttributes filteredOutAttributes = new FilteredOutDelegatingAttributes(attributes, ignoringQNameSet);
      super.startElement(uri, localName, qName, filteredOutAttributes);
      rootStarted = true;
    }
  }
};
origin: apache/jackrabbit-oak

@Override
public void exportDocumentView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new DocumentViewExporter(this,
        handler, !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing document view XML", e);
    }
  }
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Serializes a processing instruction.
 */
public void processingInstruction(String target, String data)
    throws SAXException {
  closeStartTagIfOpen();
  try {
    writer.write("<?");
    writer.write(target);
    if (data != null) {
      writer.write(" ");
      writer.write(data);
    }
    writer.write("?>");
  } catch (IOException e) {
    throw new SAXException(
        "Failed to output XML processing instruction: " + target, e);
  }
}
origin: apache/jackrabbit-oak

@Override
public void exportSystemView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new SystemViewExporter(this, handler,
        !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing system view XML", e);
    }
  }
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Escapes and outputs the given characters.
 */
public void characters(char[] ch, int start, int length)
    throws SAXException {
  closeStartTagIfOpen();
  write(ch, start, length, false);
}
origin: apache/jackrabbit

/**
 * Escapes and outputs the given characters.
 */
public void ignorableWhitespace(char[] ch, int start, int length)
    throws SAXException {
  characters(ch, start, length);
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Starts the XML serialization by outputting the &lt;?xml?&gt; header.
 */
public void startDocument() throws SAXException {
  processingInstruction("xml", declaration);
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Serializes a processing instruction.
 */
public void processingInstruction(String target, String data)
    throws SAXException {
  closeStartTagIfOpen();
  try {
    writer.write("<?");
    writer.write(target);
    if (data != null) {
      writer.write(" ");
      writer.write(data);
    }
    writer.write("?>");
  } catch (IOException e) {
    throw new SAXException(
        "Failed to output XML processing instruction: " + target, e);
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void exportDocumentView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new DocumentViewExporter(this,
        handler, !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing document view XML", e);
    }
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Escapes and outputs the given characters.
 */
public void characters(char[] ch, int start, int length)
    throws SAXException {
  closeStartTagIfOpen();
  write(ch, start, length, false);
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Escapes and outputs the given characters.
 */
public void ignorableWhitespace(char[] ch, int start, int length)
    throws SAXException {
  characters(ch, start, length);
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Starts the XML serialization by outputting the &lt;?xml?&gt; header.
 */
public void startDocument() throws SAXException {
  processingInstruction("xml", declaration);
}
origin: org.apache.jackrabbit/oak-jcr

@Override
public void exportSystemView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new SystemViewExporter(this, handler,
        !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing system view XML", e);
    }
  }
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Outputs the specified start tag with the given attributes.
 */
public void startElement(
    String namespaceURI, String localName, String qName,
    Attributes atts) throws SAXException {
  closeStartTagIfOpen();
  try {
    writer.write("<");
    writer.write(qName);
    for (int i = 0; i < atts.getLength(); i++) {
      writer.write(" ");
      writer.write(atts.getQName(i));
      writer.write("=\"");
      char[] ch = atts.getValue(i).toCharArray();
      write(ch, 0, ch.length, true);
      writer.write("\"");
    }
    startTagIsOpen = true;
  } catch (IOException e) {
    throw new SAXException(
        "Failed to output XML end tag: " + qName, e);
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void exportSystemView(String absPath, OutputStream out,
    boolean skipBinary, boolean noRecurse) throws IOException,
    RepositoryException {
  try {
    ContentHandler handler = new ToXmlContentHandler(checkNotNull(out));
    export(checkNotNull(absPath), new SystemViewExporter(this, handler,
        !noRecurse, !skipBinary));
  } catch (SAXException e) {
    Exception exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new RepositoryException(
          "Error serializing system view XML", e);
    }
  }
}
org.apache.jackrabbit.commons.xmlToXmlContentHandler

Javadoc

Simple XML serializer. This content handler serializes the received SAX events as XML to a given Writer or OutputStream. The serialization assumes that the incoming SAX events are well-formed, i.e. that all elements are properly nested, that element and attribute names are valid and that no invalid XML characters are included. Assuming these preconditions are met, the result will be a well-formed XML stream.

This serializer does not have any special support for namespaces. For example, namespace prefixes are declared in the resulting XML stream if and only if the corresponding "xmlns" attributes are explicitly included in the Attributes instances passed in #startElement(String,String,String,Attributes) calls.

As a convenience this class inherits the DefaultHandler class instead of just the ContentHandler interface. This makes it easier to pass instances of this class to methods like javax.xml.parsers.SAXParser#parse(String,DefaultHandler) that expect a DefaultHandler instance instead of a ContentHandler.

Most used methods

  • <init>
    Creates an XML serializer that writes the serialized XML stream to the given writer.
  • characters
    Escapes and outputs the given characters.
  • closeStartTagIfOpen
  • processingInstruction
    Serializes a processing instruction.
  • write
  • startElement
    Outputs the specified start tag with the given attributes.

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • getSharedPreferences (Context)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JTable (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now