Package javax.xml.stream

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()


  public void encodeTagListToWriter(TagList theTagList, Writer theWriter) throws IOException {
    try {
      XMLStreamWriter eventWriter = createXmlWriter(theWriter);

      eventWriter.writeStartElement(TagList.ELEMENT_NAME_LC);
      eventWriter.writeDefaultNamespace(FHIR_NS);

      for (Tag next : theTagList) {
        eventWriter.writeStartElement(TagList.ATTR_CATEGORY);

        if (isNotBlank(next.getTerm())) {
View Full Code Here


  public void encodeBundleToWriter(Bundle theBundle, Writer theWriter) throws DataFormatException {
    try {
      XMLStreamWriter eventWriter = createXmlWriter(theWriter);

      eventWriter.writeStartElement("feed");
      eventWriter.writeDefaultNamespace(ATOM_NS);

      writeTagWithTextNode(eventWriter, "title", theBundle.getTitle());
      writeTagWithTextNode(eventWriter, "id", theBundle.getBundleId());

      writeAtomLink(eventWriter, "self", theBundle.getLinkSelf());
View Full Code Here

      xtw.writeStartDocument("UTF-8", "1.0");

      // start definitions root element
      xtw.writeStartElement("definitions");
      xtw.setDefaultNamespace(BPMN2_NAMESPACE);
      xtw.writeDefaultNamespace(BPMN2_NAMESPACE);
      xtw.writeNamespace(XSI_PREFIX, XSI_NAMESPACE);
      xtw.writeNamespace(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE);
      xtw.writeNamespace(BPMNDI_PREFIX, BPMNDI_NAMESPACE);
      xtw.writeNamespace(OMGDC_PREFIX, OMGDC_NAMESPACE);
      xtw.writeNamespace(OMGDI_PREFIX, OMGDI_NAMESPACE);
View Full Code Here

    StringWriter result = new StringWriter();
    XMLStreamWriter writer = createXmlStreamWriter(result);
    writer.setDefaultNamespace("http://some-namespace");
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeDefaultNamespace("http://some-namespace");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeEndDocument();
    writer.close();
    Assert.assertEquals("{\"alice\":{\"@xmlns\":\"http://some-namespace\",\"$\":\"bob\"}}", result.toString());
View Full Code Here

    StringWriter result = new StringWriter();
    XMLStreamWriter writer = createXmlStreamWriter(result, new QName("alice"));
    writer.setDefaultNamespace("http://some-namespace");
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeDefaultNamespace("http://some-namespace");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeEndDocument();
    writer.close();
    Assert.assertEquals("{\"@xmlns\":\"http://some-namespace\",\"$\":\"bob\"}", result.toString());
View Full Code Here

    StringWriter result = new StringWriter();
    XMLStreamWriter writer = createXmlStreamWriter(result, new QName("alice"));
    writer.setDefaultNamespace("http://some-namespace");
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeDefaultNamespace("http://some-namespace");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeEndDocument();
    writer.close();
    Assert.assertEquals("{\"@xmlns\":\"http://some-namespace\",\"$\":\"bob\"}", result.toString());
View Full Code Here

    StringWriter result = new StringWriter();
    XMLStreamWriter writer = new JsonXMLOutputFactory().createXMLStreamWriter(result);
    writer.setDefaultNamespace("http://some-namespace");
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeDefaultNamespace("http://some-namespace");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeEndDocument();
    writer.close();
    Assert.assertEquals("{\"alice\":{\"@xmlns\":\"http://some-namespace\",\"$\":\"bob\"}}", result.toString());
View Full Code Here

    StringWriter result = new StringWriter();
    XMLStreamWriter writer = new SimpleXMLStreamWriter(result, false);
    writer.setDefaultNamespace("http://some-namespace");
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeDefaultNamespace("http://some-namespace");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeEndDocument();
    writer.close();
    Assert.assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><alice xmlns=\"http://some-namespace\">bob</alice>", result.toString());
View Full Code Here

      //Sets the name space
      String nameSpace = getNameSpaceUri();
      writer.setDefaultNamespace( nameSpace );

      writer.writeStartElement( getDefaultElementName() );
      writer.writeDefaultNamespace( nameSpace );

      serialize( writer, object );
      writer.writeEndElement();

      writer.close();
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.