Package org.w3c.tools.resources

Examples of org.w3c.tools.resources.Attribute


  }
  // Run the query, and display results:
  System.out.println("+ attributes: ");
  AttributeDescription attrs[]   = getAttributes();
  for (int i = 0 ; i < attrs.length ; i++) {
      Attribute att = attrs[i].getAttribute();
      if (att.checkFlag(Attribute.EDITABLE)) {
    Object value = attrs[i].getValue();
    if (value != null) {
        if (att instanceof SimpleAttribute) {
      SimpleAttribute sa = (SimpleAttribute) att;
      prt.println("\t"+att.getName()+"="+
            sa.pickle(attrs[i].getValue()));
        } else if (att instanceof ArrayAttribute) {
      ArrayAttribute aa = (ArrayAttribute) att;
      String values[] = aa.pickle(attrs[i].getValue());
      prt.print("\t"+att.getName()+"=");
      for (int j = 0 ; j < values.length ; j++) {
          if (j != 0)
        prt.print(" | ");
          prt.print(values[j]);
      }
        }
    }
    else
        prt.println("\t"+att.getName()+" <undef>");
      }
  }
    }
View Full Code Here


  this.classes = new String[vclasses.size()];
  vclasses.copyInto(this.classes);
  this.interfaces = new String[vinterfaces.size()];
  vinterfaces.copyInto(this.interfaces);
  //build attributes description
  Attribute attrs  [] = resource.getAttributes();
  Vector vattrs = new Vector(10);
  for (int j = 0 ; j < attrs.length ; j++) {
      Object value = resource.getValue(j, null);
      if (value instanceof ResourceFrame[]) {
    ResourceFrame frames[] = (ResourceFrame[])value;
View Full Code Here

     */

    protected Hashtable mergeDefaultAttributes(Resource template,
                 String ext,
                 Hashtable into) {
  Attribute    attrs[] = template.getAttributes();
  ResourceReference rr = loadExtension(ext) ;
  if (rr != null) {
      try {
    Resource e       = rr.lock() ;
    if ( e != null ) {
View Full Code Here

  Object oldval, newval;
  String atname;

  try {
      Resource frame = frameref.lock();
      Attribute attrs[] = frame.getAttributes();
      for (int i = 0 ; i < attrs.length ; i++) {
    atname = attrs[i].getName();
    try {
        oldval = origFrame.getValue(atname, null);
        if (oldval == null) { // not defined, try to merge
View Full Code Here

  throws IOException
    {
  level++;
  indent();
  startResourceDescr(holder);
  Attribute attrs  [] = holder.getAttributes();
  for (int j = 0 ; j < attrs.length ; j++) {
      Object value = holder.unsafeGetValue(j, null);
      //if (value != null)
      if (! attrs[j].checkFlag(Attribute.DONTSAVE))
    writeAttribute(attrs[j], value, true);
View Full Code Here

  throws IOException
    {
  level++;
  indent();
  startResource(holder);
  Attribute attrs  [] = holder.getAttributes();
  for (int j = 0 ; j < attrs.length ; j++) {
      Object value = holder.unsafeGetValue(j, null);
      //if (value != null)
      if (! attrs[j].checkFlag(Attribute.DONTSAVE))
    writeAttribute(attrs[j], value, false);
View Full Code Here

  } else if (iname == iRESARRAY_TAG) {
      resourceSetStack.push(new Vector(10));
      String attrclass = attributes.getValue(CLASS_ATTR);
      try {
    Class     c    = Class.forName(attrclass);
    Attribute attr = (Attribute)c.newInstance();
    attr.setName(attributes.getValue(NAME_ATTR));
    FAStack.push(attr);
      } catch (Exception ex) {
    ex.printStackTrace();
    throw new SAXException("Unable to create an instance of "+
               attrclass);
View Full Code Here

    protected void writeAttributeDescription(AttributeDescription descr)
  throws IOException
    {
  level++;
  String    classname = descr.getClassName();
  Attribute attr      = descr.getAttribute();
  Object    value     = descr.getValue();
  if (attr instanceof SimpleAttribute) {
      indent();
      writer.write("<"+ATTRIBUTE_TAG+" "+NAME_ATTR+"='");
      writer.write(descr.getName());
      writer.write("' "+FLAG_ATTR+"='");
      writer.write(attr.getFlag());
      writer.write("' "+CLASS_ATTR+"='");
      writer.write(classname);
      if (value == null) {
    writer.write("'>"+NULL);
      } else {
    writer.write("'>");
    writer.write(encode(((SimpleAttribute)attr).pickle(value)));
      }
      writer.write("</");
      writer.write(ATTRIBUTE_TAG);
      writer.write(">\n");
  } else if (attr instanceof ArrayAttribute) {
      indent();
      writer.write('<');
      writer.write(ARRAY_TAG);
      writer.write(' ');
      writer.write(NAME_ATTR);
      writer.write("='");
      writer.write(descr.getName());
      writer.write("' ");
      writer.write(FLAG_ATTR);
      writer.write("='");
      writer.write(attr.getFlag());
      writer.write("' ");
      writer.write(CLASS_ATTR);
      writer.write("='");
      writer.write(classname);
      writer.write("' ");
View Full Code Here

TOP

Related Classes of org.w3c.tools.resources.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.