Package org.xml.sax

Examples of org.xml.sax.ContentHandler.characters()


            attrs = new AttributesImpl();
            attrs.addAttribute(Name.NS_SV_URI, "name", "sv:name", "CDATA", JcrConstants.JCR_PRIMARYTYPE);
            attrs.addAttribute(Name.NS_SV_URI, "type", "sv:type", "CDATA", "Name");
            handler.startElement(Name.NS_SV_URI, "property", "sv:property", attrs);
            handler.startElement(Name.NS_SV_URI, "value", "sv:value", EMPTY_ATTRS);
            handler.characters(type.toCharArray(), 0, type.length());
            handler.endElement(Name.NS_SV_URI, "value", "sv:value");
            handler.endElement(Name.NS_SV_URI, "property", "sv:property");

            if (mixins.length > 0) {
                // add the jcr:mixinTypes
View Full Code Here


                attrs.addAttribute(Name.NS_SV_URI, "name", "sv:name", "CDATA", JcrConstants.JCR_MIXINTYPES);
                attrs.addAttribute(Name.NS_SV_URI, "type", "sv:type", "CDATA", "Name");
                handler.startElement(Name.NS_SV_URI, "property", "sv:property", attrs);
                for (String mix: mixins) {
                    handler.startElement(Name.NS_SV_URI, "value", "sv:value", EMPTY_ATTRS);
                    handler.characters(mix.toCharArray(), 0, mix.length());
                    handler.endElement(Name.NS_SV_URI, "value", "sv:value");
                }
                handler.endElement(Name.NS_SV_URI, "property", "sv:property");
            }
View Full Code Here

                attrs = new AttributesImpl();
                attrs.addAttribute(Name.NS_SV_URI, "name", "sv:name", "CDATA", JcrConstants.JCR_UUID);
                attrs.addAttribute(Name.NS_SV_URI, "type", "sv:type", "CDATA", "String");
                handler.startElement(Name.NS_SV_URI, "property", "sv:property", attrs);
                handler.startElement(Name.NS_SV_URI, "value", "sv:value", EMPTY_ATTRS);
                handler.characters(uuid.toCharArray(), 0, uuid.length());
                handler.endElement(Name.NS_SV_URI, "value", "sv:value");
                handler.endElement(Name.NS_SV_URI, "property", "sv:property");
            }

View Full Code Here

                  ch.startElement(ge.getNsUri(), ge.getLocalName(), ge.getLocalName(), attrs);

                  String text = ge.getTextContent();
                  if(text != null && text.length() > 0)
                  {
                     ch.characters(text.toCharArray(), 0, text.length());
                  }

                  if(ge.getChildElementsTotal() > 0)
                  {
                     for(Iterator i = ge.getChildElements(); i.hasNext();)
View Full Code Here

          {
            // nextAnnot is contained within curAnnot

            // write text between current pos and beginning of nextAnnot
            try {
              handler.characters(docCharArray, pos, nextAnnot.getBegin() - pos);
              pos = nextAnnot.getBegin();
              handler.startElement("", nextAnnot.getType().getName(),
                      nextAnnot.getType().getName(), getFeatureAttributes(nextAnnot, aCAS));

              // push parent annotation on stack
View Full Code Here

          iterator.moveToNext();
        } else {
          // nextAnnot begins after curAnnot ends
          // write text between current pos and end of curAnnot
          try {
            handler.characters(docCharArray, pos, curAnnot.getEnd() - pos);
            pos = curAnnot.getEnd();
          } catch (StringIndexOutOfBoundsException e) {
            System.err.println("Invalid annotation range: " + curAnnot.getBegin() + ","
                    + curAnnot.getEnd() + " in document of length " + docText.length());
          }
View Full Code Here

      }

      // finished writing all start tags, now finish up
      if (curAnnot != null) {
        try {
          handler.characters(docCharArray, pos, curAnnot.getEnd() - pos);
          pos = curAnnot.getEnd();
        } catch (StringIndexOutOfBoundsException e) {
          System.err.println("Invalid annotation range: " + curAnnot.getBegin() + ","
                  + curAnnot.getEnd() + "in document of length " + docText.length());
        }
View Full Code Here

          curAnnot = (AnnotationFS) stack.remove(stack.size() - 1); // pop
          if (curAnnot == null) {
            break;
          }
          try {
            handler.characters(docCharArray, pos, curAnnot.getEnd() - pos);
            pos = curAnnot.getEnd();
          } catch (StringIndexOutOfBoundsException e) {
            System.err.println("Invalid annotation range: " + curAnnot.getBegin() + ","
                    + curAnnot.getEnd() + "in document of length " + docText.length());
          }
View Full Code Here

          handler.endElement("", curAnnot.getType().getName(), curAnnot.getType().getName());
        }
      }

      if (pos < docCharArray.length) {
        handler.characters(docCharArray, pos, docCharArray.length - pos);
      }
      handler.endElement("", "Document", "Document");
      handler.endDocument();

      // return XML string
View Full Code Here

          {
            // nextAnnot is contained within curAnnot

            // write text between current pos and beginning of nextAnnot
            try {
              handler.characters(docCharArray, pos, nextAnnot.getBegin() - pos);
              pos = nextAnnot.getBegin();
              handler.startElement("", nextAnnot.getType().getName(),
                      nextAnnot.getType().getName(), getFeatureAttributes(nextAnnot, aCAS));

              // push parent annotation on stack
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.