Package javax.xml.stream.events

Examples of javax.xml.stream.events.Characters


    verify(event, XMLStreamConstants.CDATA, "<![CDATA[foobar]]>");
  }

  @Test
  public void testCreateSpace() throws XMLStreamException {
    Characters event = factory.createSpace(" ");
    verify(event, XMLStreamConstants.CHARACTERS, " ");
    Assert.assertTrue(event.isWhiteSpace());
    Assert.assertFalse(event.isIgnorableWhiteSpace());
  }
View Full Code Here


    Assert.assertFalse(event.isIgnorableWhiteSpace());
  }

  @Test
  public void testCreateIgnorableSpace() throws XMLStreamException {
    Characters event = factory.createIgnorableSpace(" ");
    verify(event, XMLStreamConstants.SPACE, "");
    Assert.assertTrue(event.isWhiteSpace());
    Assert.assertTrue(event.isIgnorableWhiteSpace());
  }
View Full Code Here

            attr.setValue(at.getValue());
            ((Element)parent).setAttributeNode(attr);
            break;
        case XMLStreamConstants.CHARACTERS:
            if (parent != null) {
                Characters characters = ev.asCharacters();
                context.setRecordLoc(addLocation(doc,
                                                 parent.appendChild(doc.createTextNode(characters.getData())),
                                                 characters.getLocation(), context.isRecordLoc()));
            }
            break;
        case XMLStreamConstants.COMMENT:
            if (parent != null) {
                parent.appendChild(doc.createComment(((javax.xml.stream.events.Comment)ev).getText()));
            }
            break;
        case XMLStreamConstants.CDATA:
            Characters characters = ev.asCharacters();
            context.setRecordLoc(addLocation(doc,
                                             parent.appendChild(doc.createCDATASection(characters.getData())),
                                             characters.getLocation(), context.isRecordLoc()));
            break;
        case XMLStreamConstants.PROCESSING_INSTRUCTION:
            parent.appendChild(doc.createProcessingInstruction(((ProcessingInstruction)ev).getTarget(),
                                                               ((ProcessingInstruction)ev).getData()));
            break;
View Full Code Here

                    if (!endA.getName().getLocalPart().equals(endB.getName().getLocalPart())) {
                        message.append("Different elements ").append(endA.getName()).append(", ").append(endB.getName()).append(" at location ").append(eventA.getLocation());
                        return false;
                    }
                } else if (eventType == XMLStreamConstants.CHARACTERS) {
                    Characters endA = eventA.asCharacters();
                    Characters endB = eventB.asCharacters();
                    if (!endA.getData().equals(endB.getData())) {
                        message.append("Different content ").append(endA.getData()).append(", ").append(endB.getData()).append(" at location ").append(eventA.getLocation());
                        return false;
                    }
                }

        }
View Full Code Here

    // Create Start node
    StartElement sElement = eventFactory.createStartElement("", "", name);
    //eventWriter.add(tab);
    eventWriter.add(sElement);
    // Create Content
    Characters characters = eventFactory.createCharacters(value);
    eventWriter.add(characters);
    // Create End node
    EndElement eElement = eventFactory.createEndElement("", "", name);
    eventWriter.add(eElement);
    //eventWriter.add(end);
View Full Code Here

    if (o == null)
      return false;
    if (this == o)
      return true;

    Characters characters = (Characters) o;

    return getData().equals(characters.getData()) &&
           isCData() == characters.isCData() &&
           isIgnorableWhiteSpace() == characters.isIgnorableWhiteSpace() &&
           isWhiteSpace() == characters.isWhiteSpace();
  }
View Full Code Here

    {
        if (o == this) return true;
        if (o == null) return false;
        if (!(o instanceof Characters)) return false;

        Characters other = (Characters) o;
        // Obviously textual content has to match
        if (mContent.equals(other.getData())) {
            // But how about type (CDATA vs CHARACTERS)?
            // For now, let's require type match too
            return isCData() == other.isCData();
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of javax.xml.stream.events.Characters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.