org.xml.sax.AttributeList Java Examples

The following examples show how to use org.xml.sax.AttributeList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLReaderAdapterTest.java    From j2objc with Apache License 2.0 6 votes vote down vote up
public void testStartElement() {
    AttributesImpl atts = new AttributesImpl();
    atts.addAttribute("http://some.other.uri", "gabba", "gabba:hey",
            "int", "42");

    try {
        adapter.startElement("http://some.uri", "bar", "foo:bar", atts);
    } catch (SAXException e) {
        throw new RuntimeException("Unexpected exception", e);
    }

    assertEquals(logger.size(), 1);
    assertEquals("startElement", logger.getMethod());
    assertEquals("foo:bar", logger.getArgs()[0]);
    assertEquals("gabba:hey",
            ((AttributeList)logger.getArgs()[1]).getName(0));
}
 
Example #2
Source File: ResolvingParser.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #3
Source File: ResolvingParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #4
Source File: AttributeListImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #5
Source File: ResolvingParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #6
Source File: AttributeListImpl.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
int count = atts.getLength();

clear();

for (int i = 0; i < count; i++) {
    addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
}
}
 
Example #7
Source File: AttributeListImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #8
Source File: TextSerializer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #9
Source File: ResolvingParser.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #10
Source File: AttributeListImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #11
Source File: TextSerializer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #12
Source File: ResolvingParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #13
Source File: AttributeListImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #14
Source File: AttributeListImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #15
Source File: TextSerializer.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #16
Source File: TextSerializer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #17
Source File: ResolvingParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #18
Source File: AttributeListImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #19
Source File: AttributeListImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #20
Source File: AttributeListImpl.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #21
Source File: TextSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #22
Source File: ResolvingParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #23
Source File: ResolvingParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #24
Source File: TextSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #25
Source File: AttributeListImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #26
Source File: TextSerializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #27
Source File: AttributeListImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}
 
Example #28
Source File: ResolvingParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** SAX DocumentHandler API. */
public void startElement(String name, AttributeList atts)
  throws SAXException {
  allowXMLCatalogPI = false;
  if (documentHandler != null) {
    documentHandler.startElement(name,atts);
  }
}
 
Example #29
Source File: TextSerializer.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void startElement( String tagName, AttributeList attrs )
    throws SAXException
{
    boolean      preserveSpace;
    ElementState state;

    try {
        state = getElementState();
        if ( isDocumentState() ) {
            // If this is the root element handle it differently.
            // If the first root element in the document, serialize
            // the document's DOCTYPE. Space preserving defaults
            // to that of the output format.
            if ( ! _started )
                startDocument( tagName );
        }
        // For any other element, if first in parent, then
        // use the parnet's space preserving.
        preserveSpace = state.preserveSpace;

        // Do not change the current element state yet.
        // This only happens in endElement().

        // Ignore all other attributes of the element, only printing
        // its contents.

        // Now it's time to enter a new element state
        // with the tag name and space preserving.
        // We still do not change the curent element state.
        state = enterElementState( null, null, tagName, preserveSpace );
    } catch ( IOException except ) {
        throw new SAXException( except );
    }
}
 
Example #30
Source File: AttributeListImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Set the attribute list, discarding previous contents.
 *
 * <p>This method allows an application writer to reuse an
 * attribute list easily.</p>
 *
 * @param atts The attribute list to copy.
 */
public void setAttributeList (AttributeList atts)
{
    int count = atts.getLength();

    clear();

    for (int i = 0; i < count; i++) {
        addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
    }
}