org.xml.sax.Locator#getSystemId ( )源码实例Demo

下面列出了org.xml.sax.Locator#getSystemId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: SchemaTreeTraverser.java
/**
 * Simple constructor.
 *
 * @param artifactName Artifact name.
 * @param locator      Artifact locator.
 */
public SchemaTreeNode(String artifactName, Locator locator) {
    this.artifactName = artifactName;
    if (locator == null) {
        this.fileName = null;
    }
    else {
        String filename = locator.getSystemId();
        filename = filename.replaceAll("\u002520", " ");
        // strip leading protocol
        if (filename.startsWith("file:/")) {
            filename = filename.substring(6);
        }

        this.fileName = filename;
        this.lineNumber = locator.getLineNumber() - 1;
    }
}
 
源代码2 项目: org.hl7.fhir.core   文件: XmlLocationAnnotator.java
@Override
public void endElement(String uri, String localName, String qName)
        throws SAXException {

    // Mutation event fired by the adding of element end,
    // and so lastAddedElement will be set.
    super.endElement(uri, localName, qName);
   
    if (locatorStack.size() > 0) {
        Locator startLocator = locatorStack.pop();
       
        XmlLocationData location = new XmlLocationData(
                startLocator.getSystemId(),
                startLocator.getLineNumber(),
                startLocator.getColumnNumber(),
                locator.getLineNumber(),
                locator.getColumnNumber());
       Element lastAddedElement = elementStack.pop();
       
        lastAddedElement.setUserData(
                XmlLocationData.LOCATION_DATA_KEY, location,
                dataHandler);
    }
}
 
源代码3 项目: TencentKona-8   文件: SchemaTreeTraverser.java
/**
 * Simple constructor.
 *
 * @param artifactName Artifact name.
 * @param locator      Artifact locator.
 */
public SchemaTreeNode(String artifactName, Locator locator) {
    this.artifactName = artifactName;
    if (locator == null) {
        this.fileName = null;
    }
    else {
        String filename = locator.getSystemId();
        filename = filename.replaceAll("\u002520", " ");
        // strip leading protocol
        if (filename.startsWith("file:/")) {
            filename = filename.substring(6);
        }

        this.fileName = filename;
        this.lineNumber = locator.getLineNumber() - 1;
    }
}
 
/**
 * Simple constructor.
 *
 * @param artifactName Artifact name.
 * @param locator      Artifact locator.
 */
public SchemaTreeNode(String artifactName, Locator locator) {
    this.artifactName = artifactName;
    if (locator == null) {
        this.fileName = null;
    }
    else {
        String filename = locator.getSystemId();
        filename = filename.replaceAll("\u002520", " ");
        // strip leading protocol
        if (filename.startsWith("file:/")) {
            filename = filename.substring(6);
        }

        this.fileName = filename;
        this.lineNumber = locator.getLineNumber() - 1;
    }
}
 
源代码5 项目: jdk8u60   文件: SchemaTreeTraverser.java
/**
 * Simple constructor.
 *
 * @param artifactName Artifact name.
 * @param locator      Artifact locator.
 */
public SchemaTreeNode(String artifactName, Locator locator) {
    this.artifactName = artifactName;
    if (locator == null) {
        this.fileName = null;
    }
    else {
        String filename = locator.getSystemId();
        filename = filename.replaceAll("\u002520", " ");
        // strip leading protocol
        if (filename.startsWith("file:/")) {
            filename = filename.substring(6);
        }

        this.fileName = filename;
        this.lineNumber = locator.getLineNumber() - 1;
    }
}
 
源代码6 项目: openjdk-jdk8u   文件: ClassSelector.java
/**
 * Copies a schema fragment into the javadoc of the generated class.
 */
private void addSchemaFragmentJavadoc( CClassInfo bean, XSComponent sc ) {

    // first, pick it up from <documentation> if any.
    String doc = builder.getBindInfo(sc).getDocumentation();
    if(doc!=null)
        append(bean, doc);

    // then the description of where this component came from
    Locator loc = sc.getLocator();
    String fileName = null;
    if(loc!=null) {
        fileName = loc.getPublicId();
        if(fileName==null)
            fileName = loc.getSystemId();
    }
    if(fileName==null)  fileName="";

    String lineNumber=Messages.format( Messages.JAVADOC_LINE_UNKNOWN);
    if(loc!=null && loc.getLineNumber()!=-1)
        lineNumber = String.valueOf(loc.getLineNumber());

    String componentName = sc.apply( new ComponentNameFunction() );
    String jdoc = Messages.format( Messages.JAVADOC_HEADING, componentName, fileName, lineNumber );
    append(bean,jdoc);

    // then schema fragment
    StringWriter out = new StringWriter();
    out.write("<pre>\n");
    SchemaWriter sw = new SchemaWriter(new JavadocEscapeWriter(out));
    sc.visit(sw);
    out.write("</pre>");
    append(bean,out.toString());
}
 
源代码7 项目: openjdk-jdk8u   文件: CollisionInfo.java
private String printLocator(Locator loc) {
    if( loc==null )     return "";

    int line = loc.getLineNumber();
    String sysId = loc.getSystemId();
    if(sysId==null)     sysId = Messages.format(Messages.MSG_UNKNOWN_FILE);

    if( line!=-1 )
        return Messages.format( Messages.MSG_LINE_X_OF_Y,
                Integer.toString(line), sysId );
    else
        return sysId;
}
 
源代码8 项目: openjdk-jdk9   文件: CollisionInfo.java
private String printLocator(Locator loc) {
    if( loc==null )     return "";

    int line = loc.getLineNumber();
    String sysId = loc.getSystemId();
    if(sysId==null)     sysId = Messages.format(Messages.MSG_UNKNOWN_FILE);

    if( line!=-1 )
        return Messages.format( Messages.MSG_LINE_X_OF_Y,
                Integer.toString(line), sysId );
    else
        return sysId;
}
 
源代码9 项目: openjdk-jdk9   文件: ClassSelector.java
/**
 * Copies a schema fragment into the javadoc of the generated class.
 */
private void addSchemaFragmentJavadoc( CClassInfo bean, XSComponent sc ) {

    // first, pick it up from <documentation> if any.
    String doc = builder.getBindInfo(sc).getDocumentation();
    if(doc!=null)
        append(bean, doc);

    // then the description of where this component came from
    Locator loc = sc.getLocator();
    String fileName = null;
    if(loc!=null) {
        fileName = loc.getPublicId();
        if(fileName==null)
            fileName = loc.getSystemId();
    }
    if(fileName==null)  fileName="";

    String lineNumber=Messages.format( Messages.JAVADOC_LINE_UNKNOWN);
    if(loc!=null && loc.getLineNumber()!=-1)
        lineNumber = String.valueOf(loc.getLineNumber());

    String componentName = sc.apply( new ComponentNameFunction() );
    String jdoc = Messages.format( Messages.JAVADOC_HEADING, componentName, fileName, lineNumber );
    append(bean,jdoc);

    // then schema fragment
    StringWriter out = new StringWriter();
    out.write("<pre>\n");
    SchemaWriter sw = new SchemaWriter(new JavadocEscapeWriter(out));
    sc.visit(sw);
    out.write("</pre>");
    append(bean,out.toString());
}
 
源代码10 项目: jdk8u60   文件: CollisionInfo.java
private String printLocator(Locator loc) {
    if( loc==null )     return "";

    int line = loc.getLineNumber();
    String sysId = loc.getSystemId();
    if(sysId==null)     sysId = Messages.format(Messages.MSG_UNKNOWN_FILE);

    if( line!=-1 )
        return Messages.format( Messages.MSG_LINE_X_OF_Y,
                Integer.toString(line), sysId );
    else
        return sysId;
}
 
源代码11 项目: jdk8u60   文件: ClassSelector.java
/**
 * Copies a schema fragment into the javadoc of the generated class.
 */
private void addSchemaFragmentJavadoc( CClassInfo bean, XSComponent sc ) {

    // first, pick it up from <documentation> if any.
    String doc = builder.getBindInfo(sc).getDocumentation();
    if(doc!=null)
        append(bean, doc);

    // then the description of where this component came from
    Locator loc = sc.getLocator();
    String fileName = null;
    if(loc!=null) {
        fileName = loc.getPublicId();
        if(fileName==null)
            fileName = loc.getSystemId();
    }
    if(fileName==null)  fileName="";

    String lineNumber=Messages.format( Messages.JAVADOC_LINE_UNKNOWN);
    if(loc!=null && loc.getLineNumber()!=-1)
        lineNumber = String.valueOf(loc.getLineNumber());

    String componentName = sc.apply( new ComponentNameFunction() );
    String jdoc = Messages.format( Messages.JAVADOC_HEADING, componentName, fileName, lineNumber );
    append(bean,jdoc);

    // then schema fragment
    StringWriter out = new StringWriter();
    out.write("<pre>\n");
    SchemaWriter sw = new SchemaWriter(new JavadocEscapeWriter(out));
    sc.visit(sw);
    out.write("</pre>");
    append(bean,out.toString());
}
 
源代码12 项目: TencentKona-8   文件: DefaultAuthenticator.java
private String getLocationString(Locator l) {
    return "[" + l.getSystemId() + "#" + l.getLineNumber() + "]";
}
 
源代码13 项目: openjdk-jdk8u   文件: SAX2StAXBaseWriter.java
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
源代码14 项目: openjdk-jdk8u   文件: DOMForestScanner.java
public String getSystemId() {
    Locator l = findLocator();
    if(l!=null)     return l.getSystemId();
    return          null;
}
 
源代码15 项目: jdk8u60   文件: DefaultAuthenticator.java
private String getLocationString(Locator l) {
    return "[" + l.getSystemId() + "#" + l.getLineNumber() + "]";
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: SAX2StAXBaseWriter.java
private SAXLocation(Locator locator) {
        lineNumber = locator.getLineNumber();
        columnNumber = locator.getColumnNumber();
        publicId = locator.getPublicId();
        systemId = locator.getSystemId();
}
 
源代码17 项目: jdk8u60   文件: DOMForestScanner.java
public String getSystemId() {
    Locator l = findLocator();
    if(l!=null)     return l.getSystemId();
    return          null;
}
 
源代码18 项目: JDKSourceCode1.8   文件: SAX2DTM.java
/**
 * Receive a Locator object for document events.
 *
 * <p>By default, do nothing.  Application writers may override this
 * method in a subclass if they wish to store the locator for use
 * with other document events.</p>
 *
 * @param locator A locator for all SAX document events.
 * @see org.xml.sax.ContentHandler#setDocumentLocator
 * @see org.xml.sax.Locator
 */
public void setDocumentLocator(Locator locator)
{
  m_locator = locator;
  m_systemId = locator.getSystemId();
}
 
源代码19 项目: openjdk-jdk8u   文件: SAX2DTM.java
/**
 * Receive a Locator object for document events.
 *
 * <p>By default, do nothing.  Application writers may override this
 * method in a subclass if they wish to store the locator for use
 * with other document events.</p>
 *
 * @param locator A locator for all SAX document events.
 * @see org.xml.sax.ContentHandler#setDocumentLocator
 * @see org.xml.sax.Locator
 */
public void setDocumentLocator(Locator locator)
{
  m_locator = locator;
  m_systemId = locator.getSystemId();
}
 
源代码20 项目: TencentKona-8   文件: SAX2DTM.java
/**
 * Receive a Locator object for document events.
 *
 * <p>By default, do nothing.  Application writers may override this
 * method in a subclass if they wish to store the locator for use
 * with other document events.</p>
 *
 * @param locator A locator for all SAX document events.
 * @see org.xml.sax.ContentHandler#setDocumentLocator
 * @see org.xml.sax.Locator
 */
public void setDocumentLocator(Locator locator)
{
  m_locator = locator;
  m_systemId = locator.getSystemId();
}