Package javax.xml.stream.events

Examples of javax.xml.stream.events.Namespace


    int last = endElements.size() - 1;
    EndElement oldEndElement = endElements.get(last);
    Iterator oldNamespaces = oldEndElement.getNamespaces();
    List<Namespace> newNamespaces = new ArrayList<Namespace>();
    while (oldNamespaces.hasNext()) {
      Namespace oldNamespace = (Namespace) oldNamespaces.next();
      newNamespaces.add(oldNamespace);
    }
    newNamespaces.add(namespace);
    EndElement newEndElement = eventFactory.createEndElement(oldEndElement.getName(), newNamespaces.iterator());
    eventWriter.add(namespace);
View Full Code Here


                ((DTD)xmlSecEvent).getDocumentTypeDeclaration():
                ((DTD)xmlSecEvent).getEntities()
                */
                break;
            case XMLStreamConstants.NAMESPACE:
                Namespace namespace = (Namespace) xmlSecEvent;
                Attr namespaceNode;
                String prefix = namespace.getPrefix();
                if (prefix == null || prefix.isEmpty()) {
                    namespaceNode = document.createAttributeNS(WSSConstants.NS_XML, "xmlns");
                } else {
                    namespaceNode = document.createAttributeNS(WSSConstants.NS_XML, "xmlns:" + prefix);
                }
                namespaceNode.setValue(namespace.getNamespaceURI());
                ((Element) currentNode).setAttributeNodeNS(namespaceNode);
                break;
            default:
                throw new WSSecurityException(
                        WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN,
View Full Code Here

    else {
      throw new IllegalStateException();
    }
    int count = 0;
    while (namespaces.hasNext()) {
      Namespace namespace = (Namespace) namespaces.next();
      if (count == index) {
        return namespace;
      }
      else {
        count++;
View Full Code Here

  {
    Logger logger = Logger.getLogger(SBMLReader.class);
    ReadingParser namespaceParser = null;

    while (nam.hasNext()) {
      Namespace namespace = (Namespace) nam.next();
      boolean isLastNamespace = !nam.hasNext();
      namespaceParser = initializedParsers.get(namespace.getNamespaceURI());
     
      logger.debug("processNamespaces: " + namespace.getNamespaceURI());
     
      // Calling the currentNode parser to store all the declared namespaces
      parser.processNamespace(currentNode.getLocalPart(),
          namespace.getNamespaceURI(),
          namespace.getName().getPrefix(),
          namespace.getName().getLocalPart(),
          hasAttributes, isLastNamespace,
          sbmlElements.peek());
     
      // Calling each corresponding parser, in case they want to initialize things for the currentNode
      if ((namespaceParser != null) && !namespaceParser.getClass().equals(parser.getClass())) {
       
        logger.debug("processNamespaces 2e parser: " + namespaceParser);
       
        namespaceParser.processNamespace(currentNode.getLocalPart(),
            namespace.getNamespaceURI(),
            namespace.getName().getPrefix(),
            namespace.getName().getLocalPart(),
            hasAttributes, isLastNamespace,
            sbmlElements.peek());
      } else if (namespaceParser == null) {
        logger.warn(MessageFormat.format("Cannot find a parser for the {0} namespace", namespace.getNamespaceURI()));
      }
    }

  }
View Full Code Here

        StartDocument startDocument = eventFactory.createStartDocument();
        eventWriter.add(startDocument);
        eventWriter.add(end);

        // Create config open tag
        Namespace ns = eventFactory.createNamespace("n0", "urn:nsit");
        Namespace ns2 = eventFactory.createNamespace("urn:nsit");
        Set<Namespace> nspaces = new HashSet();
        nspaces.add(ns);
        nspaces.add(ns2);
        StartElement dbse = eventFactory.createStartElement("", "urn:nsit", "policyDB", null, nspaces.iterator());
        eventWriter.add(tab);
View Full Code Here

  @SuppressWarnings("unchecked")
  public String getNamespacePrefix(int index) {
    Iterator<Namespace> itr = current.asStartElement().getNamespaces();
    int level = 0;
    Namespace ns = null;
    while (itr.hasNext()) {
      ns = itr.next();
      if (level == index) {
        return ns.getPrefix();
      }
      level++;
    }
    return null;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public String getNamespaceURI(int index) {
    Iterator<Namespace> itr = current.asStartElement().getNamespaces();
    int level = 0;
    Namespace ns = null;
    while (itr.hasNext()) {
      ns = itr.next();
      if (level == index) {
        return ns.getNamespaceURI();
      }
      level++;
    }
    return null;
  }
View Full Code Here

    /** Fills in the list of declared prefixes. */
    private void fillDeclaredPrefixes(Iterator namespaces) {
        fDeclaredPrefixes.clear();
        while (namespaces.hasNext()) {
            Namespace ns = (Namespace) namespaces.next();
            String prefix = ns.getPrefix();
            fDeclaredPrefixes.add(prefix != null ? prefix : "");
        }
    }
View Full Code Here

        super(isStartElement ? START_ELEMENT : END_ELEMENT, location);
        fName = name;
        if (namespaces != null && namespaces.hasNext()) {
            fNamespaces = new ArrayList();
            do {
                Namespace ns = (Namespace) namespaces.next();
                fNamespaces.add(ns);
            }
            while (namespaces.hasNext());
        }
        else {
View Full Code Here

       
        /** Fills in the list of declared prefixes. */
        private void fillDeclaredPrefixes(Iterator namespaces) {
            fDeclaredPrefixes.clear();
            while (namespaces.hasNext()) {
                Namespace ns = (Namespace) namespaces.next();
                String prefix = ns.getPrefix();
                fDeclaredPrefixes.add(prefix != null ? prefix : "");
            }
        }
View Full Code Here

TOP

Related Classes of javax.xml.stream.events.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.