Package javax.xml.namespace

Examples of javax.xml.namespace.QName

The value of a QName contains a namespaceURI and a localPart. The localPart provides the local part of the qualified name. The namespaceURI is a URI reference identifying the namespace.

The prefix is included in the QName class to retain lexical information where present in an XML input source. The prefix is NOT used to compute the hash code or in the equals operation. In other words, equality is defined only using the namespaceURI and the localPart. @version 1.1


        tm.setEncodingStyleURI("urn:xfire:bean-minoccurs");

        Type type = tm.getTypeCreator().createType(MyBean.class);
        BeanTypeInfo info = ((BeanType) type).getTypeInfo();

        assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "prop1")), 1);
        assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "prop2")), 0);
    }
View Full Code Here


        tm.setEncodingStyleURI("urn:xfire:custom-type");

        BeanType type = (BeanType) tm.getTypeCreator().createType(MyBean.class);
        BeanTypeInfo info = type.getTypeInfo();

        QName name = (QName) info.getElements().next();
        Type custom = info.getType(name);
        assertTrue(custom instanceof MyStringType);
    }
View Full Code Here

    {
        tm.setEncodingStyleURI("urn:xfire:custom-ns");

        BeanType type = (BeanType) tm.getTypeCreator().createType(MyBean.class);
       
        assertEquals(new QName("urn:Bean", "Bean"), type.getSchemaType());
       
        BeanTypeInfo info = type.getTypeInfo();
        assertEquals("urn:Bean", info.getDefaultNamespace());
       
        Iterator elItr = info.getElements();
        assertTrue(elItr.hasNext());

        QName prop1 = (QName) elItr.next();
        assertEquals(new QName("urn:Bean", "prop1"), prop1);

        System.out.println(info.getType(prop1));
        assertTrue(info.getType(prop1) instanceof StringType);
       
        Element root = new Element("root", Namespace.getNamespace("xsd", SoapConstants.XSD));
View Full Code Here

        Method m = CustomTypeService.class.getMethod("doFoo", new Class[] { String.class });
       
        Type type = creator.createType(m, 0);
        tm.register(type);
        assertTrue( type instanceof CustomStringType );
        assertEquals( new QName("urn:xfire:foo", "custom"), type.getSchemaType());
       
        type = creator.createType(m, -1);
        tm.register(type);
        assertTrue( type instanceof CustomStringType );
        assertEquals( new QName("urn:xfire:foo", "custom"), type.getSchemaType());
    }
View Full Code Here

        throws Exception
    {
        BeanType type = new BeanType();
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:Bean", "bean"));

        // Test reading
        ElementReader reader = new ElementReader(getResourceAsStream("/org/codehaus/xfire/aegis/type/basic/bean1.xml"));
       
        SimpleBean bean = (SimpleBean) type.readObject(reader, new MessageContext());
View Full Code Here

        throws Exception
    {
        BeanType type = new BeanType();
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:Bean", "bean"));

        // Test reading
        ElementReader reader = new ElementReader(getResourceAsStream("/org/codehaus/xfire/aegis/type/basic/bean9.xml"));
       
        MessageContext ctx = new MessageContext();
View Full Code Here

        throws Exception
    {
        String ns = "urn:Bean";
        BeanTypeInfo info = new BeanTypeInfo(SimpleBean.class, ns, false);
       
        QName name = new QName(ns, "howdycustom");
        info.mapElement("howdy", name);
        info.setTypeMapping(mapping);
       
        assertEquals("howdy", info.getPropertyDescriptorFromMappedName(name).getName());
       
        BeanType type = new BeanType(info);
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:Bean", "bean"));
   
        ElementReader reader = new ElementReader(getResourceAsStream("/org/codehaus/xfire/aegis/type/basic/bean3.xml"));
       
        SimpleBean bean = (SimpleBean) type.readObject(reader, new MessageContext());
        assertEquals("howdy", bean.getHowdy());
View Full Code Here

   
    public void testAttributeMap()
        throws Exception
    {
        BeanTypeInfo info = new BeanTypeInfo(SimpleBean.class, "urn:Bean");
        info.mapAttribute("howdy", new QName("urn:Bean", "howdy"));
        info.mapAttribute("bleh", new QName("urn:Bean", "bleh"));
        info.setTypeMapping(mapping);
       
        BeanType type = new BeanType(info);
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:Bean", "bean"));
   
        ElementReader reader = new ElementReader(getResourceAsStream("/org/codehaus/xfire/aegis/type/basic/bean4.xml"));
       
        SimpleBean bean = (SimpleBean) type.readObject(reader, new MessageContext());
        assertEquals("bleh", bean.getBleh());
View Full Code Here

   
    public void testAttributeMapDifferentNS()
        throws Exception
    {
        BeanTypeInfo info = new BeanTypeInfo(SimpleBean.class, "urn:Bean");
        info.mapAttribute("howdy", new QName("urn:Bean2", "howdy"));
        info.mapAttribute("bleh", new QName("urn:Bean2", "bleh"));
        info.setTypeMapping(mapping);
       
        BeanType type = new BeanType(info);
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:Bean", "bean"));
   
        ElementReader reader = new ElementReader(getResourceAsStream("/org/codehaus/xfire/aegis/type/basic/bean8.xml"));
       
        SimpleBean bean = (SimpleBean) type.readObject(reader, new MessageContext());
        assertEquals("bleh", bean.getBleh());
View Full Code Here

    public void testNullProperties()
        throws Exception
    {
        BeanTypeInfo info = new BeanTypeInfo(SimpleBean.class, "urn:Bean");
        info.setTypeMapping(mapping);
        info.mapAttribute("howdy", new QName("urn:Bean", "howdy"));
        info.mapElement("bleh", new QName("urn:Bean", "bleh"));
       
        BeanType type = new BeanType(info);
        type.setTypeClass(SimpleBean.class);
        type.setTypeMapping(mapping);
        type.setSchemaType(new QName("urn:Bean", "bean"));
   
        SimpleBean bean = new SimpleBean();
       
        // Test writing
        Element element = new Element("root", "b", "urn:Bean");
View Full Code Here

TOP

Related Classes of javax.xml.namespace.QName

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.