本文整理汇总了Java中com.sun.xml.xsom.XSAttributeUse.getDecl方法的典型用法代码示例。如果您正苦于以下问题:Java XSAttributeUse.getDecl方法的具体用法?Java XSAttributeUse.getDecl怎么用?Java XSAttributeUse.getDecl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.xsom.XSAttributeUse
的用法示例。
在下文中一共展示了XSAttributeUse.getDecl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attributeUse
import com.sun.xml.xsom.XSAttributeUse; //导入方法依赖的package包/类
public void attributeUse( XSAttributeUse use ) {
XSAttributeDecl decl = use.getDecl();
String additionalAtts="";
if(use.isRequired())
additionalAtts += " use=\"required\"";
if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null)
additionalAtts += " fixed=\""+use.getFixedValue()+'\"';
if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null)
additionalAtts += " default=\""+use.getDefaultValue()+'\"';
if(decl.isLocal()) {
// this is anonymous attribute use
dump(decl,additionalAtts);
} else {
// reference to a global one
println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>",
new Object[]{ decl.getTargetNamespace(), decl.getName(),
additionalAtts }));
}
}
示例2: iterateAttributeUses
import com.sun.xml.xsom.XSAttributeUse; //导入方法依赖的package包/类
public Iterator<XSAttributeUse> iterateAttributeUses() {
XSComplexType baseType = getBaseType().asComplexType();
if( baseType==null ) return super.iterateAttributeUses();
return new Iterators.Union<XSAttributeUse>(
new Iterators.Filter<XSAttributeUse>(baseType.iterateAttributeUses()) {
protected boolean matches(XSAttributeUse value) {
XSAttributeDecl u = value.getDecl();
UName n = new UName(u.getTargetNamespace(),u.getName());
return !prohibitedAtts.contains(n);
}
},
super.iterateAttributeUses() );
}
示例3: attributeUse
import com.sun.xml.xsom.XSAttributeUse; //导入方法依赖的package包/类
public void attributeUse( XSAttributeUse use ) {
XSAttributeDecl decl = use.getDecl();
String additionalAtts="";
if(use.isRequired())
additionalAtts += " use=\"required\"";
if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null)
additionalAtts += " fixed=\""+use.getFixedValue()+'\"';
if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null)
additionalAtts += " default=\""+use.getDefaultValue()+'\"';
if(decl.isLocal()) {
// this is anonymous attribute use
dump(decl,additionalAtts);
} else {
// reference to a global one
println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>",
decl.getTargetNamespace(), decl.getName(), additionalAtts));
}
}
示例4: attributeUse
import com.sun.xml.xsom.XSAttributeUse; //导入方法依赖的package包/类
public XmlForm attributeUse(XSAttributeUse use) {
boolean required = use.isRequired();
if (log.isDebugEnabled())
log.debug("Attribute Use: " + use +
", Required: " + required);
XSAttributeDecl decl = use.getDecl();
XmlForm xmlForm = decl.apply(this);
if (required) {
Form form = xmlForm.getForm();
if (form instanceof FormElement<?>)
((FormElement<?>) form).setRequired(true);
}
return xmlForm;
}
示例5: attributeUse
import com.sun.xml.xsom.XSAttributeUse; //导入方法依赖的package包/类
public void attributeUse(XSAttributeUse use) {
XSAttributeDecl decl = use.getDecl();
String additionalAtts = "";
if (use.isRequired()) {
additionalAtts += " use=\"required\"";
}
if (use.getFixedValue() != null
&& use.getDecl().getFixedValue() == null) {
additionalAtts += " fixed=\"" + use.getFixedValue() + "\"";
}
if (use.getDefaultValue() != null
&& use.getDecl().getDefaultValue() == null) {
additionalAtts += " default=\"" + use.getDefaultValue() + "\"";
}
if (decl.isLocal()) {
// this is anonymous attribute use
dump(decl, additionalAtts);
}
else {
// reference to a global one
String str = MessageFormat.format(
"Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{
decl.getTargetNamespace(), decl.getName(),
additionalAtts});
SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
this.currNode.add(newNode);
}
}
示例6: attributeHolder
import com.sun.xml.xsom.XSAttributeUse; //导入方法依赖的package包/类
private Iterator<XSAttributeDecl> attributeHolder(final XSAttContainer atts) {
// TODO: check spec. is this correct?
return new Iterators.Adapter<XSAttributeDecl,XSAttributeUse>(atts.iterateAttributeUses()) {
protected XSAttributeDecl filter(XSAttributeUse u) {
return u.getDecl();
}
};
}
示例7: attributes
import com.sun.xml.xsom.XSAttributeUse; //导入方法依赖的package包/类
private void attributes(List<Form> forms,
Map<String, TextWriter> attrWriters,
Map<String, TextHandler> attrReaders,
Collection<? extends XSAttributeUse> attrs) {
for (XSAttributeUse use : attrs) {
XmlForm xmlForm = use.apply(this);
if (xmlForm != null) {
XSAttributeDecl attr = use.getDecl();
String name = attr.getName();
Form form = xmlForm.getForm();
if (form != null)
forms.add(form);
XmlWriter writer = xmlForm.getWriter();
if (writer instanceof TextXmlWriter) {
TextWriter textWriter = ((TextXmlWriter) writer).getWriter();
attrWriters.put(name, textWriter);
}
XmlReader reader = xmlForm.getReader();
TextHandler handler = null;
if (reader instanceof TextXmlReader) {
TextXmlReader textXmlReader = (TextXmlReader) reader;
handler = textXmlReader.getHandler();
} else if (reader != null)
throw new IllegalStateException("XmlReader " + reader + " cannot be assigned to an XML attribtue, TextXmlReader expected");
if (handler != null)
attrReaders.put(name, handler);
}
}
}