本文整理匯總了Java中com.predic8.schema.Schema類的典型用法代碼示例。如果您正苦於以下問題:Java Schema類的具體用法?Java Schema怎麽用?Java Schema使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Schema類屬於com.predic8.schema包,在下文中一共展示了Schema類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSchemaFromXSD
import com.predic8.schema.Schema; //導入依賴的package包/類
public List<GridRow> getSchemaFromXSD(String XSDFile,String loopXPathQuery) throws ParserConfigurationException, SAXException, IOException, JAXBException{
SchemaParser parser = new SchemaParser();
try{
Schema schema=parser.parse(XSDFile);
Element element = getRowTagElement(schema);
if(element==null){
return null;
}
return parseElementsOfRowTag(element,loopXPathQuery);
}
catch(Exception e){
createMessageBox(INVALID_XSD_FILE+e.getMessage(), Constants.ERROR, SWT.ERROR,Display.getCurrent().getActiveShell());
}
return null;
}
示例2: parseParts
import com.predic8.schema.Schema; //導入依賴的package包/類
private void parseParts(List<Part> parts, List<Schema> schemas, String rootElementName, JsonObject rootElement) {
for (Part part : parts) {
if (rootElement == null) {
rootElement = OASUtils.createComplexType(part.getName(), "0", "1");
rootElementName = part.getName();
definitions.add(part.getName(), rootElement);
}
if (isPrimitive(part.getType().getQname().getLocalPart())) {
JsonObject properties = rootElement.getAsJsonObject("properties");
properties.add(part.getName(),
OASUtils.createSimpleType(part.getType().getQname().getLocalPart(), "0", "1"));
queryParams.add(part.getName());
} else {
TypeDefinition typeDefinition = part.getType();
if (typeDefinition instanceof ComplexType) {
ComplexType ct = (ComplexType) typeDefinition;
parseSchema(ct.getModel(), schemas, rootElementName, rootElement);
}
}
}
}
示例3: getTypeFromSchema
import com.predic8.schema.Schema; //導入依賴的package包/類
private TypeDefinition getTypeFromSchema(QName qName, List<Schema> schemas) {
LOGGER.entering(GenerateProxy.class.getName(), new Object() {
}.getClass().getEnclosingMethod().getName());
if (qName != null) {
for (Schema schema : schemas) {
try {
final TypeDefinition type = schema.getType(qName);
if (type != null) {
return type;
}
} catch (Exception e) {
// Fail silently
LOGGER.warning("unhandle conditions: " + e.getMessage());
}
}
}
return null;
}
示例4: buildSOAPRequest
import com.predic8.schema.Schema; //導入依賴的package包/類
private String buildSOAPRequest(List<Part> parts, List<Schema> schemas, String rootElement, String rootNamespace,
boolean generateParts) {
LOGGER.entering(GenerateProxy.class.getName(), new Object() {
}.getClass().getEnclosingMethod().getName());
String prefix = getPrefix(rootNamespace);
String soapRequest = null;
if (RPCSTYLE) {
soapRequest = "<soapenv:Envelope " + getSoapNamespace() + getNamespacesAsString(true)
+ " soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n<soapenv:Body>\n" + "<"
+ prefix + ":" + rootElement + ">\n";
} else {
soapRequest = "<soapenv:Envelope " + getSoapNamespace() + getNamespacesAsString(true)
+ " >\n<soapenv:Body>\n";
}
if (generateParts) {
try {
soapRequest = parseParts(parts, schemas, rootElement, rootNamespace, prefix, soapRequest);
} catch (Exception e) {
LOGGER.warning(
"Failed to parse parts. Not generating SOAP Template. Try changing the verb to POST/PUT");
}
}
if (RPCSTYLE) {
soapRequest += "</" + prefix + ":" + rootElement + ">\n";
}
soapRequest += "</soapenv:Body>\n</soapenv:Envelope>";
LOGGER.exiting(GenerateProxy.class.getName(), new Object() {
}.getClass().getEnclosingMethod().getName());
return soapRequest;
}
示例5: parseElement
import com.predic8.schema.Schema; //導入依賴的package包/類
private void parseElement(com.predic8.schema.Element e, List<Schema> schemas, String rootElement,
String rootNamespace, String rootPrefix) {
if (e.getName() == null) {
if (e.getRef() != null) {
final String localPart = e.getRef().getLocalPart();
final com.predic8.schema.Element element = elementFromSchema(localPart, schemas);
parseSchema(element, schemas, rootElement, rootNamespace, rootPrefix);
} else {
// fail silently
LOGGER.warning("unhandled conditions getRef() = null");
}
} else {
if (!e.getName().equalsIgnoreCase(rootElement)) {
if (e.getEmbeddedType() instanceof ComplexType) {
ComplexType ct = (ComplexType) e.getEmbeddedType();
if (!e.getNamespaceUri().equalsIgnoreCase(rootNamespace)) {
buildXPath(e, rootElement, rootNamespace, rootPrefix);
}
parseSchema(ct.getModel(), schemas, rootElement, rootNamespace, rootPrefix);
} else {
if (e.getType() != null) {
if (!getParentNamepace(e).equalsIgnoreCase(rootNamespace)
&& !e.getType().getNamespaceURI().equalsIgnoreCase(rootNamespace)) {
buildXPath(e, rootElement, rootNamespace, rootPrefix);
}
TypeDefinition typeDefinition = getTypeFromSchema(e.getType(), schemas);
if (typeDefinition instanceof ComplexType) {
parseSchema(((ComplexType) typeDefinition).getModel(), schemas, rootElement, rootNamespace,
rootPrefix);
}
} else {
// handle this as anyType
buildXPath(e, rootElement, rootNamespace, rootPrefix, true);
if (!getParentNamepace(e).equalsIgnoreCase(rootNamespace)) {
buildXPath(e, rootElement, rootNamespace, rootPrefix);
}
LOGGER.warning("Found element " + e.getName() + " with no type. Handling as xsd:anyType");
}
}
}
}
}
示例6: parseRPCElement
import com.predic8.schema.Schema; //導入依賴的package包/類
private void parseRPCElement(com.predic8.schema.Element e, List<Schema> schemas, String rootElement,
String rootNamespace, String rootPrefix, String soapRequest) {
LOGGER.entering(GenerateProxy.class.getName(), new Object() {
}.getClass().getEnclosingMethod().getName());
if (e.getName() == null) {
if (e.getRef() != null) {
final String localPart = e.getRef().getLocalPart();
final com.predic8.schema.Element element = elementFromSchema(localPart, schemas);
parseRPCSchema(element, schemas, rootElement, rootNamespace, rootPrefix, soapRequest);
} else {
// TODO: handle this
LOGGER.warning("unhandle conditions getRef() = null");
}
} else {
if (!e.getName().equalsIgnoreCase(rootElement)) {
if (e.getEmbeddedType() instanceof ComplexType) {
ComplexType ct = (ComplexType) e.getEmbeddedType();
if (!e.getNamespaceUri().equalsIgnoreCase(rootNamespace)) {
buildXPath(e, rootElement, rootNamespace, rootPrefix);
}
parseRPCSchema(ct.getModel(), schemas, rootElement, rootNamespace, rootPrefix, soapRequest);
} else {
if (e.getType() != null) {
if (!getParentNamepace(e).equalsIgnoreCase(rootNamespace)
&& !e.getType().getNamespaceURI().equalsIgnoreCase(rootNamespace)) {
buildXPath(e, rootElement, rootNamespace, rootPrefix);
}
TypeDefinition typeDefinition = getTypeFromSchema(e.getType(), schemas);
if (typeDefinition instanceof ComplexType) {
parseRPCSchema(((ComplexType) typeDefinition).getModel(), schemas, rootElement,
rootNamespace, rootPrefix, soapRequest);
}
} else {
// handle this as anyType
buildXPath(e, rootElement, rootNamespace, rootPrefix, true);
if (!getParentNamepace(e).equalsIgnoreCase(rootNamespace)) {
buildXPath(e, rootElement, rootNamespace, rootPrefix);
}
LOGGER.warning("Found element " + e.getName() + " with no type. Handling as xsd:anyType");
}
}
}
}
LOGGER.exiting(GenerateProxy.class.getName(), new Object() {
}.getClass().getEnclosingMethod().getName());
}