Package nu.xom

Examples of nu.xom.NodeFactory


   
    public void testFinishMakingElementDetachesItsArgument()
      throws ParsingException, IOException {
       
        String data = "<root><a><b /></a></root>";
        Builder builder = new Builder(new NodeFactory() {
           
            public Nodes finishMakingElement(Element element) {
               
                if (element.getLocalName().equals("b")) {
                    element.detach();
View Full Code Here


            StringBuffer sb = new StringBuffer(contentLength);
            for (int c = reader.read(); c != -1; c = reader.read()) {
              sb.append((char) c);
            }
           
            NodeFactory factory = builder.getNodeFactory();
            if (factory != null) {
                return factory.makeText(sb.toString());
            }
            else return new Nodes(new Text(sb.toString()));
        }
        finally {
            in.close();  
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub
    NodeFactory n = new PatentParse();
    Builder b = new Builder(n);
    b.build(new File("/home/ptc24/corpora/patents/oscarC07d-b2-wo2006a.xml"));
  }
View Full Code Here

            StringBuffer sb = new StringBuffer(contentLength);
            for (int c = reader.read(); c != -1; c = reader.read()) {
              sb.append((char) c);
            }
           
            NodeFactory factory = builder.getNodeFactory();
            if (factory != null) {
                return factory.makeText(sb.toString());
            }
            else return new Nodes(new Text(sb.toString()));
        }
        finally {
            in.close();  
View Full Code Here

     *
     * @throws XMLException if the DOM document is not a well-formed
     *     XML document
     */
    public static Document convert(org.w3c.dom.Document domDocument) {
        return convert(domDocument, new NodeFactory());
    }
View Full Code Here

     *
     * @throws XMLException if the DOM object is not a well-balanced
     *     XML fragment
     */
    public static Nodes convert(DocumentFragment fragment) {
        return convert(fragment, new NodeFactory());
    }
View Full Code Here

     *
     * @throws XMLException if the DOM <code>Element</code>
     *     is not a well-formed XML element
     */
    public static Element convert(org.w3c.dom.Element element) {
        return (Element) convert(element, new NodeFactory()).get(0);
    }
View Full Code Here

       
        File stylesheet = new File(inputDir, "identity.xsl");
        Builder builder = new Builder();
        Document stylesheetDoc = builder.build(stylesheet);
        XSLTransform xform = new XSLTransform(stylesheetDoc,
          new NodeFactory() {
            public Nodes makeComment(String text) {
                return new Nodes(new Attribute("comment", text));  
            }
        });
View Full Code Here

    // and then split into individual tests
    public void testOASISXalanConformanceSuite() 
      throws IOException, ParsingException, XSLException {
        if (true) return; // XXX fix
        Builder builder = new Builder();
        NodeFactory stripper = new StrippingFactory();
        Builder strippingBuilder = new Builder(stripper);
       
        File base = new File("data");
        base = new File(base, "oasis-xslt-testsuite");
        base = new File(base, "TESTS");
View Full Code Here

   
    public void testOASISMicrosoftConformanceSuite() 
      throws IOException, ParsingException, XSLException {
        if (true) return; // XXX fix
        Builder builder = new Builder();
        NodeFactory stripper = new StrippingFactory();
        Builder strippingBuilder = new Builder(stripper);
        File base = new File("data");
        base = new File(base, "oasis-xslt-testsuite");
        base = new File(base, "TESTS");
        File catalog = new File(base, "catalog.xml");
View Full Code Here

TOP

Related Classes of nu.xom.NodeFactory

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.