Package org.xooof.xmlstruct

Examples of org.xooof.xmlstruct.XmlStruct


        XmlStructFactory sf = new XmlStructFactoryComposite(new XmlStructFactory[]{
            new org.xooof.xmlstruct.test.nons.PackageXmlStructFactory(),
            new org.xooof.xmlstruct.test.ns1.PackageXmlStructFactory(),
            new org.xooof.xmlstruct.test.ns2.PackageXmlStructFactory(),
            });
        XmlStruct xs = null;
        ErrorBag eb = new ErrorBag();
           

        FileWriter rw = new FileWriter(result);
        SAXTransformerFactory tf = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
        TransformerHandler handler = tf.newTransformerHandler();
        handler.setResult(new StreamResult(rw));
        try
        {
            handler.startDocument();
            startElement(handler,"result");
           
            // xsFromXML
            try
            {
                FileInputStream fis = new FileInputStream(source);
                xs = XmlStructUtils.xsFromXML(sf,fis,eb,"");
                if (eb.size() > 0)
                {
                    writeElementString(handler,"fromXmlErr",eb.toString());
                    return;
                }
                else
                {
                    writeElementString(handler,"fromXmlOk","");
                }
            }
            catch(XmlStructException e)
            {
                writeElementString(handler,"fromXmlErr",e.getMessage());
                return;
            }
            catch(Exception e)
            {
                writeElementString(handler,"fromXmlErr","Fatal: "+e.toString());  
                return;
            }
           
            // xsValidate
            {
                xs.xsValidate(eb,"");
                if (eb.size() > 0)
                {
                    writeElementString(handler,"validateErr",eb.toString());
                }
                else
View Full Code Here


    try
    {
      if (xml != null && xml.length() > 0)
      {
        ErrorBag eb = new ErrorBag();
        XmlStruct o = XmlStructUtils.xsFromXML(xsFactory,xml,eb,"");
        if (o == null)
        {
          throw new XmlStructException("unmarshalling error: " + eb.toString());
        }
        else
View Full Code Here

TOP

Related Classes of org.xooof.xmlstruct.XmlStruct

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.