Java 8 NamespaceSupport - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 NamespaceSupport class.

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 { 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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());
Full Snippet Info
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
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);
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods: getURI
 
    @Test
    public void testMultiple() throws Exception {
        NamespaceSupport ctx = parser
                .parse("xmlns(foo=http://bar), xmlns(ex=http://example.com),xmlns(gs=http://geoserver.org)"); 
        assertEquals("http://bar", ctx.getURI("foo"));
        assertEquals("http://example.com", ctx.getURI("ex"));
        assertEquals("http://geoserver.org", ctx.getURI("gs"));
    } 
 
    @Test
    public void testDefaultNamespace() throws Exception{
        NamespaceSupport ctx = parser.parse("xmlns(http://default.namespace.com)");
        assertEquals("http://default.namespace.com", ctx.getURI(XMLConstants.DEFAULT_NS_PREFIX));
    } 
     
    @SuppressWarnings("unchecked") 
    private List<String> getPrefixes(NamespaceSupport ctx) {
        Enumeration<String> prefixes = ctx.getPrefixes();
        List<String> l = new ArrayList<String>();
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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());
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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);
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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());
Full Snippet Info
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 NamespaceSupport Methods: