Package org.teiid.query.processor.xml

Examples of org.teiid.query.processor.xml.InitializeDocumentInstruction


    private void startFragment(Program program, MappingBaseNode element) {
        // In the case that we are returning the multiple documents; we are going to treat them as
        // fragments, so do not add the header information
        if (element.isTagRoot()) {
            MappingDocument doc = element.getDocument();
            ProcessorInstruction header = new InitializeDocumentInstruction(doc.getDocumentEncoding(), doc.isFormatted());
            program.addInstruction(header);
        }
    }
View Full Code Here


      TestProcessor.doProcess(plan, new FakeDataManager(), new List[] {Arrays.asList(expected)}, new CommandContext());
    }
   
    public Program exampleProgram(FakeMetadataFacade metadata, XMLProcessorEnvironment env) throws Exception{

        ProcessorInstruction i0 = new InitializeDocumentInstruction("UTF-8", true);         //$NON-NLS-1$
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("Catalogs", null, AddNodeInstruction.ELEMENT, null, null, null,false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        ProcessorInstruction i1 = new AddNodeInstruction(descriptor);
        ProcessorInstruction i2 = new MoveDocInstruction(MoveDocInstruction.DOWN);
        descriptor = NodeDescriptor.createNodeDescriptor("Catalog", null, AddNodeInstruction.ELEMENT, null, null, null,false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        ProcessorInstruction i3 = new AddNodeInstruction(descriptor);
View Full Code Here

        //ProgramUtil.printProgram(program);
        return program;       
    }

    public Program exampleProgram2(Criteria crit, FakeMetadataFacade metadata, XMLProcessorEnvironment env) throws Exception{
        ProcessorInstruction i0 = new InitializeDocumentInstruction("UTF-8", true);         //$NON-NLS-1$
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("Catalogs", null, AddNodeInstruction.ELEMENT, null, null, null,false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        ProcessorInstruction i1 = new AddNodeInstruction(descriptor);
        ProcessorInstruction i2 = new MoveDocInstruction(MoveDocInstruction.DOWN);
        descriptor = NodeDescriptor.createNodeDescriptor("Catalog", null, AddNodeInstruction.ELEMENT, null, null, null,false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        ProcessorInstruction i3 = new AddNodeInstruction(descriptor);
View Full Code Here

     * recursion is going on.
     */
    public void testInitializeDocInstruction() throws Exception {
        XMLContext context = new XMLContext();
        Program p0 = new Program();
        InitializeDocumentInstruction i1 = new InitializeDocumentInstruction();
        Program p1 = new Program();
        p1.addInstruction(i1);

        FakeXMLProcessorEnvironment env = new FakeXMLProcessorEnvironment();
        env.pushProgram(p0);
        env.pushProgram(p1);
        i1.process(env, context); // Should create new document

        assertNotNull(env.getDocumentInProgress());
    }
View Full Code Here

     * recursion is going on.
     */
    public void testInitializeDocInstruction2() throws Exception {
        XMLContext context = new XMLContext();
        Program p0 = new Program();
        InitializeDocumentInstruction i1 = new InitializeDocumentInstruction();
        Program p1 = new Program();
        p1.addInstruction(i1);

        FakeXMLProcessorEnvironment env = new FakeXMLProcessorEnvironment();
        env.pushProgram(p0);
        env.pushProgram(p1);
        env.pushProgram(p0, true); //simulate recursion
        env.pushProgram(p1);
        i1.process(env, context); // Shouldn't create new document

        assertNull(env.getDocumentInProgress());
    }   
View Full Code Here

TOP

Related Classes of org.teiid.query.processor.xml.InitializeDocumentInstruction

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.