Package org.dom4j.io

Examples of org.dom4j.io.SAXReader


        }

        // Get creator
        ParentChildCreatorInterface creator = null;
        String absoluteDoctypesPath = sitemapParentPath + doctypesPath;
        Document doctypesDoc = new SAXReader().read("file:" + absoluteDoctypesPath +
                "doctypes.xconf");
        Attribute creator_src = (Attribute) doctypesDoc.selectSingleNode("/doctypes/doc[@type='" +
                doctype + "']/creator/@src");

        if (creator_src != null) {
View Full Code Here


     *
     */
    private boolean updateTree(String childTypeStr, short childType, String childId, String childName,
            String parentId, String docType, ParentChildCreatorInterface creator, String treeFilename)
    throws Exception {
        Document doc = new SAXReader().read("file:" + treeFilename);

        // Get parent element
        StringTokenizer st = new StringTokenizer(parentId, "/");
        StringBuffer xPath = new StringBuffer("/tree/branch"); // Trunk of tree

View Full Code Here

        }

        // Get creator
        ParentChildCreatorInterface creator = null;
        String absoluteDoctypesPath = publication.getDirectory() + File.separator + doctypesPath;
        Document doctypesDoc = new SAXReader().read("file:" + absoluteDoctypesPath +
                "doctypes.xconf");
        Attribute creator_src = (Attribute) doctypesDoc.selectSingleNode("/doctypes/doc[@type='" +
                doctype + "']/creator/@src");

        if (creator_src != null) {
View Full Code Here

    public ServerConfiguration parse( InputStream is ) throws ServerXmlIOException
    {
        try
        {
            // Reading and creating the document
            SAXReader reader = new SAXReader();
            reader.setEntityResolver( new StudioEntityResolver() );
            Document document = reader.read( is );

            // Parsing the document
            ServerConfigurationV155 serverConfiguration = new ServerConfigurationV155();
            parse( document, serverConfiguration );
View Full Code Here

  /**
   * Create a dom4j SAXReader which will append all validation errors
   * to errorList
   */
  public SAXReader createSAXReader(String file, List errorsList, EntityResolver entityResolver) {
    if (saxReader==null) saxReader = new SAXReader();
    saxReader.setEntityResolver(entityResolver);
    saxReader.setErrorHandler( new ErrorLogger(file, errorsList) );
    saxReader.setMergeAdjacentText(true);
    saxReader.setValidation(true);
    return saxReader;
View Full Code Here

    // package-private for testing
    @SuppressWarnings({ "unchecked" })
    void parseUpdateXml(URI url, Collection<Plugin> plugins, @WillClose
            InputStream inputStream) {
        try {
            Document doc = new SAXReader().read(inputStream);
            if (DEBUG) {
                StringWriter stringWriter = new StringWriter();
                XMLWriter xmlWriter = new XMLWriter(stringWriter);
                xmlWriter.write(doc);
                xmlWriter.close();
View Full Code Here

        public XMLFile(String filename) throws DocumentException {
            this.filename = filename;

            File file = new File(filename);
            SAXReader saxReader = new SAXReader();
            this.document = saxReader.read(file);
        }
View Full Code Here

      log.warn( "Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null." );
      return;
    }
    XMLHelper xmlHelper = new XMLHelper();
    List errors = new ArrayList();
    SAXReader saxReader = xmlHelper.createSAXReader( "XML InputStream", errors, cfg.getEntityResolver() );
    try {
      saxReader.setFeature( "http://apache.org/xml/features/validation/schema", true );
      //saxReader.setFeature( "http://apache.org/xml/features/validation/dynamic", true );
      //set the default schema locators
      saxReader.setProperty( "http://apache.org/xml/properties/schema/external-schemaLocation",
          "http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd");
    }
    catch (SAXException e) {
      saxReader.setValidation( false );
    }

    for ( String xmlFile : xmlFiles ) {

      InputStream resourceAsStream = newTempClassLoader.getResourceAsStream( xmlFile );
      if (resourceAsStream == null) continue;
      BufferedInputStream is = new BufferedInputStream( resourceAsStream );
      try {
        errors.clear();
        org.dom4j.Document doc = saxReader.read( is );
        if ( errors.size() != 0 ) {
          throw new MappingException( "invalid mapping", (Throwable) errors.get( 0 ) );
        }
        Element rootElement = doc.getRootElement();
        if ( rootElement != null && "entity-mappings".equals( rootElement.getName() ) ) {
View Full Code Here

            dependencyNode.addElement(XmlConstants.ARTIFACT_VERSION).addText(dependency.version);
        }
    }
   
    public static Document loadXmlDocument(final String xmlFileName) throws DocumentException {
        SAXReader reader = new SAXReader();
        return reader.read(xmlFileName);
    }
View Full Code Here

  /**
   * Create a dom4j SAXReader which will append all validation errors
   * to errorList
   */
  public SAXReader createSAXReader(String file, List errorsList, EntityResolver entityResolver) {
    if (saxReader==null) saxReader = new SAXReader();
    saxReader.setEntityResolver(entityResolver);
    saxReader.setErrorHandler( new ErrorLogger(file, errorsList) );
    saxReader.setMergeAdjacentText(true);
    saxReader.setValidation(true);
    return saxReader;
View Full Code Here

TOP

Related Classes of org.dom4j.io.SAXReader

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.