Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSModel


    }

    private void processPSVISchemaInformation(ElementPSVI elemPSVI) {
        if (elemPSVI == null)
            return;
        XSModel schemaInfo = elemPSVI.getSchemaInformation();
        XSNamespaceItemList schemaNamespaces =
            schemaInfo == null ? null : schemaInfo.getNamespaceItems();
        if (schemaNamespaces == null || schemaNamespaces.getLength() == 0) {
            sendElementEvent("psv:schemaInformation");
        }
        else {
            sendIndentedElement("psv:schemaInformation");
View Full Code Here


               }
            };
           
            for (int i = 0; i < sNamespaceArray.length; ++i)
            {
               XSModel xsModel = XSDUtil.getXSModel(new XMLInputSource(null, sSystemId, null, new StringReader(sContentArray[i]), null), true, resolver);
              
               if (handler.handle(xsModel, doc))
               {
                  break;
               }
View Full Code Here

   public void testValidatePattern()
   {
      try
      {
         XSModel model = XSDUtil.getXSModel(XSDUtilTest.class.getResource("attributetypes.xsd"));
  
         XSElementDeclaration elemDecl = model.getElementDeclaration("Metadata", null);
         XSComplexTypeDefinition complexDecl = XSDUtil.getComplexTypeDef(elemDecl);
         XSObjectList list = complexDecl.getAttributeUses();
         XSAttributeUse attrUse = (XSAttributeUse)list.item(0);
  
         assertTrue(XSDUtil.hasPattern(attrUse.getAttrDeclaration()));     
View Full Code Here

      assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
   }

   public void testUnmarshallArrayType() throws Exception
   {
      XSModel model = generateSchemaXSModel(xmlType, Calendar[].class);

      Calendar[] objArr = null;
      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
View Full Code Here

   public void testMarshallArrayType() throws Exception
   {
      BigDecimal[] objArr = new BigDecimal[] { new BigDecimal(100), new BigDecimal(200), new BigDecimal(300) };

      XSModel model = generateSchemaXSModel(xmlType, BigDecimal[].class);

//      XSModel model = XsdBinder.loadSchema("<schema targetNamespace='http://org.jboss.ws/types' " + SCHEMA_NAMESPACES
//      + " xmlns:tns='http://org.jboss.ws/types'>" + " <complexType name='BigDecimalArray'>" + "  <sequence>"
//      + "   <element name='value' type='decimal' nillable='true' minOccurs='0' maxOccurs='unbounded'/>" + "  </sequence>"
//      + " </complexType>" + "</schema>", "UTF-8");
View Full Code Here

      assertEquals(DOMUtils.parse(exp), DOMUtils.parse(xsdSchema));
   }

   public void testUnmarshallArrayType() throws Exception
   {
      XSModel model = generateSchemaXSModel(xmlType, BigDecimal[].class);

      BigDecimal[] objArr = null;
      // Get the JAXB marshaller
      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
View Full Code Here

      cal2.setTimeZone(TimeZone.getTimeZone("GMT"));
      Calendar cal3 = new GregorianCalendar(1970, 7, 18, 16, 25, 57);
      cal3.setTimeZone(TimeZone.getTimeZone("GMT"));
      Calendar[] objArr = new Calendar[] { cal1, cal2, cal3 };

      XSModel model = generateSchemaXSModel(xmlType, Calendar[].class);

      StringWriter strwr;
      JBossXBMarshallerImpl marshaller = new JBossXBMarshallerImpl();
      marshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      marshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
View Full Code Here

    */
   public void testXSDAnnotations() throws MalformedURLException
   {
      String filename = "xsdAnnotation.xsd";
      File xsdFile = new File("resources/tools/xsd/annotations/" + filename)
      XSModel xsmodel = parseSchema(xsdFile.toURL());
      assertNotNull("XSModel is null?", xsmodel);
      XSObjectList xsobjlist = xsmodel.getAnnotations();
      assertNotNull("Schema Annotation is null?", xsobjlist);
      assertTrue("Schema Annotations length > 0", xsobjlist.getLength()>0);
     
      //Test Annotation at the Complex Type Level
      XSTypeDefinition xt = xsmodel.getTypeDefinition("USAddress","http://org.jboss.ws/types");
      assertTrue("USAddress is a complex type?",xt instanceof XSComplexTypeDefinition);
      XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xt;
      XSObjectList xo = xc.getAnnotations();
      assertTrue("There is one annotation", xo.getLength() == 1);
     
      //Test Annotation at the Global Element Level
      XSElementDeclaration xe = xsmodel.getElementDeclaration("myAddress","http://org.jboss.ws/types");
      XSAnnotation xa = xe.getAnnotation();
      assertNotNull("Annotation at element level is not null?",xa);
   }
View Full Code Here

      String xmlStr = "<ns1:Base_1 xmlns:ns1='" + TARGET_NAMESPACE + "'><a>100</a><b>200</b></ns1:Base_1>";

      QName xmlName = new QName(TARGET_NAMESPACE, "Base_1");
      QName xmlType = new QName(TARGET_NAMESPACE, "Base");

      XSModel model = getSchemaModel(xmlType, Base.class);

      Base exp = new Base();
      exp.a = 100;
      exp.setB(200);
View Full Code Here

      exp.x = 300;

      QName xmlName = new QName(TARGET_NAMESPACE, "Derived_1", "ns1");
      QName xmlType = new QName(TARGET_NAMESPACE, "Derived", "ns1");

      XSModel model = getSchemaModel(xmlType, Derived.class);

      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
View Full Code Here

TOP

Related Classes of org.apache.xerces.xs.XSModel

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.