Examples of XSDHelper


Examples of commonj.sdo.helper.XSDHelper

                }

                wsdlURL = resolved.getResource();
                InputStream xsdInputStream = wsdlURL.openStream();
                try {
                    XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
                    xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
                } finally {
                    xsdInputStream.close();
                }
            } catch (IOException e) {
                throw new ContributionResolveException(e);
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

        List children = handler.getChildren(document, null, null);
        assertEquals(5, children.size());
    }

    public void testWrapper() throws Exception {
        XSDHelper xsdHelper = context.getXSDHelper();
        xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
        XMLHelper xmlHelper = context.getXMLHelper();
        XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
        List children = handler.getChildren(document, null, null);
        assertEquals(5, children.size());
    }
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

        assertEquals(5, children.size());
    }
   
    public void testCreate() {
        HelperContext context = HelperProvider.getDefaultContext();
        XSDHelper xsdHelper = context.getXSDHelper();
        xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
        ElementInfo element = new ElementInfo(new QName("http://www.example.com/wrapper", "op"), null);
        DataObject wrapper = (DataObject) handler.create(element, null);
        assertNotNull(wrapper);
    }
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

                String wsdlURL = artifact.getLocation();
                URLConnection connection = new URL(wsdlURL).openConnection();
                connection.setUseCaches(false);
                InputStream xsdInputStream = connection.getInputStream();
                try {
                    XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
                    xsdHelper.define(xsdInputStream, wsdlURL);
                } finally {
                    xsdInputStream.close();
                }
            } catch (IOException e) {
                throw new ContributionResolveException(e);
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

          "between the two kinds of Property",
         
          "Examining the xml attributes and elements of a Sequenced DataObject again."
          );
     
      XSDHelper xsdHelper = getScope().getXSDHelper();
      incrementIndent();
      for(Iterator it=dataObject.getInstanceProperties().iterator(); it.hasNext();) {
        Property property = (Property)it.next();
        if (xsdHelper.isAttribute(property)) {
          indent();
          buf.append("Property (XML Attribute): ").append(property.getName()).append(" - ").append(dataObject.get(property));
          lineBreak();
        }

      }
      decrementIndent();
      Sequence seq = dataObject.getSequence();

      commentary(
          "The Property/Value pairs of a Sequence can be accessed via the getProperty(int) and getValue(int)\n"
              + "accessor methods of the Sequence interface.  The size() method of the Sequence tells us how many there are.\n"
              + "If the getProperty(int) method retunes null,  then the value is text.  These text values may be encountered\n"
              + "when the DataObject's type is 'mixed' (dataObject.getType().isMixed() == true). A typical example of this\n"
              + "is when the data graph represents a form letter.",
     
          "Inspecting the Property/Value pairs of another Sequence");
     
      incrementIndent();
      indent();
      buf.append("Sequence: {\n");
     
      incrementIndent();
      for (int i = 0; i < seq.size(); i++) {
        Property p = seq.getProperty(i);
        if (p == null) {
          indent();
          buf.append("text: ").append(seq.getValue(i));
          lineBreak();
        } else if(!xsdHelper.isAttribute(p)){
          printPropertyValuePair(p, seq.getValue(i));
       }
      }
      decrementIndent();
     
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

        "xsdHelper.define(inputStream, null);",
       
        "Using an XSDHelper again to create types from an XML schema file as we saw in a previous sample"
        );
   
    XSDHelper xsdHelper = scope.getXSDHelper();
   
    InputStream is = null;
    try {
     
        URL url = getClass().getResource("/"+fileName);
        is = url.openStream();
        xsdHelper.define(is, url.toString());

     } catch (Exception e) {
        somethingUnexpectedHasHappened(e);
     } finally {
       try {
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

            }
        } else if (this.getUri() == null || !this.getUri().equals(prop.getUri())) {
            return false;
        }
        // check attribute vs. element
        XSDHelper helper = aHelperContext.getXSDHelper();
        if (helper.isAttribute(this)) {
            if (helper.isElement(prop)) {
                return false;
            }
        } else if (helper.isAttribute(prop)) {
            return false;
        }
        return true;
    }
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

  public static void generateFromXMLSchema(String xsdFileName, String namespace, String targetDirectory, String javaPackage, String prefix, int genOptions)
  {
    DataObjectUtil.initRuntime();
    EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
    ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry);
    XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData);

    try
    {
      File inputFile = new File(xsdFileName).getAbsoluteFile();
      InputStream inputStream = new FileInputStream(inputFile);
      xsdHelper.define(inputStream, inputFile.toURI().toString());

      if (targetDirectory == null)
      {
        targetDirectory = new File(xsdFileName).getCanonicalFile().getParent();
      }
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

     * Properties are always matched by name independent of their XML representation.
     * @throws IOException
     */
    public void testAtSignProperty() throws IOException {
        TypeHelper typeHelper = SDOUtil.createTypeHelper();
        XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
        XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
       
        URL url = getClass().getResource(TEST_MODEL);
        InputStream inputStream = url.openStream();
        xsdHelper.define(inputStream, url.toString());
       
        inputStream.close();
       
        XMLDocument doc = xmlHelper.load(getClass().getResourceAsStream(XPATH_XML));
         
View Full Code Here

Examples of commonj.sdo.helper.XSDHelper

        assertEquals(value, "2000-03-23");
    }
   
    public void testListIndexing() throws Exception {
        TypeHelper typeHelper = SDOUtil.createTypeHelper();
        XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
        XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);

        URL url = getClass().getResource(TEST_MODEL);
        InputStream inputStream = url.openStream();
        xsdHelper.define(inputStream, url.toString());

        inputStream.close();

        XMLDocument doc = xmlHelper.load(getClass().getResourceAsStream(XPATH_XML));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.