Package nexj.core.rpc.soap

Examples of nexj.core.rpc.soap.SOAPUnmarshaller$Namespace


         }
      };

      try
      {
         List list = (List)new SOAPUnmarshaller(m_context).deserialize(reader);
         InstanceFactory factory = new InstanceFactory(InstanceFactory.STATE, m_context);

         for (int i = 0; i != list.size(); ++i)
         {
            factory.instantiate((TransferObject)list.get(i));
View Full Code Here


      System.err.println("XML vs. SOAP Unmarshaller Profiling Comparison");

      // --- XML test

      SOAPUnmarshaller unmarshaller =
         new XMLUnmarshaller(new InvocationContext(Repository.getMetadata()),
                             Repository.getMetadata());
     
      for (int i = 0; i < nWarmup; ++i)
      {
         unmarshaller.deserialize(new StringReader(xmlOut.toString()));
      }
     
      long lStartTime = System.currentTimeMillis();
     
      for (int i = 0; i < nIterations; ++i)
      {
         unmarshaller.deserialize(new StringReader(xmlOut.toString()));
      }

      long lEndTime = System.currentTimeMillis();     
      long nSizeXML = xmlOut.toString().length();
      long nTotalTimeXML = lEndTime - lStartTime;

      System.err.println("Run: " + nIterations + " iterations in: " + nTotalTimeXML/(double)1000 +
                         " sec");
      System.err.println("XML Time: " + nTotalTimeXML/(double)nIterations + " ms");
      System.err.println("XML Size: " + nSizeXML + " chars");
      System.err.println("XML Unit: " + nTotalTimeXML/(double)nIterations/nSizeXML * 1000000 +
                         " ns/char");

      //--- SOAP test
      unmarshaller = new SOAPUnmarshaller(new InvocationContext(Repository.getMetadata()));
     
      for (int i = 0; i < nWarmup; ++i)
      {
         unmarshaller.deserialize(new StringReader(soapOut.toString()));
      }

      lStartTime = System.currentTimeMillis();
     
      for (int i = 0; i < nIterations; ++i)
      {
         unmarshaller.deserialize(new StringReader(soapOut.toString()));
      }

      lEndTime = System.currentTimeMillis();
      long nSizeSOAP = soapOut.toString().length();
      long nTotalTimeSOAP = lEndTime - lStartTime;
View Full Code Here

 
  @Test
  public void testOutputElementNamespaces() {
    String txt = "<ns:root xmlns:ns=\"myns\" xmlns:ans=\"attributens\" xmlns:two=\"two\" ans:att=\"val\"/>";
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    checkOutput(emt,
        txt, txt,txt, txt, txt);
  }
View Full Code Here

    }
   
    @Test
    public void testOutputDocumentNamespaces() {
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.addNamespaceDeclaration(ans);
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addContent(new Element("child", Namespace.getNamespace("", "childuri")));
    Document doc = new Document(emt);
View Full Code Here

    }
   
    @Test
    public void testRTOutputElementNamespaces() {
    Element emt = new Element("root", Namespace.getNamespace("ns", "myns"));
    Namespace ans = Namespace.getNamespace("ans", "attributens");
    emt.addNamespaceDeclaration(ans);
    emt.addNamespaceDeclaration(Namespace.getNamespace("two", "two"));
    emt.setAttribute(new Attribute("att", "val", ans));
    emt.addContent(new Element("child", Namespace.getNamespace("", "childns")));
    roundTripElement(emt);
View Full Code Here

      // if there is any printable content, or if expandempty is set
      // then we must expand.
      boolean expandit = walker != null || fstack.isExpandEmptyElements();
     
      if (expandit) {
        Namespace ns = element.getNamespace();
        if (ns == Namespace.NO_NAMESPACE) {
          out.writeStartElement(element.getName());
        } else if ("".equals(ns.getPrefix())) {
          out.writeStartElement(ns.getURI(), element.getName());
        } else {
          out.writeStartElement(ns.getPrefix(), element.getName(), ns.getURI());
        }
       
        // Print the element's namespace, if appropriate
        for (final Namespace nsd : nstack.addedForward()) {
          printNamespace(out, fstack, nsd);
        }
 
        // Print out attributes
        if (element.hasAttributes()) {
          for (final Attribute attribute : element.getAttributes()) {
            printAttribute(out, fstack, attribute);
          }
        }
       
        // OK, now we print out the meat of the Element
        if (walker != null) {
          // we need to re-create the walker/fstack.
          fstack.push();
          try {
            fstack.setTextMode(textmode);
            if (!walker.isAllText() && fstack.getPadBetween() != null) {
              // we need to newline/indent
              final String indent = fstack.getPadBetween();
              printText(out, fstack, new Text(indent));
            }
           
            printContent(out, fstack, nstack, walker);
           
            if (!walker.isAllText() && fstack.getPadLast() != null) {
              // we need to newline/indent
              final String indent = fstack.getPadLast();
              printText(out, fstack, new Text(indent));
            }
          } finally {
            fstack.pop();
          }
        }
     
        out.writeEndElement();
       
       
      } else {
        // implies:
        //      fstack.isExpandEmpty... is false
        // and       content.isEmpty()
        //       or      textonly == true
        //           and preserve == false
        //           and whiteonly == true
       
        Namespace ns = element.getNamespace();
        if (ns == Namespace.NO_NAMESPACE) {
          out.writeEmptyElement(element.getName());
        } else if ("".equals(ns.getPrefix())) {
          out.writeEmptyElement("", element.getName(), ns.getURI());
        } else {
          out.writeEmptyElement(ns.getPrefix(), element.getName(), ns.getURI());
        }
       
        // Print the element's namespace, if appropriate
        for (final Namespace nsd : nstack.addedForward()) {
          printNamespace(out, fstack, nsd);
View Full Code Here

    if (!attribute.isSpecified() && fstack.isSpecifiedAttributesOnly()) {
      return;
    }
   
    final Namespace ns = attribute.getNamespace();
    if (ns == Namespace.NO_NAMESPACE) {
      out.writeAttribute(attribute.getName(), attribute.getValue());
    } else {
      out.writeAttribute(ns.getPrefix(), ns.getURI(),
          attribute.getName(), attribute.getValue());
    }
  }
View Full Code Here

      final javax.xml.stream.events.Attribute att =
          (javax.xml.stream.events.Attribute)it.next();

      final QName aqname = att.getName();

      final Namespace attNs = Namespace.getNamespace(aqname.getPrefix(),
          aqname.getNamespaceURI());

      factory.setAttribute(element, factory.attribute(
          aqname.getLocalPart(), att.getValue(),
          AttributeType.getAttributeType(att.getDTDType()), attNs));
View Full Code Here

  }

  @Override
  public boolean isMyType(Document document) {
    Element rssRoot = document.getRootElement();
    Namespace defaultNS = rssRoot.getNamespace();
    return (defaultNS != null) && defaultNS.equals(getAtomNamespace());
  }
View Full Code Here

  }

  @Override
  public boolean isMyType(Document document) {
    Element rssRoot = document.getRootElement();
    Namespace defaultNS = rssRoot.getNamespace();
    return (defaultNS != null) && defaultNS.equals(getAtomNamespace());
  }
View Full Code Here

TOP

Related Classes of nexj.core.rpc.soap.SOAPUnmarshaller$Namespace

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.