Package org.teiid.query.processor.xml

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


*/
public class TagBuilderVisitor extends MappingVisitor {
    ProcessorInstruction tag;
   
    public void visit(MappingAttribute attribute) {
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor(attribute);
        if (attribute.getNameInSource() != null) {
            ElementSymbol symbol = attribute.getElementSymbol();
            tag = new AddNodeInstruction(descriptor, symbol);               
        }
        else {
View Full Code Here


    public void visit(MappingRecursiveElement element) {
        visitNode(element);
    }

    void visitNode(MappingElement element) {
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor(element);           
        if (element.getNameInSource() != null) {
            ElementSymbol symbol = element.getElementSymbol();
            tag = new AddNodeInstruction(descriptor, symbol);               
        }
        else {
            tag = new AddNodeInstruction(descriptor);           
        }
       
        if(element.isNillable()) {
            NodeDescriptor nillDescriptor = NodeDescriptor.createNillableNode();
            ((AddNodeInstruction)tag).setNillableDescriptor(nillDescriptor);
        }
    }
View Full Code Here

    handler.setResult(new StreamResult(streamResultHolder));
    handler.startDocument();
    }

    public void testStartAndEndEmptyElement() throws Exception{
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("E1", null, true, null, null,  null,false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
      Element element = new Element(descriptor, handler);
      element.startElement();
      element.endElement();
      handler.endDocument();
      assertEquals(new String(streamResultHolder.toCharArray()), "<?xml version=\"1.0\" encoding=\"UTF-8\"?><E1/>"); //$NON-NLS-1$
View Full Code Here

      handler.endDocument();
      assertEquals(new String(streamResultHolder.toCharArray()), "<?xml version=\"1.0\" encoding=\"UTF-8\"?><E1/>"); //$NON-NLS-1$
    }
   
    public void testStartAndEndElement() throws Exception{
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("E1", null, true, null, null, null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        Element element = new Element(descriptor, handler);
        element.setContent("test"); //$NON-NLS-1$
      element.startElement();
      element.endElement();
      handler.endDocument();
View Full Code Here

      handler.endDocument();
      assertEquals(new String(streamResultHolder.toCharArray()), "<?xml version=\"1.0\" encoding=\"UTF-8\"?><E1>test</E1>");//$NON-NLS-1$
    }
   
    public void testAddAttributes() throws Exception{
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("E1", null, true, null, null,  null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        Element element = new Element(descriptor, handler);
        descriptor = NodeDescriptor.createNodeDescriptor("a1", null, true, null, null, null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        element.setAttribute(descriptor, "test attribute")//$NON-NLS-1$
      element.setContent("test"); //$NON-NLS-1$
      element.startElement();
View Full Code Here

      handler.endDocument();
      assertEquals(new String(streamResultHolder.toCharArray()), "<?xml version=\"1.0\" encoding=\"UTF-8\"?><E1 a1=\"test attribute\">test</E1>");//$NON-NLS-1$
    }
   
    public void testIsChildOf()throws Exception{
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("E1", null, true, null, null, null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        Element element1 = new Element(descriptor, handler);
        descriptor = NodeDescriptor.createNodeDescriptor("E2", null, true, null, null, null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        Element element2 = new Element(descriptor, handler);
        descriptor = NodeDescriptor.createNodeDescriptor("E3", null, true, null, null, null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        Element element3 = new Element(descriptor, handler);
View Full Code Here

    }
   
    public void testNamespace()throws Exception{
        Properties namespaceURIs = new Properties();
        namespaceURIs.setProperty("n", "http://test");//$NON-NLS-1$ //$NON-NLS-2$ 
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("E1", "n", true, null, namespaceURIs, null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$//$NON-NLS-2$
        Element element = new Element(descriptor, handler);
      element.setContent("test"); //$NON-NLS-1$
      element.startElement();
      element.endElement();
      handler.endDocument();
View Full Code Here

    }
   
    public void testNamespace2()throws Exception{
        Properties namespaceURIs = new Properties();
        namespaceURIs.setProperty("n", "http://test");//$NON-NLS-1$ //$NON-NLS-2$ 
        NodeDescriptor descriptor = NodeDescriptor.createNodeDescriptor("E1", null, true, null, namespaceURIs, null, false, null, MappingNodeConstants.NORMALIZE_TEXT_PRESERVE);//$NON-NLS-1$
        Element element = new Element(descriptor, handler);
        element.setContent("test"); //$NON-NLS-1$
      element.startElement();
        namespaceURIs = new Properties();
        namespaceURIs.setProperty("n", "");//$NON-NLS-1$ //$NON-NLS-2$ 
View Full Code Here

    }
   
    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);
        ProcessorInstruction i4 = new MoveDocInstruction(MoveDocInstruction.DOWN);
View Full Code Here

        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);
        ProcessorInstruction i4 = new MoveDocInstruction(MoveDocInstruction.DOWN);
View Full Code Here

TOP

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

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.