Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 124   Methods: 6
NCLOC: 76   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
EntityReferenceImpl.java 0% 0% 0% 0%
coverage
 1    /*
 2    * Licensed to the Apache Software Foundation (ASF) under one or more
 3    * contributor license agreements. See the NOTICE file distributed with
 4    * this work for additional information regarding copyright ownership.
 5    * The ASF licenses this file to You under the Apache License, Version 2.0
 6    * (the "License"); you may not use this file except in compliance with
 7    * the License. You may obtain a copy of the License at
 8    *
 9    * http://www.apache.org/licenses/LICENSE-2.0
 10    *
 11    * Unless required by applicable law or agreed to in writing, software
 12    * distributed under the License is distributed on an "AS IS" BASIS,
 13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14    * See the License for the specific language governing permissions and
 15    * limitations under the License.
 16    *
 17    * $Id: EntityReferenceImpl.java 571948 2007-09-02 10:51:37Z vgritsenko $
 18    */
 19   
 20    package org.apache.xindice.xml.dom;
 21   
 22    import org.apache.commons.logging.Log;
 23    import org.apache.commons.logging.LogFactory;
 24    import org.apache.xindice.util.ByteArrayInput;
 25    import org.apache.xindice.xml.Signatures;
 26    import org.apache.xindice.xml.SymbolTable;
 27    import org.apache.xindice.xml.XMLCompressedInput;
 28   
 29    import org.w3c.dom.EntityReference;
 30    import org.w3c.dom.Node;
 31   
 32    import java.io.IOException;
 33   
 34    /**
 35    * EntityReferenceImpl
 36    *
 37    * @version $Revision: 571948 $, $Date: 2007-09-02 03:51:37 -0700 (Sun, 02 Sep 2007) $
 38    */
 39    public final class EntityReferenceImpl extends NodeImpl
 40    implements EntityReference {
 41   
 42    private static final Log log = LogFactory.getLog(EntityReferenceImpl.class);
 43   
 44   
 45  0 public EntityReferenceImpl() {
 46    }
 47   
 48  0 public EntityReferenceImpl(NodeImpl parent, byte[] data, int pos, int len) {
 49  0 super(parent, data, pos, len);
 50    }
 51   
 52  0 public EntityReferenceImpl(NodeImpl parent, boolean dirty) {
 53  0 super(parent, dirty);
 54    }
 55   
 56  0 public EntityReferenceImpl(NodeImpl parent, String nodeName) {
 57  0 super(parent, true);
 58  0 this.nodeName = nodeName;
 59    }
 60   
 61  0 protected void checkLoaded() {
 62  0 if (loaded) {
 63  0 return;
 64    }
 65   
 66  0 loaded = true;
 67  0 try {
 68  0 if (data != null) {
 69  0 DocumentImpl doc = (DocumentImpl) getOwnerDocument();
 70  0 SymbolTable st = doc.getSymbols();
 71   
 72  0 ByteArrayInput bis = new ByteArrayInput(data, pos, len);
 73  0 XMLCompressedInput xci = new XMLCompressedInput(bis, st);
 74   
 75  0 byte signature = xci.readByte();
 76  0 byte entityType = (byte) (signature & 0x1F);
 77  0 switch (entityType) {
 78   
 79  0 case Signatures.ENT_DEFINED:
 80  0 nodeName = st.getName(xci.readShort());
 81  0 break;
 82   
 83  0 case Signatures.ENT_AMP:
 84  0 nodeName = "&";
 85  0 break;
 86   
 87  0 case Signatures.ENT_LT:
 88  0 nodeName = "<";
 89  0 break;
 90   
 91  0 case Signatures.ENT_GT:
 92  0 nodeName = ">";
 93  0 break;
 94   
 95  0 case Signatures.ENT_QUOT:
 96  0 nodeName = """;
 97  0 break;
 98   
 99  0 case Signatures.ENT_APOS:
 100  0 nodeName = "'";
 101  0 break;
 102   
 103  0 case Signatures.ENT_UNICODE:
 104    // TODO: Convert symbol to &#...;
 105  0 nodeName = "";
 106  0 break;
 107   
 108  0 default:
 109  0 if (log.isWarnEnabled()) {
 110  0 log.warn("invalid entity type : " + entityType);
 111    }
 112    }
 113    }
 114    } catch (IOException e) {
 115  0 if (log.isWarnEnabled()) {
 116  0 log.warn("ignored exception", e);
 117    }
 118    }
 119    }
 120   
 121  0 public short getNodeType() {
 122  0 return Node.ENTITY_REFERENCE_NODE;
 123    }
 124    }