本文整理汇总了Java中org.eclipse.xsd.XSDAnnotation类的典型用法代码示例。如果您正苦于以下问题:Java XSDAnnotation类的具体用法?Java XSDAnnotation怎么用?Java XSDAnnotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XSDAnnotation类属于org.eclipse.xsd包,在下文中一共展示了XSDAnnotation类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapXSDAnnotation
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.HELPER)
public static Boolean mapXSDAnnotation(final XSDAnnotation self, final Element owner) {
final Iterator<org.w3c.dom.Element> elements = self.getUserInformation().iterator();
if (elements.hasNext()) {
final Comment theComment = UMLFactory.eINSTANCE.createComment();
final StringBuilder b = new StringBuilder();
b.append(elements.next().getTextContent());
while (elements.hasNext()) {
b.append('\n');
b.append(elements.next().getTextContent());
}
theComment.setBody(b.toString());
owner.getOwnedComments().add(theComment);
return true;
}
return false;
}
示例2: findElementByTag
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
private static Element findElementByTag(final XSDAnnotation annotation, final String qualifiedName) {
for (final Element appinfo : annotation.getApplicationInformation()) {
final NodeList elements = appinfo.getElementsByTagName(qualifiedName);
if (elements.getLength() > 0) {
return (Element) elements.item(0);
}
}
return null;
}
示例3: getOrCreateAppinfoElement
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
public static Element getOrCreateAppinfoElement(final XSDAnnotation annotation, final String qualifiedName) {
final Element element = findElementByTag(annotation, qualifiedName);
if (element == null) {
return createAppinfoElement(annotation, qualifiedName);
}
return element;
}
示例4: setAppinfoElement
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.HELPER)
public static void setAppinfoElement(final XSDAnnotation self, final String elementName, final String name,
final String namespace) {
final String qualifiedName = prefix(elementName, APPINFO_NAMESPACE);
final String nameTag = prefix("name", APPINFO_NAMESPACE);
final String namespaceTag = prefix("namespace", APPINFO_NAMESPACE);
final org.w3c.dom.Element element = "AppliesTo".equals(elementName) ? createAppinfoElement(self, qualifiedName)
: getOrCreateAppinfoElement(self, qualifiedName);
setAttribute(setAttribute(element, nameTag, name), namespaceTag, namespace);
}
示例5: extendForAttributeGroupDefinition
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
/**
*
* @param el
* @param attGroup
* @param trail String trace of the recursion for finding out what went wrong
*/
private void extendForAttributeGroupDefinition(ElementDef el, XSDAttributeGroupDefinition attGroup, String trail)
throws MapperException
{
if (tooDeep(trail)) return;
// attribute group references need to be resolved
XSDAttributeGroupDefinition expandable = attGroup;
if (attGroup.isAttributeGroupDefinitionReference())
{
trail = extendTrail(trail , "/resolveAG");
trace(trail);
expandable = attGroup.getResolvedAttributeGroupDefinition();
}
trail = extendTrail(trail,"agr(" + expandable.getName() + ")");
for (Iterator<EObject> it = expandable.eContents().iterator(); it.hasNext();)
{
EObject groupPart = it.next();
if (groupPart instanceof XSDAttributeUse)
{
String newTrail = trail;
extendForAttributeUse(el, (XSDAttributeUse)groupPart,newTrail);
}
else if (groupPart instanceof XSDAnnotation) {} // silently ignore annotations
else unexpectedChild(attGroup,groupPart,3,trail);
}
}
示例6: addAppinfo
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
private static Element addAppinfo(final XSDAnnotation annotation, final Element appinfo) {
annotation.getApplicationInformation().add(appinfo);
annotation.getElement().appendChild(appinfo);
return appinfo;
}
示例7: createAppinfoElement
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
public static Element createAppinfoElement(final XSDAnnotation annotation, final String qualifiedName) {
final Element appInfo = getOrCreateAppinfo(annotation);
return (Element) appInfo.appendChild(appInfo.getOwnerDocument().createElement(qualifiedName));
}
示例8: getOrCreateAppinfo
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
private static Element getOrCreateAppinfo(final XSDAnnotation annotation) {
final List<Element> applicationInformation = annotation.getApplicationInformation();
return applicationInformation.isEmpty() ? addAppinfo(annotation, annotation.createApplicationInformation(null))
: applicationInformation.get(0);
}
示例9: getXSDAnnotationApplicationInformation
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.QUERY)
public static LinkedHashSet<Object> getXSDAnnotationApplicationInformation(final XSDAnnotation self) {
return new LinkedHashSet<Object>(self.getApplicationInformation());
}
示例10: createUserInformation
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.HELPER)
public static Object createUserInformation(final XSDAnnotation self, final String sourceURI) {
final org.w3c.dom.Element userInfo = self.createUserInformation(defaultIfBlank(sourceURI, null));
self.getElement().appendChild(userInfo);
return userInfo;
}
示例11: setAppinfo2Element
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.HELPER)
public static void setAppinfo2Element(final XSDAnnotation self, final String value, final XSDSchema owningSchema,
final String name) {
final String qualifiedName = prefix(name, APPINFO2_NAMESPACE);
setContent(getOrCreateAppinfoElement(self, qualifiedName), value);
}
示例12: setAppinfoElementValue
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.HELPER)
public static void setAppinfoElementValue(final XSDAnnotation self, final String value, final String name) {
final String qualifiedName = prefix(name, APPINFO_NAMESPACE);
setContent(getOrCreateAppinfoElement(self, qualifiedName), value);
}
示例13: extendForElementDeclaration
import org.eclipse.xsd.XSDAnnotation; //导入依赖的package包/类
/**
* Handle an element declaration, which may either invoke a named type
* or define the element structure with an anonymous type
* @param el the element whose declaration this is
* @param ed the XSD element declaration
* @param trail String trace of the recursion for finding out what went wrong
*/
private void extendForElementDeclaration(ElementDef el, XSDElementDeclaration ed, String trail)
throws MapperException
{
if (tooDeep(trail)) return;
/* resolve this Element declaration in case it is a ref to another declaration,
* and use the resolved declaration from now on */
XSDElementDeclaration resEd = ed.getResolvedElementDeclaration();
if (resEd == null) resEd = ed; // not sure if this is necessary
el.setName(getMappedStructureName(resEd));
trail = extendTrail(trail,"ed(" + resEd.getName() + ")");
String typeName = "";
XSDTypeDefinition td = resEd.getTypeDefinition();
if (td != null)
{
typeName = td.getName();
el.setExpanded(false);
}
el.setType(typeName); // set the type name to "" if there is no type attribute
/* the complex type will only be part of the contents immediately expanded
* if it is defined locally inside the element; otherwise it is left for expansion later */
for (Iterator<EObject> it = resEd.eContents().iterator(); it.hasNext();)
{
EObject edPart = it.next();
if (edPart instanceof XSDComplexTypeDefinition)
{
XSDComplexTypeDefinition ctd = (XSDComplexTypeDefinition)edPart;
typeName = ctd.getName();
// named complex type; do not expect this case to happen
if (typeName != null)
{System.out.println("Named complex type inside element declaration: '" + typeName + "'");}
// anonymous complex type; keep on expanding the tree
else if (typeName == null)
{
el.setExpanded(true);
String newTrail = trail;
extendForComplexType(el,ctd,newTrail);
}
}
else if (edPart instanceof XSDAnnotation) {}
// ignore identity constraints under element definitions
else if (edPart instanceof XSDIdentityConstraintDefinition) {}
// FIXME: we should really work out what to do with simple type definitions here
else if (edPart instanceof XSDSimpleTypeDefinition) {}
else unexpectedChild(resEd,edPart,1,trail);
}
}