Package org.w3c.dom

Examples of org.w3c.dom.NamedNodeMap


        NodeList parentNodeList = doc.getElementsByTagNameNS(wsdlParentNode.getNamespaceURI(), wsdlParentNode
            .getLocalPart());

        for (int i = 0; i < parentNodeList.getLength(); i++) {
            Node parentNode = parentNodeList.item(i);
            NamedNodeMap parentNodeMap = parentNode.getAttributes();
            Node parentAttrNode = parentNodeMap.getNamedItem(WSDLConstants.ATTR_NAME);
            if (parentAttrNode != null && parentNameValue != null
                && parentAttrNode.getNodeValue().equals(parentNameValue) || parentAttrNode == null
                || parentNameValue == null) {

                for (Node n = parentNode.getFirstChild(); n != null; n = n.getNextSibling()) {
                    if (n.getNodeType() == Node.ELEMENT_NODE) {
                        NamedNodeMap map = n.getAttributes();
                        Node attrChildNode = map.getNamedItem(WSDLConstants.ATTR_NAME);
                        if (attrChildNode != null && attrChildNode.getNodeValue().equals(childNameValue)) {
                            return n;
                        }
                    }
                }
View Full Code Here


            Node schemaNode = nodes.item(x);
            Element schemaEl = (Element)schemaNode;
            String tns = schemaEl.getAttribute("targetNamespace");

            boolean clone = true;
            NamedNodeMap defAttrs = doc.getDocumentElement().getAttributes();
            for (int i = 0; i < defAttrs.getLength(); ++i) {
                Node attr = defAttrs.item(i);
                if (attr.getNodeName().startsWith("xmlns:")) {
                    if (!schemaEl.hasAttribute(attr.getNodeName()) && clone) {
                        schemaEl = (Element)(schemaNode.cloneNode(true));
                        clone = false;
                        schemaEl.setAttribute(attr.getNodeName(), attr.getNodeValue());
View Full Code Here

      out.print("<![CDATA[" + text + "]]>");
    } else {
      // This is a normal tag
      out.print(prefix + "<" + name);
      if (node.hasAttributes()) {
        NamedNodeMap attributes = node.getAttributes();
        for (int i = 0; i < attributes.getLength(); i++) {
          Node attrib = attributes.item(i);
          out.print(" " + attrib.getNodeName() + "=\"" + attrib.getNodeValue() + "\"");
        }
      }
 
      if (! node.hasChildNodes()) {
View Full Code Here

    }
  }

  private String getContext(Node node)
  {
    NamedNodeMap attributes = node.getAttributes();
    for (int j = 0; j < attributes.getLength(); j++)
    {
      if (attributes.item(j).getNodeName().equals(CONTEXT))
      { // searched attribute found
        return attributes.item(j).getNodeValue();
      }
    }

    return "";
View Full Code Here

          Constants.LAYER_PROTOCOL,
          Constants.PACKAGE_PROTOCOL_BYTEARRAYLIST, "10");
    }

    Node identifierTag = lines.item(0);
    NamedNodeMap attributes = identifierTag.getAttributes();
    int identifierPos = getIdentifierPos(attributes);
    int identifierLength = getIdentifierLength(attributes);

    Hashtable identifiers = getIdentifiers(interfaceDescription);
View Full Code Here

    ByteArrayConverter conv = ByteArrayConverterFactory
        .getConverter(mEncodingSystem);

    NodeList records = doc.getElementsByTagName(TAG_RECORD);
    Node recordNode;
    NamedNodeMap recordAttributes;
    Attr recordLengthAttr;
    int recordLength;
    byte[] recordArray;

    NodeList fields;
    Node fieldNode;
    NamedNodeMap fieldAttributes;
    Attr fieldLengthAttr;
    int fieldLength;
    Node fieldTextNode;
    String fieldValue;
    byte[] fieldBytes;
    int pos;

    for (int i = 0; i < records.getLength(); i++)
    {
      recordNode = records.item(i);
      recordAttributes = recordNode.getAttributes();
      recordLengthAttr = (Attr) recordAttributes.getNamedItem(TAG_LENGTH);
      recordLength = Integer.parseInt(recordLengthAttr.getNodeValue());
      recordArray = new byte[recordLength];

      pos = 0;

      fields = recordNode.getChildNodes();
      for (int k = 0; k < fields.getLength(); k++)
      {
        fieldNode = fields.item(k);

        if (fieldNode.getNodeType() == Node.ELEMENT_NODE)
        {
          fieldAttributes = fieldNode.getAttributes();
          fieldLengthAttr = (Attr) fieldAttributes
              .getNamedItem(TAG_LENGTH);
          fieldLength = Integer.parseInt(fieldLengthAttr
              .getNodeValue());
          fieldTextNode = fieldNode.getFirstChild();
          fieldValue = fieldTextNode.getNodeValue();
View Full Code Here

  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

    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

      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

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

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.