Package nexj.core.meta.integration.format.xml

Examples of nexj.core.meta.integration.format.xml.XMLNamespace


      m_writer.setNamespace(SOAP.XML_NS);

      for (Iterator itr = rootMapping.getNamespaceIterator(); itr.hasNext();)
      {
         XMLNamespace ns = (XMLNamespace)itr.next();

         if (ns.isDeclaredByEnvelope() == bInEnvelope)
         {
            appendNamespace(ns.getName(), ns.getURI());

            if (XMLNamespace.XSI.equals(ns.getURI()))
            {
               bAppendXSI = false;
            }
         }
      }
View Full Code Here


      Iterator itr = rootMapping.getNamespaceIterator();
      boolean bWroteSchemaLocation = false;

      while (itr.hasNext())
      {
         XMLNamespace namespace = (XMLNamespace)itr.next();

         if (namespace.getSchema() != null && !namespace.getSchema().equals(namespace.getURI()))
         {
            if (bWroteSchemaLocation)
            {
               m_writer.write(' ');
            }
            else
            {
               m_writer.setNamespace(XMLNamespace.XSI_NAME);
               m_writer.openAttribute("schemaLocation");
               bWroteSchemaLocation = true;
            }

            m_writer.writeValue(namespace.getURI());
            m_writer.write(' ');
            m_writer.writeValue(namespace.getSchema());
         }
      }

      if (bWroteSchemaLocation)
      {
View Full Code Here

    */
   protected void appendType(RootXMLMessagePartMapping mapping) throws IOException
   {
      if (mapping != null && mapping.getXSDType() != null)
      {
         XMLNamespace namespace = mapping.getNamespace();

         m_writer.setNamespace(XMLNamespace.XSI_NAME);

         if (namespace != null)
         {
            m_writer.writeAttribute("type", namespace.getName(), ":", mapping.getXSDType());
         }
         else
         {
            m_writer.writeAttribute("type", mapping.getXSDType());
         }
View Full Code Here

         {
            sName = message.getName();
         }
      }

      XMLNamespace namespace = mapping.getNamespace();
      Schema schema = (namespace == null) ? m_universe.getSchema(m_sNamespaceURI, null) :
         m_universe.getSchema(namespace.getURI(), namespace.getName());
      CompositeType type;

      if (sName != null)
      {
         CompositeType existingType = (CompositeType)schema.findItem(sName, SchemaItem.COMPOSITE_TYPE);

         if (existingType != null)
         {
            return existingType;
         }

         type = new CompositeType(sName);
         schema.addItem(type);
      }
      else
      {
         type = new CompositeType(sName);
      }

      if (message != null)
      {
         type.setDescription(part.getDescription());
      }

      if (namespace != null)
      {
         m_sNamespaceURI = namespace.getURI();
      }

      switch (part.getAggregation())
      {
         case CompositeMessagePart.SEQUENTIAL:
            type.setAggregation(CompositeType.AGGREGATION_SEQUENTIAL);
            break;

         case CompositeMessagePart.RANDOM:
            type.setAggregation(CompositeType.AGGREGATION_RANDOM);
            break;

         case CompositeMessagePart.SINGLE:
            type.setAggregation(CompositeType.AGGREGATION_CHOICE);
            break;

         default:
            throw new IllegalStateException("Unknown aggregation");
      }

      type.setLax(part.isLax());

      for (int i = 0, nCount = part.getPartCount(); i < nCount; i++)
      {
         MessagePart child = part.getPart(i);

         // Omit parts declared in base message
         if (message != null && child.getDeclarator() != message)
         {
            continue;
         }

         boolean bChildEnvelopeHeaders = child.getRoot() == part &&
            child == ((RootXMLMessagePartMapping)mapping).getHeaderPart();
         XMLMessagePartMapping childMapping = (XMLMessagePartMapping)child.getMapping();

         if (child instanceof PrimitiveMessagePart)
         {
            if (bChildEnvelopeHeaders)
            {
               continue;
            }

            if (childMapping.getNodeType() == XMLMessagePartMapping.VALUE)
            {
               type.setValueType(getAtomicType((PrimitiveMessagePart)child));
            }
            else
            {
               Markup markup = createMarkup((PrimitiveMessagePart)child);

               if (!isEnvelopeMarkup(markup))
               {
                  type.addChild(markup);
               }

               if (bEnvelopeHeaders)
               {
                  addEnvelopeHeader(child, (Element)markup, false);
               }
            }
         }
         else if (child instanceof CompositeMessagePart)
         {
            CompositeType childType;
            Element childElement;

            if (child instanceof CompositeMessagePartRef)
            {
               CompositeMessagePart referentPart = ((CompositeMessagePartRef)child).getRefPart();
               Message referentMessage = ((RootXMLMessagePartMapping)referentPart.getMapping()).getRootMessage();

               childType = createCompositeType(referentPart, referentMessage);
               childElement = new Element(childMapping.getNodeName());
               childElement.setType(childType);
               childElement.setDescription(child.getDescription());

               if (bEnvelopeHeaders)
               {
                  addEnvelopeHeader(child, childElement, true);
               }
            }
            else
            {
               XMLNamespace childNamespace = childMapping.getNamespace();
               String sURI = (childNamespace == null) ? null : childNamespace.getURI();

               if (sURI != null && !sURI.equals(m_sNamespaceURI))
               {
                  // Element reference (different namespace)
                  String sCurrentNamespace = m_sNamespaceURI;
                  Schema otherNSSchema = m_universe.getSchema(sURI, childNamespace.getName());

                  m_sNamespaceURI = sURI;
                  childType = createCompositeType((CompositeMessagePart)child, null);

                  Element otherNSElement = new Element(childMapping.getNodeName());
View Full Code Here

    * @return The markup definition.
    */
   protected Markup createMarkup(PrimitiveMessagePart part)
   {
      XMLMessagePartMapping mapping = (XMLMessagePartMapping)part.getMapping();
      XMLNamespace namespace = mapping.getNamespace();
      String sURI = (namespace == null) ? null : namespace.getURI();

      if (sURI != null && !sURI.equals(m_sNamespaceURI))
      {
         String sCurrentNamespace = m_sNamespaceURI;

         try
         {
            m_sNamespaceURI = sURI;

            if (mapping.getNodeType() == XMLMessagePartMapping.VALUE)
            {
               throw new IllegalStateException();
            }

            byte nType = (mapping.getNodeType() == XMLMessagePartMapping.ELEMENT) ? SchemaItem.ELEMENT : SchemaItem.ATTRIBUTE;
            Schema schema = m_universe.getSchema(sURI, namespace.getName());
            Markup composite = (Markup)schema.findItem(mapping.getNodeName(), nType);

            if (composite == null)
            {
               composite = createMarkup(part);
View Full Code Here

            element.setType(type);
         }
      }

      XMLNamespace namespace = mapping.getNamespace();

      if (namespace != null)
      {
         assert namespace.getURI().equals(m_sNamespaceURI);

         element.setQualified(true);
      }
   }
View Full Code Here

      {
         attribute.setType(getAtomicType(part));
      }

      XMLMessagePartMapping mapping = (XMLMessagePartMapping)part.getMapping();
      XMLNamespace namespace = mapping.getNamespace();

      if (namespace != null)
      {
         assert namespace.getURI().equals(m_sNamespaceURI);

         attribute.setQualified(true);
      }
   }
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.format.xml.XMLNamespace

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.