Automatically retrieving XML



Hi all,

I'm using a SAXParser created with a SAXParserFactory with a custom
ContentHandler for parsing XML files and creating some graph
representation of the files contents.

Currently, I generate plain trees, but what I really want is to indicate
cross references as well, as given by element attributes of type
ID/IDREF.

However, Attributes.getType(int) reports only CDATA for all attributes.
So probably I need to create a validating parser. I tried that, but
still no luck, and SAXParserFactory.setValidating(boolean) says that
this is mostly for DTDs anyway and I should set a Schema using
setSchema().

However, the XML files I parse may be completely arbitrary, so I cannot
set some fixed schema. But at least I can presume that they all declare
their schemas properly (and in general there are mostly well-known
schemas), like

--8<---------------cut here---------------start------------->8---
<?xml version="1.0" encoding="UTF-8"?>
<uml:Package xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore";
xmlns:uml="http://schema.omg.org/spec/UML/2.1.1";
xsi:schemaLocation="http://schema.omg.org/spec/UML/2.1.1 http://www.eclipse.org/uml2/2.1.0/UML";
xmi:id="_FbjLzPlaEeCo98mycbxXgw" name="de.uko.nsd.NSDSchema">
--8<---------------cut here---------------end--------------->8---

Isn't there something that retrieves the needed schemas automatically by
the declarations given in the XML file?

(I remember some years back, I've used some open-source parser [maybe
xerces] that did exactly that when some option was set.)

Thanks for any pointers!

Bye,
Tassilo
.



Relevant Pages

  • Re: LoadGen - Complete sample using Dyn message creation
    ... not trying to work directly with Schemas (XSD files) to generate load. ... I have two XML files and I like LoadGen ... It is possible to extend the tool by creating a Custom Message-Creator ...
    (microsoft.public.biztalk.general)
  • Re: Oracle XMLDB question
    ... Fred Pierce - avialantic.com ... Real men write their xml files on the fly. ... Schemas, we don't need no steenkin' schemas! ...
    (rec.music.makers.guitar.acoustic)
  • Re: Oracle XMLDB question
    ... somebody in this group knows and posting here justifies my spending so ... Real men write their xml files on the fly. ... Schemas, we don't need no steenkin' schemas! ...
    (rec.music.makers.guitar.acoustic)
  • Compare two XML Files and save to One
    ... Is there a way to have two XML files and compare them and save them ... I downloaded and installed the "XML Diff and Patch" Tool ... documentation seems to imply that I would be able to tell if their ... Schemas are different but not actually save them to a different file. ...
    (microsoft.public.dotnet.xml)