Package org.apache.xmlbeans.impl.xb.xsdschema

Examples of org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument


* @version $Rev:  $ $Date:  $
*/
public class WSDLMapTest extends TestCase {

    public void testOutputStringHasXMLDeclaration() throws Exception {
        SchemaDocument schemaDocument = SchemaDocument.Factory.newInstance();
        schemaDocument.addNewSchema();
        String output = AxisServiceBuilder.xmlObjectToString(schemaDocument);
        assertTrue(output.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
    }
View Full Code Here


    }

    static XmlObject parseWithNamespaces(Element element, Map namespaceMap) throws XmlException {
        ArrayList errors = new ArrayList();
        XmlOptions xmlOptions = XmlBeansUtil.createXmlOptions(errors);
        SchemaDocument parsed = SchemaDocument.Factory.parse(element, xmlOptions);
        if (errors.size() != 0) {
            throw new XmlException(errors.toArray().toString());
        }
        XmlCursor cursor = parsed.newCursor();
        try {
            cursor.toFirstContentToken();
            for (Iterator namespaces = namespaceMap.entrySet().iterator(); namespaces.hasNext();) {
                Map.Entry entry = (Map.Entry) namespaces.next();
                cursor.insertNamespace((String) entry.getKey(), (String) entry.getValue());
View Full Code Here

    }

    static XmlObject parseWithNamespaces(Element element, Map namespaceMap) throws XmlException {
        ArrayList errors = new ArrayList();
        XmlOptions xmlOptions = XmlBeansUtil.createXmlOptions(errors);
        SchemaDocument parsed = SchemaDocument.Factory.parse(element, xmlOptions);
        if (errors.size() != 0) {
            throw new XmlException(errors.toArray().toString());
        }
        XmlCursor cursor = parsed.newCursor();
        try {
            cursor.toFirstContentToken();
            for (Iterator namespaces = namespaceMap.entrySet().iterator(); namespaces.hasNext();) {
                Map.Entry entry = (Map.Entry) namespaces.next();
                cursor.insertNamespace((String) entry.getKey(), (String) entry.getValue());
View Full Code Here

* @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
*/
public class WSDLMapTest extends TestCase {

    public void testOutputStringHasXMLDeclaration() throws Exception {
        SchemaDocument schemaDocument = SchemaDocument.Factory.newInstance();
        schemaDocument.addNewSchema();
        String output = AxisServiceBuilder.xmlObjectToString(schemaDocument);
        assertTrue(output.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
    }
View Full Code Here

        for (Iterator iterator = rawWsdlMap.entrySet().iterator(); iterator.hasNext();) {
            Map.Entry entry = (Map.Entry) iterator.next();
            URI key = (URI) entry.getKey();
            Object value = entry.getValue();
            if (value instanceof SchemaDocument) {
                SchemaDocument schemaDocument = (SchemaDocument) ((SchemaDocument) value).copy();
                SchemaDocument.Schema schema = schemaDocument.getSchema();
                rewriteSchema(schema, contextURI, key);
                String schemaString = xmlObjectToString(schemaDocument);
                wsdlMap.put(key.toString(), schemaString);
            } else if (value instanceof DefinitionsDocument) {
                DefinitionsDocument doc = (DefinitionsDocument) ((DefinitionsDocument) value).copy();
View Full Code Here

                    {
                        state.error("Referenced document is not a valid schema", XmlErrorCodes.CANNOT_FIND_RESOURCE, referencedBy);
                        break download;
                    }

                    SchemaDocument sDoc = (SchemaDocument)xdoc;

                    result = sDoc.getSchema();
                    state.info("Loading referenced file " + shortname);
                }
                NsLocPair key = new NsLocPair(emptyStringIfNull(result.getTargetNamespace()), absoluteURL);
                addSuccessfulDownload(key, result);
                return result;
View Full Code Here

                    {
                        StscState.get().error("Referenced document is not a valid schema, URL = " + url, XmlErrorCodes.CANNOT_FIND_RESOURCE, null);
                        continue;
                    }

                    SchemaDocument sDoc = (SchemaDocument)xdoc;

                    result.add(sDoc.getSchema());
                }
                catch (java.net.MalformedURLException mfe)
                {
                    StscState.get().error(XmlErrorCodes.EXCEPTION_LOADING_URL, new Object[] { "MalformedURLException", url, mfe.getMessage() }, null);
                    continue;
View Full Code Here

        for (Iterator iterator = _globalElements.keySet().iterator(); iterator.hasNext();)
        {
            QName globalElemName = (QName) iterator.next();
            String tns = globalElemName.getNamespaceURI();
            SchemaDocument schDoc = getSchemaDocumentForTNS(nsToSchemaDocs, tns);

            fillUpGlobalElement((Element)_globalElements.get(globalElemName), schDoc, tns);
        }

        for (Iterator iterator = _globalAttributes.keySet().iterator(); iterator.hasNext();)
        {
            QName globalAttName = (QName) iterator.next();
            String tns = globalAttName.getNamespaceURI();
            SchemaDocument schDoc = getSchemaDocumentForTNS(nsToSchemaDocs, tns);

            fillUpGlobalAttribute((Attribute)_globalAttributes.get(globalAttName), schDoc, tns);
        }

        for (Iterator iterator = _globalTypes.keySet().iterator(); iterator.hasNext();)
        {
            QName globalTypeName = (QName) iterator.next();
            String tns = globalTypeName.getNamespaceURI();
            SchemaDocument schDoc = getSchemaDocumentForTNS(nsToSchemaDocs, tns);

            fillUpGlobalType((Type)_globalTypes.get(globalTypeName), schDoc, tns);
        }

        Collection schDocColl = nsToSchemaDocs.values();
View Full Code Here

        return (SchemaDocument[])schDocColl.toArray(new SchemaDocument[schDocColl.size()]);
    }

    private static SchemaDocument getSchemaDocumentForTNS(Map nsToSchemaDocs, String tns)
    {
        SchemaDocument schDoc = (SchemaDocument)nsToSchemaDocs.get(tns);
        if (schDoc==null)
        {
            schDoc = SchemaDocument.Factory.newInstance();
            nsToSchemaDocs.put(tns, schDoc);
        }
View Full Code Here

    }

    static XmlObject parseWithNamespaces(Element element, Map namespaceMap) throws XmlException {
        ArrayList errors = new ArrayList();
        XmlOptions xmlOptions = XmlBeansUtil.createXmlOptions(errors);
        SchemaDocument parsed = SchemaDocument.Factory.parse(element, xmlOptions);
        if (errors.size() != 0) {
            throw new XmlException(errors.toArray().toString());
        }
        XmlCursor cursor = parsed.newCursor();
        try {
            cursor.toFirstContentToken();
            for (Iterator namespaces = namespaceMap.entrySet().iterator(); namespaces.hasNext();) {
                Map.Entry entry = (Map.Entry) namespaces.next();
                cursor.insertNamespace((String) entry.getKey(), (String) entry.getValue());
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument

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.