Tabnine Logo
JDOMWriter
Code IndexAdd Tabnine to your IDE (free)

How to use
JDOMWriter
in
org.jibx.extras

Best Java code snippets using org.jibx.extras.JDOMWriter (Showing top 11 results out of 315)

origin: org.jibx/jibx-extras

public void startTagClosed(int index, String name) throws IOException {
  startTagOpen(index, name);
  closeStartTag();
}
origin: org.jibx/jibx-extras

public void closeEmptyTag() throws IOException {
  incrementNesting();
  decrementNesting();
  this.currentElement = this.currentElement.getParentElement();
}
origin: org.jibx/jibx-extras

public void startTagNamespaces(int index, String name, int[] nums, String[] prefs) throws IOException {
  // find the namespaces actually being declared
  int[] deltas = openNamespaces(nums, prefs);
  
  // create the start tag for element
  startTagOpen(index, name);
  
  // add namespace declarations to open element
  for (int i = 0; i < deltas.length; i++) {
    int slot = deltas[i];
    this.currentElement.addNamespaceDeclaration(getNamespace(slot));
  }
}
origin: org.jibx.schema.ws/org.jibx.schema.ws.utilities

/**
 * Marshal this message to DOM.
 * @param message
 * @return DOM tree
 */
public static Element marshalObjectToDOM(Object message)
{
  try {
    IBindingFactory jc = BindingDirectory.getFactory(message.getClass());
    IMarshallingContext marshaller = jc.createMarshallingContext();
    String[] namespaces = jc.getNamespaces();
    JDOMWriter jdomWriter = new JDOMWriter(namespaces);
    marshaller.setXmlWriter(jdomWriter);
    marshaller.marshalDocument(message);
    marshaller.endDocument();
    
    org.jdom.Document jdoc = jdomWriter.getDocument();
    DOMOutputter dout = new DOMOutputter();
    Document doc = dout.output(jdoc);
    Element node = doc.getDocumentElement();
    
    return node;
  } catch (JiBXException e) {
    e.printStackTrace();
  } catch (JDOMException e) {
    e.printStackTrace();
  }
  return null;
}
/**
origin: org.jibx/jibx-extras

  /**
   * This will retrieve (if in existence) or create (if not) a 
   * <code>Namespace</code> for the supplied namespace index.
   */
  private Namespace getNamespace(int index) {
    String prefix = getNamespacePrefix(index);
    String uri = getNamespaceUri(index);
    if(prefix == null) {
      return Namespace.getNamespace(uri);
    } else {
      return Namespace.getNamespace(prefix, uri);
    }
  }
}
origin: org.jibx/jibx-extras

public void startTagOpen(int index, String name) throws IOException {
  Element newElement = new Element(name, getNamespace(index));
  
  if(this.currentElement == null) {
    this.document.setRootElement(newElement);
  } else {
    this.currentElement.addContent(newElement);
  }
  
  this.currentElement = newElement;
}
origin: org.jibx/jibx-extras

/**
 * Creates a new instance with the given namespace URIs.
 * @param namespaces namespaces
 */
public JDOMWriter(String[] namespaces) {
  super(namespaces);
  reset();
}

origin: org.jibx/jibx-extras

public void closeStartTag() throws IOException {
  incrementNesting();
}
origin: org.jibx/jibx-extras

public void endTag(int index, String name) throws IOException {
  decrementNesting();
  this.currentElement = this.currentElement.getParentElement();
}
origin: org.jibx.schema.org.opentravel._2012A.ws/org.jibx.schema.org.opentravel.ws.client.test

/**
 * Marshal this message to DOM.
 * @param message
 * @return DOM tree
 */
public static Element marshalObjectToDOM(Object message)
{
  try {
    IBindingFactory jc = BindingDirectory.getFactory(message.getClass());
    IMarshallingContext marshaller = jc.createMarshallingContext();
    String[] namespaces = jc.getNamespaces();
    JDOMWriter jdomWriter = new JDOMWriter(namespaces);
    marshaller.setXmlWriter(jdomWriter);
    marshaller.marshalDocument(message);
    marshaller.endDocument();
    
    org.jdom.Document jdoc = jdomWriter.getDocument();
    DOMOutputter dout = new DOMOutputter();
    Document doc = dout.output(jdoc);
    Element node = doc.getDocumentElement();
    
    return node;
  } catch (JiBXException e) {
    e.printStackTrace();
  } catch (JDOMException e) {
    e.printStackTrace();
  }
  return null;
}
/**
origin: org.jibx/jibx-extras

public void addAttribute(int index, String name, String value)
    throws IOException {
  this.currentElement.setAttribute(name, value, getNamespace(index));
}
org.jibx.extrasJDOMWriter

Javadoc

JDOM implementation of XML writer interface. The Document that is created can be accessed by using getDocument().

Most used methods

  • <init>
    Creates a new instance with the given Element as target for marshalling.
  • getDocument
  • closeStartTag
  • decrementNesting
  • getNamespace
    This will retrieve (if in existence) or create (if not) aNamespace for the supplied namespace index.
  • getNamespacePrefix
  • getNamespaceUri
  • incrementNesting
  • openNamespaces
  • reset
  • startTagOpen
  • startTagOpen

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JCheckBox (javax.swing)
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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