NamespaceSupport declarePrefix - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for NamespaceSupport declarePrefix method.

This code example shows how to use the following methods:declarePrefix, pushContext
    public void setUp() { 
        expected = new ArrayList<String>();
        expected.add("ak");
        expected.add("bk");
 
        ns = new NamespaceSupport();
        ns.pushContext();
 
        ns.declarePrefix("ak", marketUri);
        ns.declarePrefix("bk", marketUri);
        ns.declarePrefix("", defaultUri);
    } 
 
    @SuppressWarnings("unchecked") 
    public void testConstructor() { 
        String prefix;
        boolean xmlPrefixExists = false;
 
        ns = new NamespaceSupport();
        Enumeration<String> prefixes = ns.getDeclaredPrefixes();
8
CodeRank
This code example shows how to use the following methods:declarePrefix
    public List<String> getVendorSpecificCapabilitiesChildDecls(GetCapabilitiesRequest request) {
        return Collections.emptyList();
    } 
 
    public void registerNamespaces(NamespaceSupport namespaces) {
        namespaces.declarePrefix("inspire_vs", NAMESPACE);
        namespaces.declarePrefix("gml", "http://schemas.opengis.net/gml");
        namespaces
                .declarePrefix("gmd", "http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd");
        namespaces
                .declarePrefix("gco", "http://schemas.opengis.net/iso/19139/20060504/gco/gco.xsd");
        namespaces
                .declarePrefix("srv", "http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd");
        // IGN : We add another xmlns for inspire_common 
        namespaces
                .declarePrefix("inspire_common", "http://inspire.ec.europa.eu/schemas/common/1.0");
    } 
 
    public void encode(Translator tx, WMSInfo wms, GetCapabilitiesRequest request)
            throws IOException {
        Version requestVersion = WMS.version(request.getVersion());
7
CodeRank
This code example shows how to use the following methods:declarePrefix
    public List<String> getVendorSpecificCapabilitiesChildDecls(GetCapabilitiesRequest request) {
        return Collections.emptyList();
    } 
 
    public void registerNamespaces(NamespaceSupport namespaces) {
        namespaces.declarePrefix("inspire_vs", NAMESPACE);
        namespaces.declarePrefix("gml", "http://schemas.opengis.net/gml");
        namespaces
                .declarePrefix("gmd", "http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd");
        namespaces
                .declarePrefix("gco", "http://schemas.opengis.net/iso/19139/20060504/gco/gco.xsd");
        namespaces
                .declarePrefix("srv", "http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd");
        // IGN : We add another xmlns for inspire_common 
        namespaces
                .declarePrefix("inspire_common", "http://inspire.ec.europa.eu/schemas/common/1.0");
    } 
 
    public void encode(Translator tx, WMSInfo wms, GetCapabilitiesRequest request)
            throws IOException { 
        Version requestVersion = WMS.version(request.getVersion());
6
CodeRank
This code example shows how to use the following methods:declarePrefix
 
        final String GSML_URI = "urn:cgi:xmlns:CGI:GeoSciML:2.0";
        /** 
         * Set up filter factory 
         */ 
        NamespaceSupport namespaces = new NamespaceSupport();
        namespaces.declarePrefix("gsml", GSML_URI);
        namespaces.declarePrefix("gml", "http://www.opengis.net/gml");
        ff = new FilterFactoryImplNamespaceAware(namespaces);
 
        /** 
         * Load data access 
         */ 
        final Name FEATURE_TYPE = Types.typeName(GSML_URI, "MappedFeature");
        final String schemaBase = "/test-data/";
        Map<String, Serializable> dsParams = new HashMap<String, Serializable>();
        dsParams.put("dbtype", "app-schema");
        URL url = BBoxTest.class.getResource(schemaBase + "MappedFeatureAsOccurrence.xml");
        assertNotNull(url);
        dsParams.put("url", url.toExternalForm());
6
CodeRank
This code example shows how to use the following methods:declarePrefix
    @Before 
    public void setUp() throws Exception { 
        /** 
         * Set up filter factory 
         */ 
        NamespaceSupport namespaces = new NamespaceSupport();
        namespaces.declarePrefix("gsml", GSMLNS);
        namespaces.declarePrefix("gml", GMLNS);
        ff = new FilterFactoryImplNamespaceAware(namespaces);
         
        /** 
         * Load mapped feature data access 
         */         
        Map<String, Serializable> dsParams = new HashMap<String, Serializable>();
        URL url = PropSelectionTest.class.getResource(schemaBase + "MappedFeaturePropertyfile.xml");
        assertNotNull(url);
 
        dsParams.put("dbtype", "app-schema");
        dsParams.put("url", url.toExternalForm());
        DataAccess<FeatureType, Feature> mfDataAccess = DataAccessFinder.getDataStore(dsParams);
6
CodeRank
This code example shows how to use the following methods:declarePrefix
    @Before 
    public void setUp() throws Exception {
        /** 
         * Set up filter factory 
         */ 
        NamespaceSupport namespaces = new NamespaceSupport();
        namespaces.declarePrefix("gsml", GSMLNS);
        namespaces.declarePrefix("gml", GMLNS);
        ff = new FilterFactoryImplNamespaceAware(namespaces);
         
        /** 
         * Load mapped feature data access 
         */         
        Map<String, Serializable> dsParams = new HashMap<String, Serializable>();
        URL url = PropSelectionTest.class.getResource(schemaBase + "MappedFeaturePropertyfile.xml");
        assertNotNull(url);
 
        dsParams.put("dbtype", "app-schema");
        dsParams.put("url", url.toExternalForm());
        DataAccess<FeatureType, Feature> mfDataAccess = DataAccessFinder.getDataStore(dsParams);
6
CodeRank
This code example shows how to use the following methods:declarePrefix
 
        final String GSML_URI = "urn:cgi:xmlns:CGI:GeoSciML:2.0";
        /** 
         * Set up filter factory 
         */ 
        NamespaceSupport namespaces = new NamespaceSupport();
        namespaces.declarePrefix("gsml", GSML_URI);
        namespaces.declarePrefix("gml", "http://www.opengis.net/gml");
        ff = new FilterFactoryImplNamespaceAware(namespaces);
 
        /** 
         * Load data access 
         */ 
        final Name FEATURE_TYPE = Types.typeName(GSML_URI, "MappedFeature");
        final String schemaBase = "/test-data/";
        Map<String, Serializable> dsParams = new HashMap<String, Serializable>();
        dsParams.put("dbtype", "app-schema");
        URL url = BBoxTest.class.getResource(schemaBase + "MappedFeatureAsOccurrence.xml");
        assertNotNull(url);
        dsParams.put("url", url.toExternalForm());
6
CodeRank
This code example shows how to use the following methods:declarePrefix
  /** 
   * Test that the {@link StepList} for the root element is properly formed. 
   */ 
  @Test
    public void testRootElementSteps() { 
        NamespaceSupport namespaces = new NamespaceSupport();
 
        try { 
            XPathUtil.rootElementSteps(null, namespaces);
            fail("passed null"); 
        } catch (NullPointerException e) {
        } 
 
        FeatureType complexType = ComplexTestData
                .createExample05NoNamespaceURI(new UniqueNameFeatureTypeFactoryImpl()); 
        Name name = complexType.getName();
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(complexType, name, 0,
                Integer.MAX_VALUE, true, null);
 
        try { 

7
CodeRank
This code example shows how to use the following methods:declarePrefix, getPrefixes, popContext, pushContext, reset
    } 
 
    public void testReset() { 
        int count;
 
        ns = new NamespaceSupport();
        count = countPrefixes();
 
        ns.pushContext();
        ns.declarePrefix("dc", "http://www.purl.org/dc#");
 
        assertEquals("Test 1: Incorrect prefix count;",
                count + 1, countPrefixes());
 
        ns.reset();
        assertEquals("Test 2: Incorrect prefix count;",
                count, countPrefixes());
 
        // Check that only one context has been created by reset(). 
        try { 

6
CodeRank
This code example shows how to use the following methods:declarePrefix
                .createExample01MultiValuedComplexProperty(new UniqueNameFeatureTypeFactoryImpl()); 
        Name name = complexType.getName();
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(complexType, name, 0,
                Integer.MAX_VALUE, true, null);
 
        NamespaceSupport namespaces = new NamespaceSupport();
        namespaces.declarePrefix("wq", name.getNamespaceURI());
        try { 
            XPath.steps(descriptor, null, namespaces);
            fail("passed null"); 
        } catch (NullPointerException e) {
        } 
 
        List expected;
        String xpath;
 
        xpath = "/";
        assertEquals(1, XPath.steps(descriptor, xpath, namespaces).size());
        XPath.Step step = (XPath.Step) XPath.steps(descriptor, xpath, namespaces).get(0);
        QName rootQName = new QName(name.getNamespaceURI(), name.getLocalPart());

6
CodeRank
declarePrefix Method Overview
Declare a Namespace prefix.
See Code Examples for other Java 8 NamespaceSupport Methods: