本文整理汇总了Java中com.sun.xml.xsom.XSElementDecl.getType方法的典型用法代码示例。如果您正苦于以下问题:Java XSElementDecl.getType方法的具体用法?Java XSElementDecl.getType怎么用?Java XSElementDecl.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.xsom.XSElementDecl
的用法示例。
在下文中一共展示了XSElementDecl.getType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComplexTypeToElementName
import com.sun.xml.xsom.XSElementDecl; //导入方法依赖的package包/类
private Map<QName, List<QName>> getComplexTypeToElementName(ClassOutline classOutline) {
Map<QName, List<QName>> complexTypeToElementName = new HashMap<QName, List<QName>>();
XSSchemaSet schemaSet = classOutline.target.getSchemaComponent().getRoot();
for (XSSchema schema : schemaSet.getSchemas()) {
Map<String, XSElementDecl> elemDecls = schema.getElementDecls();
for (Entry<String, XSElementDecl> entry : elemDecls.entrySet()) {
XSElementDecl decl = entry.getValue();
XSType xsType = decl.getType();
if (xsType.getName() == null) {
continue;
}
QName type = new QName(xsType.getTargetNamespace(), xsType.getName());
List<QName> qnames = complexTypeToElementName.get(type);
if (qnames == null) {
qnames = new ArrayList<QName>();
complexTypeToElementName.put(type, qnames);
}
qnames.add(new QName(decl.getTargetNamespace(), decl.getName()));
}
}
return complexTypeToElementName;
}
示例2: elementDecl
import com.sun.xml.xsom.XSElementDecl; //导入方法依赖的package包/类
/**
* Creates node for element declaration with additional attributes.
*
* @param decl Element declaration.
* @param extraAtts Additional attributes.
*/
private void elementDecl(XSElementDecl decl, String extraAtts) {
XSType type = decl.getType();
// TODO: various other attributes
String str = MessageFormat.format("Element name=\"{0}\"{1}{2}",
new Object[]{
decl.getName(),
type.isLocal() ? "" : " type=\"{"
+ type.getTargetNamespace() + "}"
+ type.getName() + "\"", extraAtts});
SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
this.currNode.add(newNode);
this.currNode = newNode;
if (type.isLocal()) {
if (type.isLocal()) {
type.visit(this);
}
}
this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
示例3: elementDecl
import com.sun.xml.xsom.XSElementDecl; //导入方法依赖的package包/类
private void elementDecl( XSElementDecl decl, String extraAtts ) {
XSType type = decl.getType();
// TODO: various other attributes
println(MessageFormat.format("<element name=\"{0}\"{1}{2}{3}>",
new Object[]{
decl.getName(),
type.isLocal()?"":" type=\"{"+
type.getTargetNamespace()+'}'+
type.getName()+'\"',
extraAtts,
type.isLocal()?"":"/"
}));
if(type.isLocal()) {
indent++;
if(type.isLocal()) type.visit(this);
indent--;
println("</element>");
}
}
示例4: getPossibleValues
import com.sun.xml.xsom.XSElementDecl; //导入方法依赖的package包/类
/**
* Retrieves allowed values for a restricted type
*
* @param inputName
* SOAP input
* @return allowed values for the input or an empty list if the type of the
* input is not a string restriction
*/
public List<String> getPossibleValues(String inputName) {
List<String> values = new ArrayList<String>();
XSElementDecl element = schemaElements.get(inputName);
if (element == null)
return values;
XSType type = element.getType();
if (type == null || !(type instanceof XSRestrictionSimpleType))
return values;
XSRestrictionSimpleType res = (XSRestrictionSimpleType) type;
String baseType = res.getBaseType().getName();
// allow only xsd:string "enumerations"
if (!baseType.equals("string"))
return values;
for (XSFacet facet : res.getDeclaredFacets()) {
String value = facet.getValue().toString();
values.add(value);
}
return values;
}
示例5: elementDecl
import com.sun.xml.xsom.XSElementDecl; //导入方法依赖的package包/类
@Override
public void elementDecl(XSElementDecl element)
{
String elementName = element.getName();
// If the current element has the name being searched store its type
if (elementName.equals(this.searchName))
{
this.searchElement = element;
// If the element does not refer to a type then return its content type
// (Example create element)
}
// otherwise dig the content of the elements type
else if (! ( elementName.equals(XMLTags.FIRST_CONDITION_TAG) || elementName.equals(XMLTags.SECOND_CONDITION_TAG) ))
{
XSType elementType = element.getType();
XSComplexType elementComplexType = elementType.asComplexType();
// if the type of the element is a complex type
// visit whatever it has in its content.
if (elementComplexType != null)
{
elementComplexType.getContentType().visit(this);
}
}
}
示例6: elementDecl
import com.sun.xml.xsom.XSElementDecl; //导入方法依赖的package包/类
public XmlForm elementDecl(XSElementDecl decl) {
if (log.isDebugEnabled())
log.debug("Element Declaration: " + decl);
XSType type = decl.getType();
if (type.isSimpleType())
return elementDeclSimple(decl, type.asSimpleType());
else
return elementDeclComplex(decl, type.asComplexType());
}
示例7: elementDecl
import com.sun.xml.xsom.XSElementDecl; //导入方法依赖的package包/类
private void elementDecl( XSElementDecl decl, String extraAtts ) {
XSType type = decl.getType();
// TODO: various other attributes
// qualified attr; Issue
if(decl.getForm() != null) {
extraAtts += " form=\"" + (decl.getForm() ? "qualified" : "unqualified" ) + "\"";
}
StringBuffer buf = new StringBuffer();
XSElementDecl substGrp = decl.getSubstAffiliation();
if (substGrp != null) {
buf.append(" substitutionGroup=\"{")
.append(substGrp.getTargetNamespace())
.append("}")
.append(substGrp.getName())
.append("\"");
}
println(MessageFormat.format("<element name=\"{0}\"{1}{2}{3}{4}>",
decl.getName(),
type.isLocal()?"":" type=\"{"+
type.getTargetNamespace()+'}'+
type.getName()+'\"',
extraAtts,
buf.toString(),
type.isLocal()?"":"/"));
if(type.isLocal()) {
indent++;
if(type.isLocal()) type.visit(this);
indent--;
println("</element>");
} else {
}
}