Examples of CNamespace


Examples of org.allcolor.xml.parser.dom.ANode.CNamespace

        } // end if
        else {
        // HANDLE XPOINTER (as XPATH with JAXEN)
          XPath xpath = new DOMXPath(xpointer);
          for (Iterator it = doc.getNamespaceList().iterator();it.hasNext();) {
            CNamespace ns = (CNamespace)it.next();
            xpath.addNamespace(ns.getPrefix() == null ? "" : ns.getPrefix(), ns.getNamespaceURI());
          }
          List result = xpath.selectNodes(doc.getDocumentElement());
          for (final Iterator it = result.iterator();it.hasNext();) {
            final Node node = (Node)it.next();
            currentElement.appendChild(node);
View Full Code Here

Examples of org.allcolor.xml.parser.dom.ANode.CNamespace

            && (attName.charAt(3) == 'n')
            && (attName.charAt(4) == 's')) {
          String value = attr.deferredValue;
          String prefix = (attName.length() > 5) ? attName
              .substring(6) : "";
          CNamespace ns = new CNamespace(prefix, value);

          if (this.cHandler != null) {
            try {
              this.cHandler.startPrefixMapping(ns.getPrefix(), ns
                  .getNamespaceURI());
            }
            catch (SAXException e){}
          } // end if

          if (this.level > this.maxLevel) {
            this.maxLevel = this.level;
          }

          this.nsMap.put(new CStringBuilder().append(ns.getPrefix())
              .append(sLevel).toString(), ns);
        } // end if
      } // end for
    } // end if

    CNamespace ns = null;

    if (prefixTag != null) {
      int i = (this.maxLevel < this.level) ? this.maxLevel : this.level;
      prefixTag = new CStringBuilder().append(prefixTag).append('$')
          .toString();

      while ((i > 0) && (ns == null)) {
        ns = (CNamespace) this.nsMap.get(new CStringBuilder().append(
            prefixTag).append(i).toString());
        i--;
      } // end while
    } // end if
    else {
      int i = (this.maxLevel < this.level) ? this.maxLevel : this.level;

      while ((i > 0) && (ns == null)) {
        ns = (CNamespace) this.nsMap.get(new CStringBuilder().append(
            '$').append(i).toString());
        i--;
      } // end while
    } // end else

    if (attributes != null) {
      for (int li = 0; li < count; li++) {
        CAttr attr = attributes[li];
        String attName = attr.name;
        String value = attr.deferredValue;

        if (value == null) {
          value = "";
        }

        // Patch Tom Fennelly, check if decoding needed.
        if (this.decodeEntites && (value.indexOf('&') != -1)) {
          value = this.codec.decodeInternal(value, null, null,
              this.dtdHandler, true);
        } else {
          if (this.dtdHandler != null) {
            value = this.codec.decodeInternal(value, null, null,
                this.dtdHandler, false);
          } // end if
        } // end else

        if ((attName.length() >= 5) && (attName.charAt(0) == 'x')
            && (attName.charAt(1) == 'm')
            && (attName.charAt(2) == 'l')
            && (attName.charAt(3) == 'n')
            && (attName.charAt(4) == 's') && (!this.nPrefix)) {
          continue;
        }

        int indexOf2p = attName.indexOf(":");
        CNamespace nsToSet = null;
        String prefix = "";
        String aname = attName;

        if (indexOf2p != -1) {
          prefix = attName.substring(0, indexOf2p);
          aname = attName.substring(indexOf2p + 1);

          int i = (this.maxLevel < this.level) ? this.maxLevel
              : this.level;
          prefix = new CStringBuilder().append(prefix).append('$')
              .toString();

          while ((i > 0) && (nsToSet == null)) {
            nsToSet = (CNamespace) this.nsMap
                .get(new CStringBuilder().append(prefix)
                    .append(i).toString());
            i--;
          } // end while
        } // end if
        else {
          int i = (this.maxLevel < this.level) ? this.maxLevel
              : this.level;

          while ((i > 0) && (nsToSet == null)) {
            nsToSet = (CNamespace) this.nsMap
                .get(new CStringBuilder().append('$').append(i)
                    .toString());
            i--;
          } // end while
        } // end else

        if (nsToSet != null) {
          this.atts.addAttribute(nsToSet.getNamespaceURI(), aname,
              attName, "CDATA", value);
        } // end if
        else {
          this.atts.addAttribute("", aname, aname, "CDATA", value);
        } // end else
View Full Code Here

Examples of org.allcolor.xml.parser.dom.ANode.CNamespace

          } // end if
          else {
            // HANDLE XPOINTER (as XPATH with JAXEN)
              XPath xpath = new DOMXPath(xpointer);
              for (Iterator it = doc.getNamespaceList().iterator();it.hasNext();) {
                CNamespace ns = (CNamespace)it.next();
                xpath.addNamespace(ns.getPrefix() == null ? "" : ns.getPrefix(), ns.getNamespaceURI());
              }
              List result = xpath.selectNodes(doc.getDocumentElement());
              for (final Iterator it = result.iterator();it.hasNext();) {
                final Node node = (Node)it.next();
              CDOM2SAX converter = new CDOM2SAX(node);
View Full Code Here

Examples of org.allcolor.xml.parser.dom.ANode.CNamespace

      }

      this.stack.pop();
    } // end if

    CNamespace ns = null;
    int index2p = name.indexOf(':');
    String prefixTag = null;

    if (index2p != -1) {
      prefixTag = name.substring(0, index2p);

      int i = (this.maxLevel < this.level) ? this.maxLevel : this.level;
      prefixTag = new CStringBuilder().append(prefixTag).append("$")
          .toString();

      while ((i > 0) && (ns == null)) {
        ns = (CNamespace) this.nsMap.get(new CStringBuilder().append(
            prefixTag).append(i).toString());
        i--;
      } // end while
    } // end if
    else {
      int i = (this.maxLevel < this.level) ? this.maxLevel : this.level;

      while ((i > 0) && (ns == null)) {
        ns = (CNamespace) this.nsMap.get(new CStringBuilder().append(
            '$').append(i).toString());
        i--;
      } // end while
    } // end else
   
    try {
      if (ns != null) {
        if ("http://www.w3.org/2001/XInclude".equals(ns.getNamespaceURI())) {
        } else {
          if (index2p != -1) {
            if (this.cHandler != null) {
              this.cHandler.endElement(ns.getNamespaceURI(), name
                  .substring(index2p + 1), name);
            }
          } // end if
          else {
            if (this.cHandler != null) {
              if (ns.getPrefix().equals("")) {
                this.cHandler.endElement(ns.getNamespaceURI(),
                    name, name);
              } // end if
              else {
                this.cHandler.endElement(ns.getNamespaceURI(),
                    name, new CStringBuilder().append(
                        ns.getPrefix()).append(':').append(
                        name).toString());
              } // end else
            }
          } // end else
        } // end else
      } // end if
      else {
        if (this.cHandler != null) {
          this.cHandler.endElement("", name, name);
        }
      } // end else
 
      if (this.dHandler != null) {
        this.dHandler.endElement(name);
      } // end if
 
      if (this.cHandler != null) {
        String slevel = new CStringBuilder().append('$').append(this.level)
            .toString();
 
        for (Iterator it = this.nsMap.entrySet().iterator(); it.hasNext();) {
          Map.Entry entry = (Map.Entry) it.next();
          CNamespace nsToTest = (CNamespace) entry.getValue();
 
          if (((String) entry.getKey()).endsWith(slevel)) {
            this.cHandler.endPrefixMapping(nsToTest.getPrefix());
            it.remove();
          } // end if
        } // end for
      } // end if
 
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.