Package org.jibx.runtime.impl

Examples of org.jibx.runtime.impl.UnmarshallingContext


    public UnmarshallingPayloadReader(IBindingFactory factory) throws WsBindingException {
        m_unmarshallCtx = createUnmarshallingContext(factory);
    }

    private UnmarshallingContext createUnmarshallingContext(IBindingFactory factory) throws WsBindingException {
        UnmarshallingContext ctx = null;
        try {
            ctx = (UnmarshallingContext) factory.createUnmarshallingContext();
        } catch (JiBXException e) {
            throw new WsBindingException("Unable to create UnmarshallingContext.", e);
        }
View Full Code Here


     */
    protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs) {
       
        // setup for attribute access
        ValidationContext vctx = (ValidationContext)ictx.getUserContext();
        UnmarshallingContext uctx = (UnmarshallingContext)ictx;
       
        // loop through all attributes of current element
        for (int i = 0; i < uctx.getAttributeCount(); i++) {
           
            // check if nonamespace attribute is in the allowed set
            String name = uctx.getAttributeName(i);
            if (uctx.getAttributeNamespace(i).length() == 0) {
                if (attrs.indexOf(name) < 0) {
                    vctx.addWarning("Undefined attribute " + name, this);
                }
            }
        }
View Full Code Here

        if (wrapper.getContainingBinding() != null) {
           
            // check attributes not allowed on included binding
            BindingElement root = wrapper.getContainingBinding();
            ValidationContext vctx = wrapper.getValidation();
            UnmarshallingContext uctx = (UnmarshallingContext)ictx;
            for (int i = 0; i < uctx.getAttributeCount(); i++) {
               
                // check if nonamespace attribute is in the allowed set
                String name = uctx.getAttributeName(i);
                if (uctx.getAttributeNamespace(i).length() == 0) {
                    if (s_allowedAttributes.indexOf(name) >= 0) {
                        String value = uctx.getAttributeValue(i);
                        if ("direction".equals(name)) {
                            if (m_precompiled) {
                                boolean compat = true;
                                if (root.m_direction == null ||
                                    "both".equals(root.m_direction)) {
View Full Code Here

     * @see #preset(IUnmarshallingContext)
     */
    protected void validateAttributes(IUnmarshallingContext ictx, boolean other, StringArray attrs) {
       
        // loop through all attributes of current element
        UnmarshallingContext uctx = (UnmarshallingContext)ictx;
        for (int i = 0; i < uctx.getAttributeCount(); i++) {
            String name = uctx.getAttributeName(i);
            String ns = uctx.getAttributeNamespace(i);
            if (ns == null || ns.length() == 0) {
               
                // check if no-namespace attribute in allowed set
                if (attrs.indexOf(name) < 0) {
                    ValidationContext vctx = (ValidationContext)ictx.getUserContext();
View Full Code Here

     * pre-set method processing when a subclass instance is being created.
     *
     * @param ictx unmarshalling context
     */
    protected void readNamespaces(IUnmarshallingContext ictx) {
        UnmarshallingContext ctx = (UnmarshallingContext)ictx;
        int count = ctx.getNamespaceCount();
        if (count > 0) {
            m_namespaces = new ArrayList();
            for (int i = 0; i < count; i++) {
                String pref = ctx.getNamespacePrefix(i);
                if (pref == null) {
                    pref = "";
                }
                m_namespaces.add(pref);
                m_namespaces.add(ctx.getNamespaceUri(i));
            }
        } else {
            m_namespaces = null;
        }
    }
View Full Code Here

     * Constructor. This initializes the location information from the context.
     *
     * @param ictx
     */
    public ProblemLocation(IUnmarshallingContext ictx) {
        UnmarshallingContext ctx = (UnmarshallingContext)ictx;
        ctx.trackObject(this);
        m_name = ctx.currentNameString();
    }
View Full Code Here

        // handle basic validation
        readNamespaces(ictx);
        validateAttributes(ictx, true, attrs);
       
        // loop through all attributes of current element
        UnmarshallingContext uctx = (UnmarshallingContext)ictx;
        clearExtraAttributes();
        for (int i = 0; i < uctx.getAttributeCount(); i++) {
           
            // collect attributes from non-schema namespaces
            String ns = uctx.getAttributeNamespace(i);
            if (ns != null && ns.length() > 0 && !getNamespace().equals(ns)) {
                addExtraAttribute(uctx.getAttributeName(i), ns, uctx.getAttributeValue(i));
            }
        }
    }
View Full Code Here

        String fpath = url.toExternalForm();
        if (paths.add(fpath)) {
            try {
               
                // access the included binding as input stream
                UnmarshallingContext ictx = new UnmarshallingContext();
                ictx.setDocument(url.openStream(), null);
               
                // get basic name and package information from binding
                ictx.parseToStartTag(URI_ELEMENTS, BINDING_ELEMENT);
                String fname = org.jibx.binding.Utility.fileName(path);
                String name = ictx.attributeText(URI_ATTRIBUTES, BINDING_NAME,
                    org.jibx.binding.Utility.bindingFromFileName(fname));
                int major = ictx.attributeInt(URI_ATTRIBUTES,
                    BINDING_MAJORVER, 0);
                int minor = ictx.attributeInt(URI_ATTRIBUTES,
                    BINDING_MINORVER, 0);
                String tpack = ictx.attributeText(URI_ATTRIBUTES,
                    BINDING_PACKAGE, null);
                boolean direct = ctx.attributeBoolean(URI_ATTRIBUTES,
                    INCLUDE_PRECOMPILED, false);
                if (direct && tpack == null) {
                    throw new JiBXException("package attribute is required for precompiled binding");
                }
                if (direct) {
                   
                    // load and add binding factory for precompiled binding
                    factory = BindingDirectory.getFactory(name, tpack,
                        ClassFile.getClassLoader());
                    nsxlate = bdef.addPrecompiledBinding(factory, major, minor);
                }
                   
               
                // unmarshal namespaces (to apply to these mappings, only)
                ictx.parsePastStartTag(URI_ELEMENTS, BINDING_ELEMENT);
                ArrayList nss = new ArrayList(nslist);
                while (ictx.isAt(URI_ELEMENTS, NAMESPACE_ELEMENT)) {
                    nss.add(unmarshalNamespace(ictx));
                }
               
                // process any format definitions (for global context)
                precomp = precomp || direct;
                unmarshalFormats(ictx, precomp, bdef.getDefinitionContext());
               
                // check for nested includes
                while (ictx.isAt(URI_ELEMENTS, INCLUDE_ELEMENT)) {
                    unmarshalInclude(ictx, precomp, bdef, url, nss, paths,
                        factory, nsxlate);
                }
               
                // process all mappings defined in included binding
View Full Code Here

            // initialize namespace and special classes
            GlobalCustom global = (GlobalCustom)obj;
            global.initClasses();
           
            // unmarshal the wrapper element directly
            UnmarshallingContext ctx = (UnmarshallingContext)ictx;
            while (ctx.isStart()) {
               
                // check type of child present
                String element = ctx.getName();
                if (PackageCustom.ELEMENT_NAME.equals(element)) {
                    unmarshalPackage(global, null, ctx);
                } else if (ClassCustom.ELEMENT_NAME.equals(element)) {
                    unmarshalClass(global, null, ctx);
                } else {
                    global.internalAddExtensionChild(ctx.unmarshalElement());
                }
               
            }
            return global;
        }
View Full Code Here

        }
        if (valid) {
            try {
               
                // construct the binding definition code generator
                UnmarshallingContext uctx = new UnmarshallingContext();
                uctx.setDocument(new ByteArrayInputStream(data), fname, null);
                if (cf != null) {
                   
                    // set target root and package for created classes
                    if (bname == null) {
                        bname = sname;
View Full Code Here

TOP

Related Classes of org.jibx.runtime.impl.UnmarshallingContext

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.