Package com.alibaba.citrus.springext.Schema

Examples of com.alibaba.citrus.springext.Schema.Transformer


        };
    }

    /** 修改schema,除去所有的includes。 */
    public static Transformer getTransformerWhoRemovesIncludes() {
        return new Transformer() {
            public void transform(Document document, String systemId) {
                Element root = document.getRootElement();

                // <xsd:schema>
                if (W3C_XML_SCHEMA_NS_URI.equals(root.getNamespaceURI()) && "schema".equals(root.getName())) {
View Full Code Here


        };
    }

    /** 修改schema,添加间接依赖的includes。 */
    public static Transformer getTransformerWhoAddsIndirectIncludes(final Map<String, Schema> includes) {
        return new Transformer() {
            public void transform(Document document, String systemId) {
                Element root = document.getRootElement();

                root.addNamespace("xsd", W3C_XML_SCHEMA_NS_URI);

View Full Code Here

            }
        }

        final String normalizedPrefix = prefix;

        return new Transformer() {
            public void transform(Document document, String systemId) {
                if (normalizedPrefix != null) {
                    Element root = document.getRootElement();

                    // <xsd:schema>
View Full Code Here

    }

    /** 将内部element/attribute设置了不需要namespace。 */
    public static Transformer getUnqualifiedStyleTransformer(ResourceResolver resourceResolver) {
        if (isUnqualifiedStyle(resourceResolver)) {
            return new Transformer() {
                public void transform(Document document, String systemId) {
                    Element root = document.getRootElement();

                    if (root.attribute("elementFormDefault") != null) {
                        root.remove(root.attribute("elementFormDefault"));
View Full Code Here

        // 因此可用这个类来区分webx的版本。
        return resourceResolver.getResource("com/alibaba/citrus/springext/util/ConvertToUnqualifiedStyle.class") != null;
    }

    public static Transformer getNoopTransformer() {
        return new Transformer() {
            public void transform(Document document, String systemId) {
                // donothing
            }
        };
    }
View Full Code Here

    @Before
    public void init() throws Exception {
        source = new ByteArrayResource("<hello></hello>".getBytes());
        illegalSource = new ByteArrayResource("<hello>".getBytes());
        transformer = new Transformer() {
            public void transform(Document document, String systemId) {
                document.getRootElement().addElement("world");
            }
        };
        transformer2 = new Transformer() {
            public void transform(Document document, String systemId) {
                document.getRootElement().addElement("hi");
            }
        };
        document = SchemaUtil.readDocument(new ByteArrayInputStream("<doc></doc>".getBytes()), "", true);
View Full Code Here

        };
    }

    /** 修改schema,除去所有的includes。 */
    public static Transformer getTransformerWhoRemovesIncludes() {
        return new Transformer() {
            public void transform(Document document, String systemId) {
                Element root = document.getRootElement();

                // <xsd:schema>
                if (W3C_XML_SCHEMA_NS_URI.equals(root.getNamespaceURI()) && "schema".equals(root.getName())) {
View Full Code Here

        };
    }

    /** 修改schema,添加间接依赖的includes。 */
    public static Transformer getTransformerWhoAddsIndirectIncludes(final Map<String, Schema> includes) {
        return new Transformer() {
            public void transform(Document document, String systemId) {
                Element root = document.getRootElement();

                root.addNamespace("xsd", W3C_XML_SCHEMA_NS_URI);

View Full Code Here

            }
        }

        final String normalizedPrefix = prefix;

        return new Transformer() {
            public void transform(Document document, String systemId) {
                if (normalizedPrefix != null) {
                    Element root = document.getRootElement();

                    // <xsd:schema>
View Full Code Here

            }
        };
    }

    public static Transformer getNoopTransformer() {
        return new Transformer() {
            public void transform(Document document, String systemId) {
                // do nothing
            }
        };
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.springext.Schema.Transformer

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.