Package tk.eclipse.plugin.xmleditor.editors

Examples of tk.eclipse.plugin.xmleditor.editors.DTDResolver


  }
 
  /** Returns a target namespace of XML Schema */
  private String getTargetNamespace(){
    try {
      DTDResolver resolver = new DTDResolver(new IDTDResolver[0],
          getFile().getLocation().makeAbsolute().toFile().getParentFile());
      InputStream in = resolver.getInputStream(this.schemaURI);
      if(in!=null){
        SchemaGrammar grammer = (SchemaGrammar)new XMLSchemaLoader().loadGrammar(
            new XMLInputSource(null,null,null,in,null));
        return grammer.getTargetNamespace();
      }
View Full Code Here


        try {
          if(getUseDTD()){
            // Load elements from DTD
            String systemID = comboSystemID.getText();
            comboDocumentRoot.removeAll();
            DTDResolver resolver = new DTDResolver(new IDTDResolver[0],
                page1.getFile().getLocation().makeAbsolute().toFile().getParentFile());
            InputStream in = resolver.getInputStream(systemID);
//            if(in==null){
//              URL url = new URL(systemID);
//              in = url.openStream();
//            }
            if(in!=null){
              Reader reader = new InputStreamReader(in);
              DTDParser parser = new DTDParser(reader);
              DTD dtd = parser.parse();
              Object[] obj = dtd.getItems();
              for(int i=0;i<obj.length;i++){
                if(obj[i] instanceof DTDElement){
                  DTDElement element = (DTDElement)obj[i];
                  String name = element.getName();
                  comboDocumentRoot.add(name);
                }
              }
              comboDocumentRoot.select(0);
            }
          }
          if(getUseXSD()){
            // Load elements from XML Schema
            comboDocumentRoot.removeAll();
            DTDResolver resolver = new DTDResolver(new IDTDResolver[0],
                page1.getFile().getLocation().makeAbsolute().toFile().getParentFile());
            InputStream in = resolver.getInputStream(getSchemaURI());
            if(in!=null){
              SchemaGrammar grammer = (SchemaGrammar)new XMLSchemaLoader().loadGrammar(
                  new XMLInputSource(null,null,null,in,null));
              XSNamedMap map = grammer.getComponents(XSConstants.ELEMENT_DECLARATION);
              for(int i=0;i<map.getLength();i++){
View Full Code Here

  }
 
  /** Returns a target namespace of XML Schema */
  private String getTargetNamespace(){
    try {
      DTDResolver resolver = new DTDResolver(new IDTDResolver[0],
          getFile().getLocation().makeAbsolute().toFile().getParentFile());
      InputStream in = resolver.getInputStream(this.schemaURI);
      if(in!=null){
        SchemaGrammar grammer = (SchemaGrammar)new XMLSchemaLoader().loadGrammar(
            new XMLInputSource(null,null,null,in,null));
        return grammer.getTargetNamespace();
      }
View Full Code Here

        try {
          if(getUseDTD()){
            // Load elements from DTD
            String systemID = comboSystemID.getText();
            comboDocumentRoot.removeAll();
            DTDResolver resolver = new DTDResolver(new IDTDResolver[0],
                page1.getFile().getLocation().makeAbsolute().toFile().getParentFile());
            InputStream in = resolver.getInputStream(systemID);
//            if(in==null){
//              URL url = new URL(systemID);
//              in = url.openStream();
//            }
            if(in!=null){
              Reader reader = new InputStreamReader(in);
              DTDParser parser = new DTDParser(reader);
              DTD dtd = parser.parse();
              Object[] obj = dtd.getItems();
              for(int i=0;i<obj.length;i++){
                if(obj[i] instanceof DTDElement){
                  DTDElement element = (DTDElement)obj[i];
                  String name = element.getName();
                  comboDocumentRoot.add(name);
                }
              }
              comboDocumentRoot.select(0);
            }
          }
          if(getUseXSD()){
            // Load elements from XML Schema
            comboDocumentRoot.removeAll();
            DTDResolver resolver = new DTDResolver(new IDTDResolver[0],
                page1.getFile().getLocation().makeAbsolute().toFile().getParentFile());
            InputStream in = resolver.getInputStream(getSchemaURI());
            if(in!=null){
              SchemaGrammar grammer = (SchemaGrammar)new XMLSchemaLoader().loadGrammar(
                  new XMLInputSource(null,null,null,in,null));
              XSNamedMap map = grammer.getComponents(XSConstants.ELEMENT_DECLARATION);
              for(int i=0;i<map.getLength();i++){
View Full Code Here

TOP

Related Classes of tk.eclipse.plugin.xmleditor.editors.DTDResolver

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.