Examples of XMLHelper


Examples of commonj.sdo.helper.XMLHelper

    }

    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.XMLHelper

        if (source == null) {
            return null;
        }
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            return xmlHelper.load(source).getRootObject();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

Examples of commonj.sdo.helper.XMLHelper

        if (source == null) {
            return null;
        }
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            Document doc = DOMHelper.promote(source);
            DOMSource domSource = new DOMSource(doc);
            XMLDocument xmlDoc = xmlHelper.load(domSource, doc.getDocumentURI(), null);
            return xmlDoc.getRootObject();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

Examples of commonj.sdo.helper.XMLHelper

        if (source == null) {
            return null;
        }           
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            QName elementName = SDOContextHelper.getElement(context);
            return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

Examples of commonj.sdo.helper.XMLHelper

        if (source == null) {
            return null;
        }
        try {
            HelperContext helperContext = SDOContextHelper.getHelperContext(context);
            XMLHelper xmlHelper = helperContext.getXMLHelper();
            QName elementName = SDOContextHelper.getElement(context);
            Document doc = DOMHelper.newDocument();
            DOMResult result = new DOMResult(doc);
            XMLDocument xmlDoc = xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
            xmlHelper.save(xmlDoc, result, null);
            return doc.getDocumentElement();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

Examples of commonj.sdo.helper.XMLHelper

    }

    public NodeInfo transform(DataObject source, TransformationContext context) {
        // FIXME: Need to create the HelperContext from the transformation context
        // FIXME: This is a big hack to create a document using the class name
        XMLHelper helper = XMLHelper.INSTANCE;
        String name = null;
        if (source.getClass().getInterfaces().length > 0) {
            name = source.getClass().getInterfaces()[0].getSimpleName();
        } else {
            name = source.getClass().getName();
        }

        if (name.length() > 0) {
            name = Character.toLowerCase(name.charAt(0)) + name.substring(1, name.length());
        }

        try {
            DOMResult domResult = new DOMResult(DOMHelper.newDocument());
            XMLDocument xmlDoc = helper.createDocument(source, null, name);
            helper.save(xmlDoc, domResult, null);
            return node2NodeInfoTransformer.transform(domResult.getNode(), context);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
View Full Code Here

Examples of commonj.sdo.helper.XMLHelper

            throw new RuntimeException("Cannot load configuration from a null InputStream. "
                    + "Possibly caused by an incorrect config xml file name");
        }

        SDOUtil.registerStaticTypes(ConfigFactory.class);
        XMLHelper helper = XMLHelper.INSTANCE;

        try {
            return (Config) helper.load(configStream).getRootObject();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of oracle.toplink.essentials.internal.ejb.cmp3.xml.XMLHelper

     * Fast track processing a ClassAccessor for the given descriptor.
     * Inheritance root classes and embeddables may be fast tracked.
     */
    protected ClassAccessor processAccessor(MetadataDescriptor descriptor) {
        Node node = null;
        XMLHelper xmlhelper = null;
       
        node = m_helper.locateEntityNode(descriptor.getJavaClass());
       
        if(node!=null){
            xmlhelper = m_helper;
        } else {
            //Bug#2962 Cover the case when the given descriptor defined in the separate mapping XML file rather than
            //the one referred by m_helper.
            for (Map.Entry<URL, Document> urlToDocPair : m_project.getMappingFiles().entrySet()) {
                Document document = (Document)urlToDocPair.getValue();
                xmlhelper = new XMLHelper(document, urlToDocPair.getKey().getFile(), m_helper.getClassLoader());
                node = xmlhelper.locateEntityNode(descriptor.getJavaClass());
                if(node!=null){
                    break;
                }
            }
        }
View Full Code Here

Examples of org.apache.bsf.xml.XMLHelper

    public void testE4X() throws ScriptException, XMLStreamException, FactoryConfigurationError {
        // The default Rhino implementation provided by Java 1.6 does not support E4X,
        // so use the unique name supported by the 1.6R7 version factory.
        ScriptEngine engine = new ScriptEngineManager().getEngineByName("rhino-nonjdk");
        assertNotNull("engine should not be null",engine);
        XMLHelper convertor = XMLHelper.getArgHelper(engine);
        Object o = convertor.toScriptXML(createOMElement("<a><b>petra</b></a>"));
        OMElement om = convertor.toOMElement(o);
        assertEquals("<a><b>petra</b></a>", om.toString());

        Bindings bindings = engine.createBindings();
        bindings.put("o", o);
        Object x = engine.eval("typeof o", bindings);
View Full Code Here

Examples of org.hibernate.internal.util.xml.XMLHelper

    secondPasses = new ArrayList<SecondPass>();
    propertyReferences = new ArrayList<Mappings.PropertyReference>();
    extendsQueue = new HashMap<ExtendsQueueEntry, String>();

    xmlHelper = new XMLHelper();
    interceptor = EmptyInterceptor.INSTANCE;
    properties = Environment.getProperties();
    entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;

    sqlFunctions = new HashMap<String, SQLFunction>();
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.