Package org.jdom

Examples of org.jdom.Attribute


  }

  private IConstructor convertElement(Element e, boolean trim) {
    IListWriter kids = vf.listWriter(Factory.Node);
    for (Object o: e.getAttributes()) {
      Attribute attr = (Attribute)o;
      IString key = vf.string(attr.getName());
      IString val = vf.string(attr.getValue());

      kids.insert(vf.constructor(Factory.Node_attribute, convertNamespace(attr.getNamespace()), key, val));
    }

    int len = e.getContentSize();
    for (int i = 0; i < len; i++) {
      try {
View Full Code Here


                xsdPrefix = namespaceMap.get(XmlConstants.XSD);
            }
           
            Element e = new Element("schema", xsdPrefix, XmlConstants.XSD);

            e.setAttribute(new Attribute(WSDLConstants.ATTR_TNS, entry.getKey()));
           
            if (null != namespaceMap) { // did application hand us some additional namespaces?
                for (Map.Entry<String, String> mapping : namespaceMap.entrySet()) {
                    // user gives us namespace->prefix mapping.
                    e.addNamespaceDeclaration(Namespace.getNamespace(mapping.getValue(),
                                                                     mapping.getKey()));
                }
            }

            // if the user didn't pick something else, assign 'tns' as the prefix.
            if (namespaceMap == null || !namespaceMap.containsKey(entry.getKey())) {
                // Schemas are more readable if there is a specific prefix for the TNS.
                e.addNamespaceDeclaration(Namespace.getNamespace(WSDLConstants.CONVENTIONAL_TNS_PREFIX,
                                                                 entry.getKey()));
            }
            e.setAttribute(new Attribute("elementFormDefault", "qualified"));
            e.setAttribute(new Attribute("attributeFormDefault", "qualified"));

            for (Type t : entry.getValue()) {
                t.writeSchema(e);
            }
View Full Code Here

                Object obj = i.next();
                if (obj instanceof Element) {
                    Element elem = (Element) obj;
                    text = elem.getText().trim();
                } else if (obj instanceof Attribute) {
                    Attribute att = (Attribute) obj;
                    text = att.getValue().trim();
                } else if (obj instanceof Text) {
                    Text txt = (Text) obj;
                    text = txt.getText().trim();
                } else if (obj instanceof Comment) {
                    Comment com = (Comment) obj;
View Full Code Here

                    Element elem = (Element) node;
                    if (StringUtils.isNotBlank(elem.getText())) {
                        metadata.add(name, elem.getText().trim());
                    }
                } else if (node instanceof Attribute) {
                    Attribute att = (Attribute) node;
                    metadata.add(name, att.getValue());
                } else if (node instanceof Text) {
                    Text text = (Text) node;
                    metadata.add(name, text.getText());
                } else if (node instanceof Comment) {
                    Comment com = (Comment) node;
View Full Code Here

     * @return
     */
    public String getBaseUrl() {
        Element onlineResource = tiledPatterns.getChild("OnlineResource"); //$NON-NLS-1$
        Namespace xlink = onlineResource.getNamespace("xlink"); //$NON-NLS-1$
        Attribute href = onlineResource.getAttribute("href", xlink); //$NON-NLS-1$       
        String baseUrl = href.getValue();
       
        return baseUrl;
    }
View Full Code Here

 
  private FitsMetadataElement buildMetdataIElements(Element node) {
    FitsMetadataElement element = new FitsMetadataElement();
    element.setName(node.getName());
    element.setValue(node.getValue());
    Attribute toolName = node.getAttribute("toolname");
    if(toolName != null) {
      element.setReportingToolName(toolName.getValue());
    }
    Attribute toolVersion = node.getAttribute("toolversion");
    if(toolVersion != null) {
      element.setReportingToolVersion(toolVersion.getValue());
    }
    Attribute status = node.getAttribute("status");
    if(status != null) {
      element.setStatus(status.getValue());
    }
    return element;
  }
View Full Code Here

 
  public ToolMap(Element element) {
     toolName = element.getAttribute("name").getValue();
     toolVersion = null;
     //version is optional
     Attribute vAttr = element.getAttribute("version");
     if(vAttr != null) {
       toolVersion = vAttr.getValue();
     }

     List<Element> tool_children = element.getChildren("mime");
     for(Element mime : tool_children) {
       String types = mime.getAttributeValue("type");
View Full Code Here

      XPath xpath = XPath.newInstance("//fits:identity");
      Namespace ns = Namespace.getNamespace("fits",Fits.XML_NAMESPACE);
      xpath.addNamespace(ns);
      List<Element> identElements = xpath.selectNodes(dom);
      for(Element element : identElements) {
        Attribute formatAttr = element.getAttribute("format");
        Attribute mimetypeAttr = element.getAttribute("mimetype");
        Element versionElement = element.getChild("version",ns);
       
        String format = null;
        String mimetype = null;
        String version = null;
       
        if(formatAttr != null) {
          format = formatAttr.getValue();
        }
        if(mimetypeAttr != null) {
          mimetype = mimetypeAttr.getValue();
        }
        if(versionElement != null) {
          version = versionElement.getText();
        }
        ToolIdentity identity = new ToolIdentity(mimetype,format,version,info);
View Full Code Here

      List<Element> identElements = xpath.selectNodes(fitsXml);
      for(Element element : identElements) {
        FitsIdentity fileIdentSect = new FitsIdentity();
       
        //get the identity attributes
        Attribute formatAttr = element.getAttribute("format");
        Attribute mimetypeAttr = element.getAttribute("mimetype");
        if(formatAttr != null) {
          fileIdentSect.setFormat(formatAttr.getValue());
        }
        if(mimetypeAttr != null) {
          fileIdentSect.setMimetype(mimetypeAttr.getValue());
        }
       
        //get the tool elements
        List<Element> toolElements = element.getChildren("tool",ns);
        for(Element toolElement : toolElements) {
          ToolInfo toolInfo = new ToolInfo();
          Attribute toolNameAttr = toolElement.getAttribute("toolname");
          Attribute toolVersionAttr = toolElement.getAttribute("toolversion");
          if(toolNameAttr != null) {
            toolInfo.setName(toolNameAttr.getValue());
          }
          if(toolVersionAttr != null) {
            toolInfo.setVersion(toolVersionAttr.getValue());
          }
          fileIdentSect.addReportingTool(toolInfo);
        }
       
        //get the version elements
        List<Element> versionElements = element.getChildren("version",ns);
        for(Element versionElement : versionElements) {
          ToolInfo toolInfo = new ToolInfo();
          Attribute toolNameAttr = versionElement.getAttribute("toolname");
          Attribute toolVersionAttr = versionElement.getAttribute("toolversion");
          if(toolNameAttr != null) {
            toolInfo.setName(toolNameAttr.getValue());
          }
          if(toolVersionAttr != null) {
            toolInfo.setVersion(toolVersionAttr.getValue());
          }
          String value = versionElement.getText();
          FormatVersion formatVersion = new FormatVersion(value,toolInfo);
          fileIdentSect.addFormatVersion(formatVersion);
        }
       
        //get the externalIdentifier elements
        List<Element> xIDElements = element.getChildren("externalIdentifier",ns);
        for(Element xIDElement : xIDElements) {
          String type = xIDElement.getAttributeValue("type");
          String value = xIDElement.getText();
          ToolInfo toolInfo = new ToolInfo();
          Attribute toolNameAttr = xIDElement.getAttribute("toolname");
          Attribute toolVersionAttr = xIDElement.getAttribute("toolversion");
          if(toolNameAttr != null) {
            toolInfo.setName(toolNameAttr.getValue());
          }
          if(toolVersionAttr != null) {
            toolInfo.setVersion(toolVersionAttr.getValue());
          }
          ExternalIdentifier xid = new ExternalIdentifier(type,value,toolInfo);
          fileIdentSect.addExternalID(xid);
        }
        identities.add(fileIdentSect);
View Full Code Here

  }
 
  private Document createXml(File file) throws FitsToolException {

    Element root = new Element("fits",fitsNS);
    root.setAttribute(new Attribute("schemaLocation","http://hul.harvard.edu/ois/xml/ns/fits/fits_output "+Fits.externalOutputSchema,xsiNS));
   
    if(file.getPath().toLowerCase().endsWith(".adl")) { 
     
      String adlVersion = null;
      String adlCreator = null;
View Full Code Here

TOP

Related Classes of org.jdom.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.