0

assume that:

  1. An XML document is deceptive if it maps the same namespace prefix to two different namespace URIs at different points.
  2. A document is confusing if it maps two different namespace prefixes to the same namespace URI in different scopes.
  3. A document is super-confusing if it maps two different namespace prefixes to the same URI in the same scope.
  4. A document is ok if it is neither deceptive nor confusing.
  5. A document is normal (or in namespace-normal form) if all namespace declarations appear on the root element and it is not super-confusing.

how to check the document namespaces using the standard java dom api?

someone help me...

main method:

public static void main(String[] args) {
    NamespaceAnalyzer na = new NamespaceAnalyzer();
    Document input = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(args[0]);

    System.out.println("\tAnalysing namespaces...");
    Document outputDoc = na.check(input);
    ...
}

public class NamespaceAnalyzer {
    public NamespaceAnalyzer() {
    }

    public Document check(Document srcfile) {
        Document naReport = null; // TODO: Build your report (output) file

        // TODO: Implement
        return naReport; 
    }
}

how to implement the check() method?

Marshal
  • 55
  • 1
  • 4

0 Answers0