1 16 19 package org.apache.xml.utils; 20 21 import java.io.Serializable ; 22 23 import javax.xml.transform.SourceLocator ; 24 25 import org.xml.sax.Locator ; 26 import org.xml.sax.SAXParseException ; 27 import org.xml.sax.helpers.LocatorImpl ; 28 29 34 public class SAXSourceLocator extends LocatorImpl 35 implements SourceLocator , Serializable 36 { 37 40 Locator m_locator; 41 42 46 public SAXSourceLocator(){} 47 48 54 public SAXSourceLocator(Locator locator) 55 { 56 m_locator = locator; 57 this.setColumnNumber(locator.getColumnNumber()); 58 this.setLineNumber(locator.getLineNumber()); 59 this.setPublicId(locator.getPublicId()); 60 this.setSystemId(locator.getSystemId()); 61 } 62 63 69 public SAXSourceLocator(javax.xml.transform.SourceLocator locator) 70 { 71 m_locator = null; 72 this.setColumnNumber(locator.getColumnNumber()); 73 this.setLineNumber(locator.getLineNumber()); 74 this.setPublicId(locator.getPublicId()); 75 this.setSystemId(locator.getSystemId()); 76 } 77 78 79 85 public SAXSourceLocator(SAXParseException spe) 86 { 87 this.setLineNumber( spe.getLineNumber() ); 88 this.setColumnNumber( spe.getColumnNumber() ); 89 this.setPublicId( spe.getPublicId() ); 90 this.setSystemId( spe.getSystemId() ); 91 } 92 93 104 public String getPublicId() 105 { 106 return (null == m_locator) ? super.getPublicId() : m_locator.getPublicId(); 107 } 108 109 123 public String getSystemId() 124 { 125 return (null == m_locator) ? super.getSystemId() : m_locator.getSystemId(); 126 } 127 128 143 public int getLineNumber() 144 { 145 return (null == m_locator) ? super.getLineNumber() : m_locator.getLineNumber(); 146 } 147 148 163 public int getColumnNumber() 164 { 165 return (null == m_locator) ? super.getColumnNumber() : m_locator.getColumnNumber(); 166 } 167 } 168 | Popular Tags |