Package org.xml.sax

Examples of org.xml.sax.ContentHandler


  public ContentHandler createResultContentHandler(
          Result outputTarget, OutputProperties format)
            throws TransformerException
  {

    ContentHandler handler = null;

    // If the Result object contains a Node, then create
    // a ContentHandler that will add nodes to the input node.
    org.w3c.dom.Node outputNode = null;
View Full Code Here


          throws TransformerException
  {

    synchronized (m_reentryGuard)
    {
      ContentHandler handler = createResultContentHandler(outputTarget);

      m_outputTarget = outputTarget;

      this.setContentHandler(handler);
      transform(xmlSource, shouldRelease);
View Full Code Here

  public void transformNode(int node, Result outputTarget)
          throws TransformerException
  {
   

    ContentHandler handler = createResultContentHandler(outputTarget);

    m_outputTarget = outputTarget;

    this.setContentHandler(handler);
    transformNode(node);
View Full Code Here

          throws TransformerException
  {

    XPathContext xctxt = m_xcontext;
   
    ContentHandler rtfHandler = dtmFrag.getContentHandler();

    // Obtain the ResultTreeFrag's root node.
    // NOTE: In SAX2RTFDTM, this value isn't available until after
    // the startDocument has been issued, so assignment has been moved
    // down a bit in the code.
View Full Code Here

          SerializerFactory.getSerializer(m_textformat.getProperties());

        m_resultTreeHandler.setSerializer(serializer);
        serializer.setWriter(sw);

        ContentHandler shandler = serializer.asContentHandler();

        m_resultTreeHandler.init(this, shandler);
      }
      else
      {
View Full Code Here

    ResultTreeHandler rth = this.getResultTreeHandler();

    // These may well not be the same!  In this case when calling
    // the Redirect extension, it has already set the ContentHandler
    // in the Transformer.
    ContentHandler savedRTHHandler = rth.getContentHandler();
    ContentHandler savedHandler = this.getContentHandler();

    try
    {
      getResultTreeHandler().flushPending();
      this.setContentHandler(handler);
View Full Code Here

    //    {
    //      SourceTreeHandler sth = (SourceTreeHandler) m_inputContentHandler;
    //
    //      sth.setExceptionThrown(e);
    //    }
    ContentHandler ch = getContentHandler();

    //    if(ch instanceof SourceTreeHandler)
    //    {
    //      SourceTreeHandler sth = (SourceTreeHandler) ch;
    //      ((TransformerImpl)(sth.getTransformer())).postExceptionFromThread(e);
View Full Code Here

      String media = null;
      Vector params = new Vector();
      boolean quietConflictWarnings = false;
      URIResolver uriResolver = null;
      EntityResolver entityResolver = null;
      ContentHandler contentHandler = null;
      int recursionLimit=-1;

      for (int i = 0; i < argv.length; i++)
      {
        if ("-XSLTC".equalsIgnoreCase(argv[i]))
View Full Code Here

    public ContentHandler getImportContentHandler(
            final String path, final int mode) throws RepositoryException {
        getItem(path); // Check that the path exists
        try {
            final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ContentHandler handler =
                SerializingContentHandler.getSerializer(buffer);
            return new DefaultContentHandler(handler) {
                public void endDocument() throws SAXException {
                    super.endDocument();
                    try {
View Full Code Here

        String testValue = prefix + ":someLocalName";

        String svuri = Name.NS_SV_URI;
        String svprefix = Name.NS_SV_PREFIX + ":";

        ContentHandler ch = superuser.getImportContentHandler(testRootNode.getPath(), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
        ch.startDocument();
        ch.startPrefixMapping(prefix, uri);

        String nN = "node";
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute(svuri, "name", svprefix + "name", "CDATA", nodeName1);
        ch.startElement(svuri, nN, svprefix + nN, attrs);

        // primary node type
        String pN = "property";
        attrs = new AttributesImpl();
        attrs.addAttribute(svuri, "name", svprefix + "name", "CDATA", JcrConstants.JCR_PRIMARYTYPE);
        attrs.addAttribute(svuri, "type", svprefix + "type", "CDATA", PropertyType.nameFromValue(PropertyType.NAME));
        ch.startElement(svuri, pN, svprefix + pN, attrs);
            ch.startElement(svuri, "value", svprefix + "value", new AttributesImpl());
            char[] val = testNodeType.toCharArray();
            ch.characters(val, 0, val.length);
            ch.endElement(svuri, "value", svprefix + "value");
        ch.endElement(svuri, pN, prefix + pN);

        // another name value
        attrs = new AttributesImpl();
        attrs.addAttribute(svuri, "name", svprefix + "name", "CDATA", propertyName1);
        attrs.addAttribute(svuri, "type", svprefix + "type", "CDATA", PropertyType.nameFromValue(PropertyType.NAME));
        ch.startElement(svuri, pN, svprefix + pN, attrs);
            ch.startElement(svuri, "value", svprefix + "value", new AttributesImpl());
            val = testValue.toCharArray();
            ch.characters(val, 0, val.length);
            ch.endElement(svuri, "value", svprefix + "value");
        ch.endElement(svuri, pN, svprefix + pN);

        ch.endElement(svuri, nN, svprefix + nN);
        ch.endDocument();

        // test if property has been imported with correct namespace
        String assignedPrefix = superuser.getNamespacePrefix(uri);
        assertTrue(superuser.getNamespaceURI(assignedPrefix).equals(uri));
        String path = testRootNode.getPath() + "/" + nodeName1 + "/" + propertyName1;
View Full Code Here

TOP

Related Classes of org.xml.sax.ContentHandler

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.