Package org.teiid.query.mapping.xml

Examples of org.teiid.query.mapping.xml.Namespace


       
        MappingDocument doc = new MappingDocument(false);
       
        MappingElement root = doc.addChildElement(new MappingElement("root")); //$NON-NLS-1$
        root.setSource("vm1.g1"); //$NON-NLS-1$
        root.addAttribute(new MappingAttribute("type", new Namespace("xsi", ""))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        root.addAttribute(new MappingAttribute("type", "vm1.g1.e1")); //$NON-NLS-1$ //$NON-NLS-2$
        root.addChildElement(new MappingElement("myElement", "vm1.g1.e2")); //$NON-NLS-1$ //$NON-NLS-2$       
        return doc;
   }
View Full Code Here


        return doc;
    }   
   
    private static MappingNode createXMLPlanSOAP() {

        Namespace namespace = new Namespace("ORG", "http://www.mm.org/dummy"); //$NON-NLS-1$ //$NON-NLS-2$

        MappingDocument doc = new MappingDocument(true);
        MappingElement root = doc.addChildElement(new MappingElement("TaxReports", namespace)); //$NON-NLS-1$
       
        root.setNamespaces(new Namespace[] {namespace});
       
        MappingElement report = root.addChildElement(new MappingElement("TaxReport", namespace)); //$NON-NLS-1$
        report.setNamespaces(new Namespace[] {namespace});
              
        Namespace xsiNamespace = new Namespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ //$NON-NLS-2$
        Namespace soapNamespace = new Namespace("SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/"); //$NON-NLS-1$ //$NON-NLS-2$
       
        MappingElement taxIds = report.addChildElement(new MappingElement("ArrayOfTaxID", namespace)); //$NON-NLS-1$
        taxIds.setMinOccurrs(0);
        taxIds.setNamespaces(new Namespace[] {xsiNamespace, soapNamespace});
       
View Full Code Here

    private static MappingNode createXMLPlanAdvanced() {
        //add to previous example
        MappingDocument doc = createXMLPlanWithDefaults();
        MappingElement root = (MappingElement)doc.getRootNode();

        Namespace nameSpaceOne = new Namespace("duh", "http://www.duh.org/duh"); //$NON-NLS-1$ //$NON-NLS-2$
        Namespace nameSpaceTwo = new Namespace("duh2", "http://www.duh2.org/duh2"); //$NON-NLS-1$ //$NON-NLS-2$
        Namespace nameSpaceThree = new Namespace("duh", "http://www.duh.org/duh/duh"); //$NON-NLS-1$ //$NON-NLS-2$
        Namespace nameSpaceFour = new Namespace(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX, ""); //$NON-NLS-1$                     
        Namespace nameSpaceFive = new Namespace(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX, "http://www.default.org/default"); //$NON-NLS-1$       
                       
        MappingElement fakeChildOfRoot = new MappingElement("Fake", nameSpaceOne); //$NON-NLS-1$
        fakeChildOfRoot.setValue("fixed constant value"); //$NON-NLS-1$                      
        fakeChildOfRoot.addNamespace(nameSpaceOne);
        fakeChildOfRoot.addNamespace(nameSpaceTwo);
View Full Code Here

    //this is for testing how "optional" XML elements are included/
    //excluded from the result document
    private static MappingNode createXMLPlan_defect8917() {
       
        Namespace namespace1 = new Namespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ //$NON-NLS-2$
       
        MappingDocument doc = new MappingDocument(true);
        MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$

        root.addNamespace(namespace1);
View Full Code Here

        item.addChildElement(new MappingElement("XXXXX", "xmltest.group.items.itemQuantity")); //$NON-NLS-1$ //$NON-NLS-2$
        return doc;                               
    }
   
    private static MappingNode createXMLPlan_defect_9530() {       
        Namespace namespace = new Namespace("mm", "http://www.duh.org/duh"); //$NON-NLS-1$ //$NON-NLS-2$
        Namespace namespace2 = new Namespace("mm", "http://www.duh2.org/duh2"); //$NON-NLS-1$ //$NON-NLS-2$
        Namespace namespace3 = new Namespace("mm2", "http://www.duh3.org/duh3"); //$NON-NLS-1$ //$NON-NLS-2$
       
        MappingDocument doc = new MappingDocument(true);
        MappingElement root = doc.addChildElement(new MappingElement("Catalogs", namespace)); //$NON-NLS-1$
        root.addNamespace(namespace);
View Full Code Here

            // get the first visual node on the document.
            MappingElement rootElement = doc.getTagRootElement();
           
            Properties namespaces = rootElement.getNamespacesAsProperties();
            if (namespaces == null || !namespaces.containsKey(MappingNodeConstants.INSTANCES_NAMESPACE_PREFIX)) {
                rootElement.addNamespace(new Namespace(MappingNodeConstants.INSTANCES_NAMESPACE_PREFIX, MappingNodeConstants.INSTANCES_NAMESPACE));
            }
           
            // now exit; we are done
            setAbort(true);
        }
View Full Code Here

import junit.framework.TestCase;

public class TestNamespace extends TestCase {
   
    public void testNullPrefix() {
        Namespace ns = new Namespace(null, "uri"); //$NON-NLS-1$
        assertEquals(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX, ns.getPrefix());
    }
View Full Code Here

        Namespace ns = new Namespace(null, "uri"); //$NON-NLS-1$
        assertEquals(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX, ns.getPrefix());
    }
   
    public void testPrefixOnLoad() {
        Namespace ns = new Namespace(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX);
        assertEquals(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX, ns.getUri());
    }
View Full Code Here

        Namespace ns = new Namespace(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX);
        assertEquals(MappingNodeConstants.DEFAULT_NAMESPACE_PREFIX, ns.getUri());
    }

    public void testPrefixOnLoad1() {
        Namespace ns = new Namespace(MappingNodeConstants.INSTANCES_NAMESPACE_PREFIX);
        assertEquals(MappingNodeConstants.INSTANCES_NAMESPACE, ns.getUri());
    }
View Full Code Here

    public void testNamespace() {
        MappingElement element = new MappingElement("Test"); //$NON-NLS-1$
        assertEquals("Test", element.getName()); //$NON-NLS-1$
        assertNull(element.getNamespacePrefix());
       
        Namespace namespace = new Namespace("foo", "protocol://someuri"); //$NON-NLS-1$ //$NON-NLS-2$
        element = new MappingElement("Test", namespace); //$NON-NLS-1$
        assertEquals("foo", element.getNamespacePrefix()); //$NON-NLS-1$
        assertEquals(element.getNamespaces().length, 0);
       
        element.addNamespace(namespace);
        assertEquals(element.getNamespaces().length, 1);
       
        element.addNamespace(new Namespace("ns1", "http://mm.com")); //$NON-NLS-1$ //$NON-NLS-2$
        assertEquals(element.getNamespaces().length, 2);
       
        // they may be switch some times, need a better way to test this?
        assertEquals("ns1", element.getNamespaces()[0].getPrefix()); //$NON-NLS-1$
        assertEquals("foo", element.getNamespaces()[1].getPrefix()); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.teiid.query.mapping.xml.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.