org.apache.batik.dom_1.6.0.v201011041432

 }
            namespaces.put("", str2);
          }
          else if (((String)localObject1).charAt(5) == ':')
          {
            str2 = paramAttributes.getValue(j);
            if (str2.length() == 0) {
              str2 = null;
            }
            namespaces.put(((String)localObject1).substring(6), str2);
          }
        }
      }
    }
    appendStringData();
    int k = paramString3.indexOf(':');
    String str2 = (k == -1) || (k == paramString3.length() - 1) ? "" : paramString3.substring(0, k);
    String str3 = namespaces.get(str2);
    Object localObject2;
    if (currentNode == null)
    {
      implementation = getDOMImplementation(str1);
      document = implementation.createDocument(str3, paramString3, null);
      Iterator localIterator = preInfo.iterator();
      currentNode = (localObject1 = document.getDocumentElement());
      while (localIterator.hasNext())
      {
        localObject2 = (PreInfo)localIterator.next();
        Node localNode = ((PreInfo)localObject2).createNode(document);
        document.insertBefore(localNode, (Node)localObject1);
      }
      preInfo = null;
    }
    else
    {
      localObject1 = document.createElementNS(str3, paramString3);
      currentNode.appendChild((Node)localObject1);
      currentNode = ((Node)localObject1);
    }
    if ((createDocumentDescriptor) && (locator != null)) {
      documentDescriptor.setLocationLine((Element)localObject1, locator.getLineNumber());
    }
    for (int m = 0; m < i; m++)
    {
      localObject2 = paramAttributes.getQName(m);
      if (((String)localObject2).equals("xmlns"))
      {
        ((Element)localObject1).setAttributeNS("http://www.w3.org/2000/xmlns/", (String)localObject2, paramAttributes.getValue(m));
      }
      else
      {
        k = ((String)localObject2).indexOf(':');
        str3 = k == -1 ? null : namespaces.get(((String)localObject2).substring(0, k));
        ((Element)localObject1).setAttributeNS(str3, (String)localObject2, paramAttributes.getValue(m));
      }
    }
  }
  
  public void endElement(String paramString1, String paramString2, String paramString3)
    throws SAXException
  {
    appendStringData();
    if (currentNode != null) {
      currentNode = currentNode.getParentNode();
    }
    namespaces.pop();
  }
  
  public void appendStringData()
  {
    if (!stringContent) {
      return;
    }
    String str = stringBuffer.toString();
    stringBuffer.setLength(0);
    stringContent = false;
    if (currentNode == null)
    {
      if (inCDATA) {
        preInfo.add(new CDataInfo(str));
      } else {
        preInfo.add(new TextInfo(str));
      }
    }
    else
    {
      Object localObject;
      if (inCDATA) {
        localObject = document.createCDATASection(str);
      } else {
        localObject = document.createTextNode(str);
      }
      currentNode.appendChild((Node)localObject);
    }
  }
  
  public void characters(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws SAXException
  {
    stringBuffer.append(paramArrayOfChar, paramInt1, paramInt2);
    stringContent = true;
  }
  
  public void ignorableWhitespace(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws SAXException
  {
    stringBuffer.append(paramArrayOfChar, paramInt1, paramInt2);
    stringContent = true;
  }
  
  public void processingInstruction(String paramString1, String paramString2)
    throws SAXException
  {
    if (inDTD) {
      return;
    }
    appendStringData();
    if (currentNode == null) {
      preInfo.add(new ProcessingInstructionInfo(paramString1, paramString2));
    } else {
      currentNode.appendChild(document.createProcessingInstruction(paramString1, paramString2));
    }
  }
  
  public void startDTD(String paramString1, String paramString2, String paramString3)
    throws SAXException
  {
    appendStringData();
    inDTD = true;
  }
  
  public void endDTD()
    throws SAXException
  {
    inDTD = false;
  }
  
  public void startEntity(String paramString)
    throws SAXException
  {}
  
  public void endEntity(String paramString)
    throws SAXException
  {}
  
  public void startCDATA()
    throws SAXException
  {
    appendStringData();
    inCDATA = true;
    stringContent = true;
  }
  
  public void endCDATA()
    throws SAXException
  {
    appendStringData();
    inCDATA = false;
  }
  
  public void comment(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws SAXException
  {
    if (inDTD) {
      return;
    }
    appendStringData();
    String str = new String(paramArrayOfChar, paramInt1, paramInt2);
    if (currentNode == null) {
      preInfo.add(new CommentInfo(str));
    } else {
      currentNode.appendChild(document.createComment(str));
    }
  }
  
  static class CDataInfo
    implements SAXDocumentFactory.PreInfo
  {
    public String cdata;
    
    public CDataInfo(String paramString)
    {
      cdata = paramString;
    }
    
    public Node createNode(Document paramDocument)
    {
      return paramDocument.createCDATASection(cdata);
    }
  }
  
  static class CommentInfo
    implements SAXDocumentFactory.PreInfo
  {
    public String comment;
    
    public CommentInfo(String paramString)
    {
      comment = paramString;
    }
    
    public Node createNode(Document paramDocument)
    {
      return paramDocument.createComment(comment);
    }
  }
  
  protected static abstract interface PreInfo
  {
    public abstract Node createNode(Document paramDocument);
  }
  
  static class ProcessingInstructionInfo
    implements SAXDocumentFactory.PreInfo
  {
    public String target;
    public String data;
    
    public ProcessingInstructionInfo(String paramString1, String paramString2)
    {
      target = paramString1;
      data = paramString2;
    }
    
    public Node createNode(Document paramDocument)
    {
      return paramDocument.createProcessingInstruction(target, data);
    }
  }
  
  static class TextInfo
    implements SAXDocumentFactory.PreInfo
  {
    public String text;
    
    public TextInfo(String paramString)
    {
      text = paramString;
    }
    
    public Node createNode(Document paramDocument)
    {
      return paramDocument.createTextNode(text);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.dom.util.SAXDocumentFactory
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.dom.util;

import org.w3c.dom.DOMException;
import org.w3c.dom.Element;

public class XLinkSupport
{
  public static final String XLINK_NAMESPACE_URI = "http://www.w3.org/1999/xlink";
  
  public static String getXLinkType(Element paramElement)
  {
    return paramElement.getAttributeNS("http://www.w3.org/1999/xlink", "type");
  }
  
  public static void setXLinkType(Element paramElement, String paramString)
  {
    if ((!"simple".equals(paramString)) && (!"extended".equals(paramString)) && (!"locator".equals(paramString)) && (!"arc".equals(paramString))) {
      throw new DOMException((short)12, "xlink:type='" + paramString + "'");
    }
    paramElement.setAttributeNS("http://www.w3.org/1999/xlink", "type", paramString);
  }
  
  public static String getXLinkRole(Element paramElement)
  {
    return paramElement.getAttributeNS("http://www.w3.org/1999/xlink", "role");
  }
  
  public static void setXLinkRole(Element paramElement, String paramString)
  {
    paramElement.setAttributeNS("http://www.w3.org/1999/xlink", "role", paramString);
  }
  
  public static String getXLinkArcRole(Element paramElement)
  {
    return paramElement.getAttributeNS("http://www.w3.org/1999/xlink", "arcrole");
  }
  
  public static void setXLinkArcRole(Element paramElement, String paramString)
  {
    paramElement.setAttributeNS("http://www.w3.org/1999/xlink", "arcrole", paramString);
  }
  
  public static String getXLinkTitle(Element paramElement)
  {
    return paramElement.getAttributeNS("http://www.w3.org/1999/xlink", "title");
  }
  
  public static void setXLinkTitle(Element paramElement, String paramString)
  {
    paramElement.setAttributeNS("http://www.w3.org/1999/xlink", "title", paramString);
  }
  
  public static String getXLinkShow(Element paramElement)
  {
    return paramElement.getAttributeNS("http://www.w3.org/1999/xlink", "show");
  }
  
  public static void setXLinkShow(Element paramElement, String paramString)
  {
    if ((!"new".equals(paramString)) && (!"replace".equals(paramString)) && (!"embed".equals(paramString))) {
      throw new DOMException((short)12, "xlink:show='" + paramString + "'");
    }
    paramElement.setAttributeNS("http://www.w3.org/1999/xlink", "show", paramString);
  }
  
  public static String getXLinkActuate(Element paramElement)
  {
    return paramElement.getAttributeNS("http://www.w3.org/1999/xlink", "actuate");
  }
  
  public static void setXLinkActuate(Element paramElement, String paramString)
  {
    if ((!"onReplace".equals(paramString)) && (!"onLoad".equals(paramString))) {
      throw new DOMException((short)12, "xlink:actuate='" + paramString + "'");
    }
    paramElement.setAttributeNS("http://www.w3.org/1999/xlink", "actuate", paramString);
  }
  
  public static String getXLinkHref(Element paramElement)
  {
    return paramElement.getAttributeNS("http://www.w3.org/1999/xlink", "href");
  }
  
  public static void setXLinkHref(Element paramElement, String paramString)
  {
    paramElement.setAttributeNS("http://www.w3.org/1999/xlink", "href", paramString);
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.dom.util.XLinkSupport
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.dom.util;

import org.apache.batik.util.XMLConstants;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class XMLSupport
  implements XMLConstants
{
  public static String getXMLLang(Element paramElement)
  {
    Attr localAttr = paramElement.getAttributeNodeNS("http://www.w3.org/XML/1998/namespace", "lang");
    if (localAttr != null) {
      return localAttr.getNodeValue();
    }
    for (Node localNode = paramElement.getParentNode(); localNode != null; localNode = localNode.getParentNode()) {
      if (localNode.getNodeType() == 1)
      {
        localAttr = ((Element)localNode).getAttributeNodeNS("http://www.w3.org/XML/1998/namespace", "lang");
        if (localAttr != null) {
          return localAttr.getNodeValue();
        }
      }
    }
    return "en";
  }
  
  public static String getXMLSpace(Element paramElement)
  {
    Attr localAttr = paramElement.getAttributeNodeNS("http://www.w3.org/XML/1998/namespace", "space");
    if (localAttr != null) {
      return localAttr.getNodeValue();
    }
    for (Node localNode = paramElement.getParentNode(); localNode != null; localNode = localNode.getParentNode()) {
      if (localNode.getNodeType() == 1)
      {
        localAttr = ((Element)localNode).getAttributeNodeNS("http://www.w3.org/XML/1998/namespace", "space");
        if (localAttr != null) {
          return localAttr.getNodeValue();
        }
      }
    }
    return "default";
  }
  
  public static String defaultXMLSpace(String paramString)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    int i = 0;
    for (int j = 0; j < paramString.length(); j++)
    {
      char c = paramString.charAt(j);
      switch (c)
      {
      case '\n': 
      case '\r': 
        i = 0;
        break;
      case '\t': 
      case ' ': 
        if (i == 0)
        {
          localStringBuffer.append(' ');
          i = 1;
        }
        break;
      default: 
        localStringBuffer.append(c);
        i = 0;
      }
    }
    return localStringBuffer.toString().trim();
  }
  
  public static String preserveXMLSpace(String paramString)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; i < paramString.length(); i++)
    {
      char c = paramString.charAt(i);
      switch (c)
      {
      case '\t': 
      case '\n': 
      case '\r': 
        localStringBuffer.append(' ');
        break;
      case '\013': 
      case '\f': 
      default: 
        localStringBuffer.append(c);
      }
    }
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.dom.util.XMLSupport
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
1 2 3 4 5 6 7

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd