Examples of NamedNodeMap


Examples of org.w3c.dom.NamedNodeMap

  private Hashtable getIdentifiers(Document interfaceDescription)
      throws XException
  {
    Hashtable identifiers = new Hashtable();
    NamedNodeMap attributes = null;
    Node attribute = null;
    NodeList recordTypes = interfaceDescription
        .getElementsByTagName("RecordType");
    if (recordTypes.getLength() < 1)
    {
      throw new XException(Constants.LOCATION_INTERN,
          Constants.LAYER_PROTOCOL,
          Constants.PACKAGE_PROTOCOL_BYTEARRAYLIST, "14");
    }
    Node recordType;
    Node nameNode;
    String identifierString;
    String identifierName;
    for (int i = 0; i < recordTypes.getLength(); i++)
    {
      recordType = recordTypes.item(i);
      attributes = recordType.getAttributes();
      attribute = attributes.getNamedItem("Identifier");
      if (attribute != null)
      {
        identifierString = attribute.getNodeValue();
      }
      else
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

    Hashtable fields = new Hashtable();

    NodeList recordtypes = interfaceDescription
        .getElementsByTagName("RecordTypeSpec");

    NamedNodeMap attributes;
    Node attribute;
    String identifierString;
    NodeList fieldNodes;
    Node node;
    Field field = null;
    Node name, length;
    List fieldList;

    for (int i = 0; i < recordtypes.getLength(); i++)
    {
      Node recordtype = recordtypes.item(i);
      attributes = recordtype.getAttributes();
      attribute = attributes.getNamedItem("Name");
      if (attribute != null)
      {
        identifierString = attribute.getNodeValue();
      }
      else
      {
        throw new XException(Constants.LOCATION_INTERN,
            Constants.LAYER_PROTOCOL,
            Constants.PACKAGE_PROTOCOL_BYTEARRAYLIST, "15");
      }

      fieldList = new Vector();
      fieldNodes = recordtype.getChildNodes();
      for (int k = 0; k < fieldNodes.getLength(); k++)
      {
        node = fieldNodes.item(k);
        if (("Field".equals(node.getNodeName()))
            && (node.getNodeType() == Node.ELEMENT_NODE))
        {
          field = new Field();
          attributes = node.getAttributes();
          name = attributes.getNamedItem("Name");
          if (name != null)
          {
            field.name = name.getNodeValue();
          }
          else
          {
            throw new XException(Constants.LOCATION_INTERN,
                Constants.LAYER_PROTOCOL,
                Constants.PACKAGE_PROTOCOL_BYTEARRAYLIST, "16");
          }
          length = attributes.getNamedItem("Length");
          if (length != null)
          {
            try
            {
              field.length = Integer.parseInt(length
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

      if (!nodeName.equalsIgnoreCase("key")) {
         log.severe("The root node must be named \"key\"\n" + this.keyData.toXml());
         throw new XmlBlasterException(this.glob, ErrorCode.USER_ILLEGALARGUMENT, ME+".WrongRootNode", "The root node must be named \"key\"\n" + this.keyData.toXml());
      }

      NamedNodeMap attributes = node.getAttributes();
      if (attributes != null && attributes.getLength() > 0) {
         int attributeCount = attributes.getLength();
         for (int i = 0; i < attributeCount; i++) {
            Attr attribute = (Attr)attributes.item(i);

            if (attribute.getNodeName().equalsIgnoreCase("oid")) {
               //String val = attribute.getNodeValue();
               attribute.setNodeValue(getOid());
            }
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

  /** map an array of attributes to RDF */
 
  public void toRDF(Resource subject, Node node, attribute[] attribute, Context ctx)
  throws Exception {
    Model m = subject.getModel();
    NamedNodeMap atts = node.getAttributes();
    // expand attribute names
    Map<String,Node> map = new HashMap<String,Node>();
    for (int i=0; i<atts.getLength(); i++) {
      // xmlns declaration
      if (atts.item(i).getNodeName().startsWith("xmlns")) {
        // set the namespace definition on the model
        String name = atts.item(i).getNodeName();
        String prefix = "";
        if (name.indexOf(":")>=0) {
          prefix = name.substring("xmlns:".length());
          String ns = atts.item(i).getNodeValue();
          if (!ns.equals(XMLBean.XML) && !ns.equals(schema.XSI))
            addPrefixes(prefix,ns,m);
        }
        continue;
      }
      else {
        String name = expandQName((Attr) atts.item(i),ctx);
        // The XML namespace is disallowed in RDF
        if (!name.startsWith(XMLBean.XML)) map.put(name,atts.item(i));
      }
    }   
    for (int i = 0; attribute != null && i < attribute.length; i++) {
      attribute def = attribute[i].getDefinition(m,ctx);
      if (def==null) {
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

  }

  public void declareGlobalNS(Model model, Context ctx) {
    addPrefix("rdf",RDF.getURI(),model);
    if (_node instanceof Element) {
      NamedNodeMap m = ((Element)_node).getAttributes();
      for (int i=0; i<m.getLength(); i++) {
        Attr a = (Attr) m.item(i);
        if (a.getName().startsWith("xmlns:")) {
          String ns = a.getValue();
          addPrefixes(a.getName().substring("xmlns:".length()),ns,model);
        }
      }   
    }
   
    // add anonymous namespace declaration   
    if (_node instanceof Element) {
      NamedNodeMap m = ((Element)_node).getAttributes();
      for (int i=0; i<m.getLength(); i++) {
        Attr a = (Attr) m.item(i);
        if (a.getName().equals("xmlns")) {
          String ns = a.getValue();
          if (!model.getNsPrefixMap().containsValue(terminateNS(ns)))
            addPrefix(ctx.createNSPrefix(),ns,model);
          break;
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

    private String getValue(Node node) {
        String value = "";
        if (node.getValue() != null) {
            value = node.getValue();
        } else {
            NamedNodeMap attributes = node.getAttributes();
            if (attributes != null) {
                for (int i = 0; i < attributes.getLength(); i++) {
                    org.w3c.dom.Node attr = attributes.item(i);
                    value += attr.getTextContent();
                    if (i + 1 != attributes.getLength()) {
                        value += ",";
                    }
                }
            }
        }
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

    if (base!=null) {
      String uri = expandQName(ctx.getDefaultNS(),base,ctx.getModel());
      if (uri.startsWith(schema.XSD_URI) && uri.endsWith("#ID")) return getValue(element);
    }
    // check the attributes for ID
    NamedNodeMap m = element.getAttributes();
    // there may be no attributes defined (check for null attribute)
    String id=null;
    for (int i = 0; id==null && _attribute != null && i < _attribute.length; i++) {
      String n = _attribute[i].getName();
      Attr a = (Attr) (n==null?null:m.getNamedItem(n));
      // the attribute may not have any occurrences
      id = _attribute[i].getID(a, ctx);
    }
    return id;
  }
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

  {
    Vector fields = new Vector();

    Field field;
    Node node, name, value, length, format;
    NamedNodeMap attributes;
    for (int i = 0; i < nodes.getLength(); i++)
    {
      node = nodes.item(i);

      if ((TAG_FIELD.equals(node.getNodeName()))
          && (node.getNodeType() == Node.ELEMENT_NODE))
      {
        field = new Field();
        attributes = node.getAttributes();

        name = attributes.getNamedItem(ATTRIBUTE_NAME);
        if (name != null)
        {
          field.name = name.getNodeValue();
        }
        else
        {
          throw new XException(Constants.LOCATION_EXTERN,
              Constants.LAYER_TECHNICAL,
              Constants.PACKAGE_TECHNICAL_AS400, "50");
        }

        value = attributes.getNamedItem(ATTRIBUTE_VALUE);
        if (value != null)
        {
          field.value = value.getNodeValue();
        }
        else
        {
          field.value = null;
        }

        format = attributes.getNamedItem(ATTRIBUTE_FORMAT);
        if (format != null)
        {
          field.format = format.getNodeValue();
        }
        else
        {
          throw new XException(Constants.LOCATION_EXTERN,
              Constants.LAYER_TECHNICAL,
              Constants.PACKAGE_TECHNICAL_AS400, "51");
        }

        if (FORMAT_DATE.equals(field.format))
        {
          field.length = Constants.AS400_CALL_DATE_FORMAT.length();
        }
        else
        {
          length = attributes.getNamedItem(ATTRIBUTE_LENGTH);
          if (length != null)
          {
            try
            {
              field.length = Integer.parseInt(length
View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

   */
  public static String getAttribute(Node node, String attr)
  {
    String retText = null;

    NamedNodeMap attributes = node.getAttributes();
    // its attributes
    boolean textFound = false;
    // for terminating search loop
    for (int j = 0; (!textFound) && (j < attributes.getLength()); j++)
    { // loop over attributes
      if (attributes.item(j).getNodeName().equals(attr))
      { // searched attribute found
        retText = attributes.item(j).getNodeValue();
        // return its value
        textFound = true;
      } // if (attributes.item(j).getNodeName().equals(attr))
    } // for (int j = 0;(!textFound) && (j < attributes.getLength()); j++)

View Full Code Here

Examples of org.w3c.dom.NamedNodeMap

        nl = root.getElementsByTagName(ELM_URL);
        if (nl != null && nl.getLength() > 0) {
          Node urlNode = null;
          for (int i = 0; i < nl.getLength(); i++) {
            urlNode = nl.item(i);
            NamedNodeMap attmap = urlNode.getAttributes();
            Node typeNode = attmap.getNamedItem(ATT_TYPE);
            if (typeNode != null) {
              type = typeNode.getNodeValue();
              if (type.equals("text/xml")) {
                type = OpenSearchService.TYPE_SYND;             
                break;
              } else if (type.equals("application/vnd.gn-opensearch+json")){
                type = OpenSearchService.TYPE_GN_JSON;                 
                break;
              }else{
                urlNode = null;
              }
            }
          }
          if (urlNode != null) {
            NamedNodeMap attmap = urlNode.getAttributes();
            if(attmap.getLength() > 0){
              Node templateNode = attmap.getNamedItem(ATT_TEMPLATE);
              if (templateNode != null) {
                urlpttn = templateNode.getNodeValue();             
              }
            }
            if(urlpttn == null){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.