use of org.eclipse.wst.dtd.core.internal.emf.DTDAttribute in project webtools.sourceediting by eclipse.
the class DTDPrinter method visitAttributes.
private void visitAttributes(DTDElement elem) {
Collection attrs = elem.getDTDAttribute();
Iterator i = attrs.iterator();
if (attrs != null && i.hasNext()) {
DTDAttribute attrib = (DTDAttribute) i.next();
String comment = attrib.getComment();
if (comment != null && comment.length() > 0)
// $NON-NLS-1$ //$NON-NLS-2$
sb.append("<!--\n ").append(comment).append("\n-->\n");
// $NON-NLS-1$ //$NON-NLS-2$
sb.append("<!ATTLIST " + elem.getName() + "\n");
// $NON-NLS-1$
sb.append(" ");
updateStartOffset(attrib, sb.length());
sb.append(attrib.unparse());
updateEndOffset(attrib, sb.length());
// $NON-NLS-1$
sb.append("\n");
for (; i.hasNext(); ) {
attrib = (DTDAttribute) i.next();
comment = attrib.getComment();
if (comment != null && comment.length() > 0) {
// $NON-NLS-1$
sb.append(">\n");
if (comment != null && comment.length() > 0)
// $NON-NLS-1$ //$NON-NLS-2$
sb.append("<!--\n ").append(comment).append("\n-->\n");
// $NON-NLS-1$ //$NON-NLS-2$
sb.append("<!ATTLIST " + elem.getName() + "\n");
}
// $NON-NLS-1$
sb.append(" ");
updateStartOffset(attrib, sb.length());
sb.append(attrib.unparse());
updateEndOffset(attrib, sb.length());
// $NON-NLS-1$
sb.append("\n");
}
// $NON-NLS-1$
sb.append(">\n");
}
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDAttribute in project webtools.sourceediting by eclipse.
the class DTDModelBuilder method hasIDAttribute.
public boolean hasIDAttribute(DTDAttribute dtdattr) {
boolean hasID = false;
DTDElement element = dtdattr.getDTDElement();
EList attrs = element.getDTDAttribute();
Iterator i = attrs.iterator();
while (i.hasNext()) {
DTDAttribute attr = (DTDAttribute) i.next();
DTDType dType = attr.getDTDType();
if (dType instanceof DTDBasicType) {
if (((DTDBasicType) dType).getKind().getValue() == DTDBasicTypeKind.ID) {
hasID = true;
break;
}
}
}
return hasID;
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDAttribute in project webtools.sourceediting by eclipse.
the class DTDModelBuilder method addAttribute.
/**
* Create a DTDAttribute from the xml4j attribute
*/
public void addAttribute(DTDElement dtdelement, AttNode ad) {
DTDAttribute dtdattr = getFactory().createDTDAttribute();
dtdelement.getDTDAttribute().add(dtdattr);
finishAttribute(dtdattr, ad);
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDAttribute in project webtools.sourceediting by eclipse.
the class DTDElementImpl method getAttributeDetail.
public String getAttributeDetail() {
// $NON-NLS-1$
String attributeString = "";
Collection attributes = getDTDAttribute();
if (attributes != null) {
boolean seenOne = false;
for (java.util.Iterator i = attributes.iterator(); i.hasNext(); ) {
if (seenOne) {
// $NON-NLS-1$
attributeString = attributeString + ", ";
} else {
seenOne = true;
}
// end of else
attributeString = attributeString + ((DTDAttribute) i.next()).getName();
}
}
// end of if ()
return attributeString;
}
Aggregations