Package javax.xml.stream

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


                        writer.writeNamespace(prefix, nameSpaceName);
                        writer.setPrefix(prefix, nameSpaceName);
                    } else {
                        writer.writeStartElement(nameSpaceName,
                                element.getLocalName());
                        writer.writeDefaultNamespace(nameSpaceName);
                        writer.setDefaultNamespace(nameSpaceName);
                    }
                }
            } else {
                writer.writeStartElement(element.getLocalName());
View Full Code Here


                        //writer.writeNamespace(prefix, nameSpaceName);
                        writer.setPrefix(prefix, nameSpaceName);
                    } else {
                        writer.writeStartElement(nameSpaceName,
                                this.getLocalName());
                        writer.writeDefaultNamespace(nameSpaceName);
                        writer.setDefaultNamespace(nameSpaceName);
                    }
                }
            } else {
        writer.writeStartElement(this.getLocalName());
View Full Code Here

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

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

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

      writer.close();
View Full Code Here

    // of an incorrect usage of XMLStreamWriter#writeStartElement(String).
    private static void testSerializeDeserializeWrapped(Object bean, Object expectedResult) throws Exception {
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(sw);
        writer.writeStartElement("", "root", "urn:test");
        writer.writeDefaultNamespace("urn:test");
        ADBBeanUtil.serialize(bean, writer);
        writer.writeEndElement();
        writer.flush();
        OMElement omElement3 = OMXMLBuilderFactory.createOMBuilder(new StringReader(sw.toString())).getDocumentElement();
        assertBeanEquals(expectedResult, ADBBeanUtil.parse(bean.getClass(), omElement3.getFirstElement().getXMLStreamReader()));
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

  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

  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

            out.setOutputProperty(Serializer.Property.CDATA_SECTION_ELEMENTS, "{http://example.com/out}script");
            XMLStreamWriter writer = out.getXMLStreamWriter();
            try {
                writer.writeStartElement("doc");
                writer.writeAttribute("version", "8");
                writer.writeDefaultNamespace("http://example.com/out");
                writer.writeStartElement("heading");
                writer.writeCharacters("A Title");
                writer.writeEndElement(); // heading
                writer.writeEmptyElement("hr");
                writer.writeStartElement("script");
View Full Code Here

                        // writer.writeNamespace(prefix, nameSpaceName);
                        writer.setPrefix(prefix, nameSpaceName);
                    } else {
                        writer.writeStartElement(nameSpaceName, this
                                .getLocalName());
                        writer.writeDefaultNamespace(nameSpaceName);
                        writer.setDefaultNamespace(nameSpaceName);
                    }
                }
            } else {
                writer.writeStartElement(this.getLocalName());
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.