Package org.milyn.namespace

Examples of org.milyn.namespace.NamespaceDeclarationStack


            SAXElementWriterUtil.writeEndElement(element, fragmentWriter);
          }
    }   

        private void addRootNamespaces(SAXElement element, ExecutionContext executionContext) {
            NamespaceDeclarationStack nsDeclStack = NamespaceMappings.getNamespaceDeclarationStack(executionContext);
            Map<String, String> rootNamespaces = nsDeclStack.getActiveNamespaces();

            if (!rootNamespaces.isEmpty()) {
                Set<Map.Entry<String,String>> namespaces = rootNamespaces.entrySet();
                for (Map.Entry<String,String> namespace : namespaces) {
                    addNamespace(namespace.getKey(), namespace.getValue(), element);
View Full Code Here


    MockContentHandlerNS handler;
   
    // Test message 01 - no UNA segment...
    handler = new MockContentHandlerNS();
        NamespaceDeclarationStack namespaceDeclarationStack = new NamespaceDeclarationStack(parser);

        parser.setContentHandler(new NamespaceAwareHandler(handler, namespaceDeclarationStack));
    parser.parse(new InputSource(getClass().getResourceAsStream("unedifact-msg-01.edi")));   
    //System.out.println(handler.xmlMapping);
        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

    parser.ignoreNewLines(true);

    MockContentHandler handler;
   
    handler = new MockContentHandler();
        NamespaceDeclarationStack namespaceDeclarationStack = new NamespaceDeclarationStack(parser);
        parser.setContentHandler(new NamespaceAwareHandler(handler, namespaceDeclarationStack));

    try {
      parser.parse(new InputSource(getClass().getResourceAsStream("unedifact-msg-03.edi")));
      fail("Expected EDIParseException");
View Full Code Here

    MockContentHandlerNS handler;
   
    // Test message 01 - no UNA segment...
    handler = new MockContentHandlerNS();
        NamespaceDeclarationStack namespaceDeclarationStack = new NamespaceDeclarationStack(parser);
        parser.setContentHandler(new NamespaceAwareHandler(handler, namespaceDeclarationStack));
    parser.parse(new InputSource(getClass().getResourceAsStream("unedifact-msg-04.edi")));
    //System.out.println(handler.xmlMapping);
        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-02.xml")), new StringReader(handler.xmlMapping.toString()));
View Full Code Here

    MockContentHandler handler;
   
    // Test message 01 - no UNA segment...
    handler = new MockContentHandler();
        NamespaceDeclarationStack namespaceDeclarationStack = new NamespaceDeclarationStack(parser);
        parser.setContentHandler(new NamespaceAwareHandler(handler, namespaceDeclarationStack));
    parser.parse(new InputSource(getClass().getResourceAsStream("unedifact-msg-05.edi")));
//    System.out.println(handler.xmlMapping);
        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-03.xml")), new StringReader(handler.xmlMapping.toString()));
View Full Code Here

    controlSegmentParser.setBufferedSegmentReader(segmentReader);
    controlSegmentParser.setContentHandler(contentHandler);
    controlSegmentParser.setIndentDepth(indentDepth);

        if (this.namespaceDeclarationStack == null) {
            this.namespaceDeclarationStack= new NamespaceDeclarationStack();
        } else {
            this.containerManagedNamespaceStack = true;
        }
        controlSegmentParser.setNamespaceDeclarationStack(this.namespaceDeclarationStack);
View Full Code Here

        // Copy over the XMLReader stack...
        AbstractParser.setReaders(AbstractParser.getReaders(executionContext), nestedExecutionContext);

        // Attach the NamespaceDeclarationStack to the nested execution context...
        NamespaceDeclarationStack nsStack = NamespaceMappings.getNamespaceDeclarationStack(executionContext);
        NamespaceMappings.setNamespaceDeclarationStack(nsStack, nestedExecutionContext);

        SmooksContentHandler parentContentHandler = SmooksContentHandler.getHandler(executionContext);

        if(parentContentHandler.getNestedContentHandler() != null) {
View Full Code Here

    }

    public static void attachXMLReader(XMLReader xmlReader, ExecutionContext execContext) {
        getReaders(execContext).push(xmlReader);

        NamespaceDeclarationStack namespaceDeclarationStack = NamespaceMappings.getNamespaceDeclarationStack(execContext);
        if(namespaceDeclarationStack == null) {
            throw new IllegalStateException("No NamespaceDeclarationStack attached to the ExecutionContext.");
        }
        namespaceDeclarationStack.pushReader(xmlReader);
    }
View Full Code Here

        return reader;
    }

    protected void attachNamespaceDeclarationStack(XMLReader reader, ExecutionContext execContext) {
        if (reader instanceof NamespaceDeclarationStackAware) {
            NamespaceDeclarationStack nsDeclarationStack = NamespaceMappings.getNamespaceDeclarationStack(execContext);

            if (nsDeclarationStack == null) {
                throw new IllegalStateException("NamespaceDeclarationStack not configured on ExecutionContext.");
            }
View Full Code Here

                if(domReader instanceof HierarchyChangeReader) {
                    ((HierarchyChangeReader)domReader).setHierarchyChangeListener(new XMLReaderHierarchyChangeListener(executionContext));
                }

                NamespaceDeclarationStack namespaceDeclarationStack = new NamespaceDeclarationStack();
                NamespaceMappings.setNamespaceDeclarationStack(namespaceDeclarationStack, executionContext);
                attachNamespaceDeclarationStack(domReader, executionContext);

                attachXMLReader(domReader, executionContext);
                configureReader(domReader, contentHandler, executionContext, source);
View Full Code Here

TOP

Related Classes of org.milyn.namespace.NamespaceDeclarationStack

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.