Package com.sun.xml.bind.marshaller

Examples of com.sun.xml.bind.marshaller.NamespacePrefixMapper


      }
      try
      {
         JAXBContext ctx = finder.findCacheContext(mediaType, annotations, set.toArray(new Class[set.size()]));
         Marshaller marshaller = ctx.createMarshaller();
         NamespacePrefixMapper mapper = new NamespacePrefixMapper()
         {
            public String getPreferredPrefix(String namespace, String s1, boolean b)
            {
               if (namespace.equals("http://www.w3.org/2005/Atom")) return "atom";
               else return s1;
View Full Code Here


      }
      try
      {
         JAXBContext ctx = finder.findCacheContext(mediaType, annotations, set.toArray(new Class[set.size()]));
         Marshaller marshaller = ctx.createMarshaller();
         NamespacePrefixMapper mapper = new NamespacePrefixMapper()
         {
            public String getPreferredPrefix(String namespace, String s1, boolean b)
            {
               if (namespace.equals("http://www.w3.org/2005/Atom")) return "atom";
               else return s1;
View Full Code Here

            mappings = Collections.emptyMap();
        }

        final Map<String, String> closedMappings = mappings;

        NamespacePrefixMapper mapper = new NamespacePrefixMapper() {
            @Override
            public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
                String prefix = closedMappings.get(namespaceUri);
                if (prefix != null) {
                    return prefix;
View Full Code Here

            mappings = Collections.emptyMap();
        }

        final Map<String, String> closedMappings = mappings;

        NamespacePrefixMapper mapper = new NamespacePrefixMapper() {
            @Override
            public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
                String prefix = closedMappings.get(namespaceUri);
                if (prefix != null) {
                    return prefix;
View Full Code Here

            mappings = Collections.emptyMap();
        }

        final Map<String, String> closedMappings = mappings;

        NamespacePrefixMapper mapper = new NamespacePrefixMapper() {
            @Override
            public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
                String prefix = closedMappings.get(namespaceUri);
                if (prefix != null) {
                    return prefix;
View Full Code Here

    public Marshaller getContext(Class<?> aClass) {
        try {
            JAXBContext context = contextResolver.getContext();
            Marshaller marshaller = context.createMarshaller();
            NamespacePrefixMapper namespaceMapper = new NamespacePrefixMapper() {

                /**
                 * Returns a preferred prefix for the given namespace URI.
                 *
                 * This method is intended to be overrided by a derived class.
View Full Code Here

            mappings = Collections.emptyMap();
        }

        final Map<String, String> closedMappings = mappings;

        NamespacePrefixMapper mapper = new NamespacePrefixMapper() {
            @Override
            public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
                String prefix = closedMappings.get(namespaceUri);
                if (prefix != null) {
                    return prefix;
View Full Code Here

        assertTrue(xmlResult.contains("ns3:string2"));
    }
   
    @Test
    public void testCustomNamespaces() throws Exception {
        NamespacePrefixMapper mapper = new NamespacePrefixMapper() {

            @Override
            public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
                if ("http://apache.org/hello_world_soap_http/types".equals(namespaceUri)) {
                    return "Omnia";
View Full Code Here

    public Marshaller getContext(Class<?> aClass) {
        try {
            JAXBContext context = contextResolver.getContext();
            Marshaller marshaller = context.createMarshaller();
            NamespacePrefixMapper namespaceMapper = new NamespacePrefixMapper() {

                /**
                 * Returns a preferred prefix for the given namespace URI.
                 *
                 * This method is intended to be overrided by a derived class.
View Full Code Here

    }
   
    @Test
    public void testCustomNamespaces() throws Exception {
        Map<String, Object> marshallProps = new HashMap<String, Object>();
        NamespacePrefixMapper mapper = new NamespacePrefixMapper() {

            @Override
            public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) {
                if ("http://apache.org/hello_world_soap_http/types".equals(namespaceUri)) {
                    return "Omnia";
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.marshaller.NamespacePrefixMapper

Copyright © 2018 www.massapicom. 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.