Package org.w3c.dom

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


    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

    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

  {
    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

   */
  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

        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

    */
   public static void checkForRelativeNamespace(Element ctxNode)
           throws CanonicalizationException {

      if (ctxNode != null) {
         NamedNodeMap attributes = ctxNode.getAttributes();

         for (int i = 0; i < attributes.getLength(); i++) {
            C14nHelper.assertNotRelativeNS((Attr) attributes.item(i));
         }
      } else {
         throw new CanonicalizationException(
            "Called checkForRelativeNamespace() on null");
      }
View Full Code Here

                        // non default namespace
                        return namespace;
                    }
                }
                if (this.hasAttributes()) {
                    NamedNodeMap map = this.getAttributes();
                    int length = map.getLength();
                    for (int i=0;i<length;i++) {
                        Node attr = map.item(i);
                        String attrPrefix = attr.getPrefix();
                        String value = attr.getNodeValue();
                        namespace = attr.getNamespaceURI();
                        if (namespace !=null && namespace.equals("http://www.w3.org/2000/xmlns/")) {
                            // at this point we are dealing with DOM Level 2 nodes only
View Full Code Here

                       
                            }                      
                    }
                }
               
                NamedNodeMap attributes = (node.hasAttributes()) ? node.getAttributes() : null;
                if (attributes != null) {
                    for (int i = 0; i < attributes.getLength(); ++i) {
                        Attr attr = (Attr) attributes.item(i);
                        fLocator.fRelatedNode = attr;
                        DOMNormalizer.isAttrValueWF( fErrorHandler, fError, fLocator,
                                      attributes, attr, attr.getValue(), xml11Version);
                        if (verifyNames) {
                            wellformed = CoreDocumentImpl.isXMLName( attr.getNodeName(), xml11Version);
View Full Code Here

      Node wk = ctx;
     
      while (wk != null) {

        NamedNodeMap atts = wk.getAttributes();
        int length;
        if (atts != null)
          length = atts.getLength();
        else
          length = 0;

        for (int i = 0 ; i < length ; ++i) {
          Node att = atts.item(i);
          if (att.getNodeName().startsWith("xmlns:") ||
            att.getNodeName().equals("xmlns")) {
         
            // Check to see if this node has already been found
            Node p = ctx;
            boolean found = false;
            while (p != wk) {
              NamedNodeMap tstAtts = p.getAttributes();
              if (tstAtts != null &&
                tstAtts.getNamedItem(att.getNodeName()) != null) {
                found = true;
                break;
              }
              p = p.getParentNode();
            }
View Full Code Here

TOP

Related Classes of org.w3c.dom.NamedNodeMap

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.