Examples of XmlContent


Examples of com.btaz.util.reader.xml.nodes.XmlContent

                    if(levelIndex == 0) {
                        return doc;
                    }
                }
            } else if(node instanceof XmlContent) {
                XmlContent content = (XmlContent) node;
                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.addLast(new Content(content.getText()));
                if(record) {
                    // build document
                    doc.addContent(new Content(content.getText()));
                }
            } else {
                // don't know how to handle this type, internal error
                throw new XmlReaderException("Unknown XmlNode type: " + node);
            }
View Full Code Here

Examples of com.btaz.util.reader.xml.nodes.XmlContent

                        return new XmlStartElement(reader.getLocalName(), getAttributes(reader));
                    case XMLStreamConstants.CHARACTERS:
                        // capture XML?
                        String text = filterWhitespace(reader.getText());
                        if(text.length() > 0) {
                            return new XmlContent(text);
                        }
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        return new XmlEndElement(reader.getLocalName());
                    default:
View Full Code Here

Examples of com.btaz.util.xml.nodes.XmlContent

                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.removeLast();
            } else if(node instanceof XmlContent) {
                XmlContent content = (XmlContent) node;
                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.addLast(new Content(content.getText()));
            } else {
                throw new XmlReaderException("Unknown XmlNode type: " + node);
            }
        }
        return false;
View Full Code Here

Examples of com.btaz.util.xml.nodes.XmlContent

                    if(levelIndex == 0) {
                        return doc;
                    }
                }
            } else if(node instanceof XmlContent) {
                XmlContent content = (XmlContent) node;
                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.addLast(new Content(content.getText()));
                if(record) {
                    // build document
                    doc.addContent(new Content(content.getText()));
                }
            } else {
                // don't know how to handle this type, internal error
                throw new XmlReaderException("Unknown XmlNode type: " + node);
            }
View Full Code Here

Examples of com.btaz.util.xml.nodes.XmlContent

                        return new XmlStartElement(reader.getLocalName(), getAttributes(reader));
                    case XMLStreamConstants.CHARACTERS:
                        // capture XML?
                        String text = filterWhitespace(reader.getText());
                        if(text.length() > 0) {
                            return new XmlContent(text);
                        }
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        return new XmlEndElement(reader.getLocalName());
                    default:
View Full Code Here

Examples of com.btaz.util.xml.nodes.XmlContent

                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.removeLast();
            } else if(node instanceof XmlContent) {
                XmlContent content = (XmlContent) node;
                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.addLast(new Content(content.getText()));
            } else {
                throw new XmlReaderException("Unknown XmlNode type: " + node);
            }
        }
        return false;
View Full Code Here

Examples of com.btaz.util.xml.nodes.XmlContent

                    if(levelIndex == 0) {
                        return doc;
                    }
                }
            } else if(node instanceof XmlContent) {
                XmlContent content = (XmlContent) node;
                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.addLast(new Content(content.getText()));
                if(record) {
                    // build document
                    doc.addContent(new Content(content.getText()));
                }
            } else {
                // don't know how to handle this type, internal error
                throw new XmlReaderException("Unknown XmlNode type: " + node);
            }
View Full Code Here

Examples of com.btaz.util.xml.nodes.XmlContent

                        return new XmlStartElement(reader.getLocalName(), getAttributes(reader));
                    case XMLStreamConstants.CHARACTERS:
                        // capture XML?
                        String text = filterWhitespace(reader.getText());
                        if(text.length() > 0) {
                            return new XmlContent(text);
                        }
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        return new XmlEndElement(reader.getLocalName());
                    default:
View Full Code Here

Examples of edu.harvard.hul.ois.ots.schemas.XmlContent.XmlContent

      assertNotNull(output.checkWellFormed());
      assertNotNull(output.checkValid());
      assertNotNull(output.getMetadataElement("md5checksum").getValue());
      */
      String errorText = output.getErrorMessages();
      XmlContent xml = output.getStandardXmlContent();
      if(xml != null) {
        XMLStreamWriter writer = xmlof.createXMLStreamWriter(System.out);
        xml.output(writer);
        writer.close();
      }
      System.out.println(errorText);
      System.out.println("valid = "+output.checkValid());
      System.out.println("well-formed = "+output.checkWellFormed());
View Full Code Here

Examples of edu.harvard.hul.ois.ots.schemas.XmlContent.XmlContent

    serializer.output(result.getFitsXml(), out);

  }
 
  public static void outputStandardSchemaXml(FitsOutput fitsOutput, OutputStream out) throws XMLStreamException, IOException {
    XmlContent xml = fitsOutput.getStandardXmlContent();
   
    //create an xml output factory
      Transformer transformer = null;
     
      //initialize transformer for pretty print xslt
      TransformerFactory tFactory = TransformerFactory.newInstance ();
      String prettyPrintXslt = FITS_XML+"prettyprint.xslt";
      try {
      Templates template = tFactory.newTemplates(new StreamSource(prettyPrintXslt));     
      transformer = template.newTransformer();
      }
      catch(Exception e) {
        transformer = null;
      }
     
    if(xml != null && transformer != null) {

      xml.setRoot(true)
      ByteArrayOutputStream xmlOutStream = new ByteArrayOutputStream();
      OutputStream xsltOutStream = new ByteArrayOutputStream();
     
      try {
        //send standard xml to the output stream
        XMLStreamWriter sw = xmlOutputFactory.createXMLStreamWriter(xmlOutStream);
        xml.output(sw);
       
        //convert output stream to byte array and read back in as inputstream
        Source source = new StreamSource(new ByteArrayInputStream(xmlOutStream.toByteArray()));
        Result rstream = new StreamResult(xsltOutStream);
       
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.