Java Code Examples for javax.xml.namespace.QName#toString()

The following examples show how to use javax.xml.namespace.QName#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 2
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 3
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 4
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 5
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 6
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 7
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 8
/**
 * Finds a type name that this context recognizes which is
 * "closest" to the given type name.
 *
 * <p>
 * This method is used for error recovery.
 */
public String getNearestTypeName(QName name) {
    String[] all = new String[typeMap.size()];
    int i=0;
    for (QName qn : typeMap.keySet()) {
        if(qn.getLocalPart().equals(name.getLocalPart()))
            return qn.toString();  // probably a match, as people often gets confused about namespace.
        all[i++] = qn.toString();
    }

    String nearest = EditDistance.findNearest(name.toString(), all);

    if(EditDistance.editDistance(nearest,name.toString())>10)
        return null;    // too far apart.

    return nearest;
}
 
Example 9
/**
 * Maps a datatype QName from the javax.xml.namespace package to an XML Schema 1.0 URI for the corresponding
 * datatype. This method recognizes the XML Schema qname mentioned in {@link DatatypeConstants}.
 *
 * Note that Java 8 / 11 do not have constants for XML Schema 1.1 datatypes like xsd:dateTimeStamp.
 *
 * @param qname One of the XML Schema qnames from {@link DatatypeConstants}.
 * @return A URI for the specified datatype.
 * @throws IllegalArgumentException If the supplied qname was not recognized by this method.
 * @see DatatypeConstants
 */
public static IRI qnameToURI(QName qname) {
	if (DatatypeConstants.DATETIME.equals(qname)) {
		return XMLSchema.DATETIME;
	} else if (DatatypeConstants.DATE.equals(qname)) {
		return XMLSchema.DATE;
	} else if (DatatypeConstants.TIME.equals(qname)) {
		return XMLSchema.TIME;
	} else if (DatatypeConstants.GYEARMONTH.equals(qname)) {
		return XMLSchema.GYEARMONTH;
	} else if (DatatypeConstants.GMONTHDAY.equals(qname)) {
		return XMLSchema.GMONTHDAY;
	} else if (DatatypeConstants.GYEAR.equals(qname)) {
		return XMLSchema.GYEAR;
	} else if (DatatypeConstants.GMONTH.equals(qname)) {
		return XMLSchema.GMONTH;
	} else if (DatatypeConstants.GDAY.equals(qname)) {
		return XMLSchema.GDAY;
	} else if (DatatypeConstants.DURATION.equals(qname)) {
		return XMLSchema.DURATION;
	} else if (DatatypeConstants.DURATION_DAYTIME.equals(qname)) {
		return XMLSchema.DAYTIMEDURATION;
	} else if (DatatypeConstants.DURATION_YEARMONTH.equals(qname)) {
		return XMLSchema.YEARMONTHDURATION;
	} else {
		throw new IllegalArgumentException("QName cannot be mapped to an XML Schema URI: " + qname.toString());
	}
}
 
Example 10
/**
 * Function to create synapse imports to enable installed connectors
 *
 * @param axisConfiguration axis configuration
 */
public static void initializeConnectors (AxisConfiguration axisConfiguration) {
    String synapseLibPath = axisConfiguration.getRepository().getPath() +
                                    File.separator + ServiceBusConstants.SYNAPSE_LIB_CONFIGS;
    File synapseLibDir = new File(synapseLibPath);
    if (synapseLibDir.exists() && synapseLibDir.isDirectory()) {
        File[] connectorList = synapseLibDir.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".zip");
            }
        });

        if (connectorList == null) {
            // No connectors found
            return;
        }

        //Check import related to the connector is available
        String importConfigDirPath = axisConfiguration.getRepository().getPath() +
                ServiceBusConstants.SYNAPSE_IMPORTS_CONFIG_PATH;
        File importsDir = new File(importConfigDirPath);

        if (!importsDir.exists() && !importsDir.mkdirs()) {
            log.error("Import synapse config directory does not exists and unable to create: " +
                    importsDir.getAbsolutePath());
            // Retrying the same for other connectors is waste
            return;
        }

        for (File connectorZip : connectorList) {
            if (log.isDebugEnabled()) {
                log.debug("Generating import for connector deployed with package: " + connectorZip.getName());
            }
            String connectorExtractedPath = null;
            try {
                connectorExtractedPath = extractConnector(connectorZip.getAbsolutePath());
            } catch (IOException e) {
                log.error("Error while extracting Connector zip : " + connectorZip.getAbsolutePath(), e);
                continue;
            }
            String packageName = retrievePackageName(connectorExtractedPath);

            // Retrieve connector name
            String connectorName = connectorZip.getName().substring(0, connectorZip.getName().indexOf('-'));
            QName qualifiedName = new QName(packageName, connectorName);
            File importFile = new File(importsDir, qualifiedName.toString() + ".xml");

            if (!importFile.exists()) {
                // Import file enabling file connector not available in synapse imports directory
                if (log.isDebugEnabled()) {
                    log.debug("Generating import config to enable connector: " + qualifiedName);
                }
                generateImportConfig(qualifiedName, importFile);
            }
        }
    }
}
 
Example 11
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 12
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 13
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 14
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 15
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 16
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 17
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 18
public FaultDetailHeader(AddressingVersion av, String wrapper, QName problemHeader) {
    this.av = av;
    this.wrapper = wrapper;
    this.problemValue = problemHeader.toString();
}
 
Example 19
@Override
public String marshal(QName v) throws Exception
{
    return (v == null) ? null : v.toString();
}
 
Example 20
/**
 * From an QName representing a qualified attribute name, generate an attribute ID
 * suitable for use in {@link #registerAttributeValue(String, QName)} 
 * and {@link #deregisterAttributeValue(String)}.
 * 
 * @param name attribute name as a QName
 * @return a string attribute ID
 */
public static String generateAttributeID(QName name) {
   return name.toString(); 
}