Package net.n3.nanoxml

Examples of net.n3.nanoxml.IXMLReader


       LogBuffer.println("Not printing config to file, file is null.");
       return;
     }
     try {
       OutputStream os = new FileOutputStream(file);
       XMLWriter w = new XMLWriter(os);
       w.write(root.root);
       changed = false;
       LogBuffer.println("Successfully stored config file " + file);
     } catch (Exception e) {
       LogBuffer.logException(e);
       System.out.println("Caught exception " + e);
View Full Code Here


      return;
    }
    try {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      inputStream = new BufferedInputStream(new FileInputStream(configXml));
      final IXMLReader reader = new StdXMLReader(inputStream);
      parser.setReader(reader);
      final XMLElement loader = (XMLElement) parser.parse();
      final Vector<XMLElement> formats = loader.getChildren();
      for (XMLElement elem : formats) {
        final String type = elem.getAttribute("type", null);
View Full Code Here

      final boolean showPopupOnError)
          throws IOException {
    try {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      File filterFile = new File(pathToFilterFile);
      final IXMLReader reader = new StdXMLReader(new BufferedInputStream(new FileInputStream(filterFile)));
      parser.setReader(reader);
      reader.setSystemID(filterFile.toURL().toString());
      final XMLElement loader = (XMLElement) parser.parse();
      final Vector<XMLElement> conditions = loader.getChildren();
      for (int i = 0; i < conditions.size(); i++) {
        final ASelectableCondition condition = getConditionFactory().loadCondition(conditions.get(i));
        if(condition != null){
View Full Code Here

    final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
    for (File file : addonXmlFiles) {
      BufferedInputStream inputStream = null;
      try {
        inputStream = new BufferedInputStream(new FileInputStream(file));
        final IXMLReader reader = new StdXMLReader(inputStream);
        parser.setReader(reader);
        registerInstalledAddOn(new AddOnProperties(AddOnType.PLUGIN, (XMLElement) parser.parse()));
      }
      catch (final Exception e) {
        LogUtils.warn("error parsing " + file, e);
View Full Code Here

    InputStream xmlDescriptorStream = null;
    try {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      final URL resource = ResourceController.getResourceController().getResource(xmlDescriptorFile);
      xmlDescriptorStream = resource.openStream();
      final IXMLReader reader = new StdXMLReader(xmlDescriptorStream);
      parser.setReader(reader);
      final XMLElement xml = (XMLElement) parser.parse();
      final Enumeration<XMLElement> actionDescriptors = xml.enumerateChildren();
      while (actionDescriptors.hasMoreElements()) {
        final XMLElement descriptor = actionDescriptors.nextElement();
View Full Code Here

      LogUtils.info(pathToFile + " does not exist yet");
      return;
    }
    try {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      final IXMLReader reader = new StdXMLReader(new BufferedInputStream(new FileInputStream(configXml)));
      parser.setReader(reader);
      final XMLElement loader = (XMLElement) parser.parse();
      final Vector<XMLElement> scannerElements = loader.getChildren();
      for (XMLElement elem : scannerElements) {
        scanners.add(parseScanner(elem));
View Full Code Here

    final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
    for (File file : addonXmlFiles) {
      BufferedInputStream inputStream = null;
      try {
        inputStream = new BufferedInputStream(new FileInputStream(file));
        final IXMLReader reader = new StdXMLReader(inputStream);
        parser.setReader(reader);
        final ScriptAddOnProperties addOn = new ScriptAddOnProperties((XMLElement) parser.parse());
        addOn.setAddOnPropertiesFile(file);
        AddOnsController.getController().registerInstalledAddOn(addOn);
      }
View Full Code Here

      boolean inComment = false;
      final TreeXmlReader builder = (TreeXmlReader) getBuilder();
      final StringBuilder waitingBuf = new StringBuilder();
      int level = 1;
      for (;;) {
        final IXMLReader reader = getReader();
        char ch = reader.read();
        if (inComment) {
          waitingBuf.append(ch);
          if (ch != '-') {
            continue;
          }
          ch = reader.read();
          waitingBuf.append(ch);
          if (ch != '-') {
            continue;
          }
          ch = reader.read();
          waitingBuf.append(ch);
          if (ch != '>') {
            continue;
          }
          inComment = false;
          continue;
        }
        if (ch == '<') {
          ch = reader.read();
          if (ch == '/') {
            level--;
            if (level == 0) {
              break;
            }
          }
          else if (ch == '!') {
            final char read1 = reader.read();
            final char read2 = reader.read();
            if (read1 != '-' || read2 != '-') {
              throw new XMLParseException(reader.getSystemID(), reader.getLineNr(), "Invalid input: <!"
                      + read1 + read2);
            }
            inComment = true;
            waitingBuf.append("<!--");
            continue;
          }
          else {
            level++;
          }
          waitingBuf.append('<');
        }
        else if (ch == '/') {
          ch = reader.read();
          if (ch == '>') {
            level--;
            if (level == 0) {
              throw new XMLParseException(reader.getSystemID(), reader.getLineNr(), "Invalid input: />");
            }
          }
          else if (ch == '<') {
            waitingBuf.append('/');
            reader.unread(ch);
            continue;
          }
          waitingBuf.append('/');
        }
        waitingBuf.append(ch);
View Full Code Here

   * (non-Javadoc)
   * @see freeplane.persistence.Reader#load()
   */
  public void load(final Reader reader) throws XMLException {
    parser = new XMLParser();
    final IXMLReader nanoxmlReader = new StdXMLReader(reader);
    parser.setReader(nanoxmlReader);
    parser.setBuilder(this);
    parser.setValidator(new NonValidator());
    parser.parse();
  }
View Full Code Here

    return unmarschall(marshalled, dialog);
  }
  protected XMLElement unmarschall(final String marshalled, final JDialog dialog) {
    if (marshalled != null) {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      final IXMLReader xmlReader = new StdXMLReader(new StringReader(marshalled));
      parser.setReader(xmlReader);
      try {
        final XMLElement storage = (XMLElement) parser.parse();
        if (storage != null) {
          x = Integer.parseInt(storage.getAttribute("x", "-1"));
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.IXMLReader

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.