Thread View: borland.public.jbuilder.java.api
3 messages
3 total messages
Started by forums.inprise.com
Tue, 10 Sep 2002 14:43
XML parser using xerces 1.4.4
Author: forums.inprise.com
Date: Tue, 10 Sep 2002 14:43
Date: Tue, 10 Sep 2002 14:43
19 lines
1816 bytes
1816 bytes
I am trying to parse a XML document using apache's xerces 1.4.4 parser. I
have a few questions:
1) I am having trouble getting xerces to validate the XML document. I am
using the following Java code ...
DOMParser oDOMParser = new DOMParser();
oDOMParser.setFeature("http://xml.org/sax/features/validation", true);
oDOMParser.parse(sFileName);
Document oDocument = oDOMParser.getDocument();
2) I am looking for examples using the DOM Parser (using xerces) to create
the DOM object, move to the first occurrence of a tag (full path of a tag),
check form existence of tags relative to where I am in the DOM tree and
retrieve tag values by name that are relative to where I am in the DOM tree.
Then move to the next occurrence the tag that I initially move to.
Thanks!
Re: XML parser using xerces 1.4.4
Author: forums.inprise.com
Date: Tue, 10 Sep 2002 18:21
Date: Tue, 10 Sep 2002 18:21
31 lines
2255 bytes
2255 bytes
1) Xerces is checking for well formed XML but is not using the DTD (that is
referenced in the XML document) to validate it. My understanding of xerces
it will validate the XML based on the rules set in the referenced DTD. If I
remove the DTDs from the directory, I will receive an error that the DTDs
file were not found, but does not validated the XML.
"Shankar Unni" <shankar@cotagesoft.com> wrote in message
news:3D7E1C87.4080405@cotagesoft.com...
> forums.inprise.com wrote:
>
> > 1) I am having trouble getting xerces to validate the XML document. I am
> > using the following Java code ...
> > [ example snipped ]
>
> What trouble, exactly? (Messages? Misbehavior? If so, how do you know it
> has misbehaved? What were you expecting, and what did you see?)
>
> ("911? There's something going on around here. <click>". What's this? 20
> questions?).
>
> > 2) I am looking for examples using the DOM Parser (using xerces) to
create
> > the DOM object [etc]
>
> This sounds like an application for XPath processing. Compose an XPath
> that describes the "path" to the node(s) of interest, and process it to
> get back a NodeSet (which is a simple collection that you can iterate
over).
> --
> Shankar.
>
Re: XML parser using xerces 1.4.4
Author: Shankar Unni
Date: Wed, 11 Sep 2002 16:36
Date: Wed, 11 Sep 2002 16:36
12 lines
1592 bytes
1592 bytes
forums.inprise.com wrote: > 2) Is XPath part of xerces? What package and which classes should I use? Do > you know of any examples/websites I can view? You want to use "Xalan". See http://xml.apache.org/xalan-j/samples.html#applyxpath and the documentation at http://xml.apache.org/xalan-j. There are also a number of other libraries that will do XPath processing - each with its own strengths and weaknesses. -- Shankar.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads