Re: Creating DOM using XPath

2008-12-15 Thread Prashant Reddy
I had a need for a similar API. Here is how i thought it could be implemented : 1. Take a look at JXPath - Apache's library using which you can walk a Tree of objects using XPath. 2. For given XPaths create the Java Bean Tree 3. Then marshall this Java Bean Tree to XML using JAXB. Now, let me

Re: XML indentation

2008-07-16 Thread Prashant Reddy
Humm, I should have asked if your really need to pretty print the XML before sending off the suggestions in a hurry. I am not so sure if thats what you want. I have not tried this particular usecase you are describing, and not sure about what work around. -Prashant Umesh wrote: Hi After l

Re: XML indentation

2008-07-16 Thread Prashant Reddy
You have two options: 1. To use a xsl and transform the XML to pretty printed content. 2. If you can use JAXP 1.3, checkout the LoadAndSave API http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/package-summary.html I believe Xerces 2.9 has a example on how to use the Load&Save API.

Re: Validating XML with XSD schema in memory as String

2008-04-17 Thread Prashant Reddy
Hi Ross, If you can use JAXP 1.3 's Schema Validation API, then you can do something like : StringReader xsdbuf = new StringReader(xsd); Schema schema = SchemaFactory.newSchema(new StreamSource(xsdbuf)); Then set the schema instance so obtained on the DocumentBuilderFactory / SaxParserFactory.

Re: xerces-j2 samples : What should one conclude from the o/p of these

2008-03-18 Thread Prashant Reddy
that these examples are more relevant from > "writing java code" rather that trying to obeversve functionality > > > On Tue, Mar 18, 2008 at 6:07 PM, Prashant Reddy <[EMAIL PROTECTED]> wrote: > > >From your description of the output, it looks like you are

Re: xerces-j2 samples : What should one conclude from the o/p of these

2008-03-18 Thread Prashant Reddy
>From your description of the output, it looks like you are not missing anything. What kind of examples are you expecting to find ? -Prashant On Tue, 2008-03-18 at 15:40 +0530, Abbhishek Misra wrote: > Hello, > > I'm trying to explore Xerces-j2 and have started with the samples. > > I'm able t

Re: Fwd: command line

2008-03-10 Thread Prashant Reddy
Hi Abbhishek, >From the stacktrace it looks like GCJ is getting picked up. I am not sure this was your intention. The exception also indicates that the JVM you are using (GCJ) is not capable of running the class file that was compiled using another version of Java. You could try : Giving compl

Re: Xerces DOM parser ignores EntityResolver providing local DTD for validation

2008-03-03 Thread Prashant Reddy
I think xerces may be downloading from the internet, something the LocalDTDResolver did not resolve. How about putting a System.out.println() in the else{} of the LocalDTDResolver to print the public Id, system Id. public InputSource resolveEntity (String publicId, String systemId) >{ >

RE: Xerces gives General Schema Error | Works with Oracle Parser

2008-01-31 Thread Prashant Reddy
The information in the Manifest shows you have the right jar on the disc. But do you have the same jar when you launch your JVM ? Please see : http://xerces.apache.org/xerces2-j/faq-general.html#faq-1 With the same classpath as your process execute cmd 'java org.apache.xerces.impl.Version' The

Re: unexpected SAX character event

2008-01-29 Thread Prashant Reddy
If the JVM version used is JDK 1.5 [1], there is no need to put Xerces 2.7.1 in endorsed dir. Simply putting xerces (2.7.1) in the classpath will make JAXP lookup process pick the implementation up. Only when JAXP could not find a parser implementation in the classpath, does it fall back on default

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Prashant Reddy
Try this code : DocumentBuilder builder = factory.newDocumentBuilder(); final DOMImplementation domImplementation = builder.getDOMImplementation(); /* See this sttmt */ final DocumentType documentType = domImplementation.createDocumentType(rootName, /* this is null ?*/

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Prashant Reddy
On Mon, 2008-01-14 at 09:35 +0530, Mukul Gandhi wrote: > public boolean write(Node nodeArg, LSOutput destination) >throws LSException > > Shouldn't the 1st argument be, Document ? (so we should be able to > serialize the whole Document object, including the interna

Re: [Request] Xerces-J: XML Schema 1.1 feature feedback

2007-11-15 Thread Prashant Reddy
ED] > E-mail: [EMAIL PROTECTED] > > Prashant Reddy <[EMAIL PROTECTED]> wrote on 11/12/2007 03:16:38 AM: > > > Hello: > > > > 1. Conditional Inclusion > > 2. Assertions > > > > These features are what we are most interested in. > > &g

Re: [Request] Xerces-J: XML Schema 1.1 feature feedback

2007-11-12 Thread Prashant Reddy
Hello: 1. Conditional Inclusion 2. Assertions These features are what we are most interested in. Scenarios : 1. Conditional Inclusion : The example XML snippet which employs the "condition inclusion" along with XMLSchema-versioning is a very compelling use case for us. 2. Assertions : Similar

Re: xsi:schemaLocation in XML files

2007-10-08 Thread Prashant Reddy
html#setSystemId(java.lang.String) > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: [EMAIL PROTECTED] > E-mail: [EMAIL PROTECTED] > > Prashant Reddy <[EMAIL PROTECTED]> wrote on 10/08/2007 08:49:59 AM: > > > I think the relative paths

Re: xsi:schemaLocation in XML files

2007-10-08 Thread Prashant Reddy
od is in the xml.CatalogManager class: public void resolve( current, current, publicId, systemId); -Prashant On Mon, 2007-10-08 at 18:19 +0530, Prashant Reddy wrote: > I think the relative paths you have specified in the schemaLocation will > be resolved against the &

Re: xsi:schemaLocation in XML files

2007-10-08 Thread Prashant Reddy
I think the relative paths you have specified in the schemaLocation will be resolved against the "working dir". The working dir is usually the directory at the cmd prompt when you launched the JVM. Have you tried giving absolute path to the XSD files ? A more portable solution to finding schema

Re: Validation with default-Attribute

2007-08-27 Thread Prashant Reddy
If i remember correctly you needed to normalize DOM before default attributes are inserted by parser. Not sure what is the equivalent for a StreamResult. HTH -Prashant On Mon, 2007-08-27 at 13:11 +0200, Florian Wendland wrote: > Hello all, > > I have tried to validate a simple xml document with

Re: optimise XmlSerialise.serialise(Document doc)

2007-07-31 Thread Prashant Reddy
To use the endorsed.dirs overrides mechanism, you will need to modify your java command that launches the program to include a system property called "java.endorsed.dirs". The value of this system property should be the directory where you have the xerces downloaded to, more precisely the directo

Re: optimise XmlSerialise.serialise(Document doc)

2007-07-31 Thread Prashant Reddy
Which version of Java are you using ? "format-pretty-print" is a DOM Level 3 feature. This means that if you are using JDK < version 5 (or even JDK 5, not sure), you will need to use endored.dirs overrides mechanism to pick up the xerces 9 implementation. Putting xerces 9 jars in classpath is not

Re: Got the Issue

2007-07-27 Thread Prashant Reddy
am wrong in my analysis. > > > > Thanks, > > Soumya Chatterjee > > Tata Consultancy Services > > Mailto: [EMAIL PROTECTED] > > Website: http://www.tcs.com > > > > Experience certainty. IT Services > > Busi

Re: Got the Issue

2007-07-26 Thread Prashant Reddy
usiness Solutions > Outsourcing > > > > Michael Glavassevich > <[EMAIL PROTECTED]> > > 07/26/2007 09:51 AST > > > >To > > j-users@xerces.apache.org > >

Re: Got the Issue

2007-07-25 Thread Prashant Reddy
http://www.tcs.com > > Experience certainty.IT Services >Business Solutions >Outsourcing > > > > Prashant Reddy > <[EMAIL PRO

Re: Got the Issue

2007-07-25 Thread Prashant Reddy
On Wed, 2007-07-25 at 11:58 +0530, Soumya Chatterjee wrote: > > Hi Michael, > > Do you think SAX is a good alternative for the DOM in this case. We > can migrate the parsing mechanism to SAX if there is no thread safe > issue in SAX parser. SAX will help you build custom Data model for the XML

Re: Got the Issue

2007-07-24 Thread Prashant Reddy
On Tue, 2007-07-24 at 09:57 -0400, Michael Glavassevich wrote: > Synchronization is not an option in this case because there is a > > huge performance issue here. Please let me know if any way we can > > get read of this problem without using the Synchronization block. > > Is your use-case,

Re: locating validation error in XML file

2007-06-25 Thread Prashant Reddy
Take a look at : http://weblogs.java.net/blog/kohsuke/archive/2007/03/reporting_valid.html I have not used it, i am also not sure how friendly XPaths reported will be. But possibly you could build upon this idea. HTH On Mon, 2007-06-25 at 08:30 -0700, Sanjib wrote: > Hello, > > I am validatin a

Re: Passing XML as input parameter to XSLT Transformer

2007-05-16 Thread Prashant Reddy
Hi Gaurav, On Wed, 2007-05-16 at 04:19 -0700, Gaurav Suri wrote: > Exception stack is: > 1. Invalid conversion from 'org.apache.xerces.dom.DeferredElementImpl' > to > 'node- > set'. (java.lang.RuntimeException) > com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary:-1 > (http://java.sun.

Re: Xerces locks jars when reading schema

2007-05-15 Thread Prashant Reddy
Looks like I am not alone in this. Please see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399836 -Prashant On Tue, 2007-05-15 at 20:43 +0530, Prashant Reddy wrote: > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6457007 > > Reproduction: > 1. Build DOM of an XML

Xerces locks jars when reading schema

2007-05-15 Thread Prashant Reddy
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6457007 Reproduction: 1. Build DOM of an XML whose XSD is locally resolved to a JAR file. Although the bug in the Sun's database seems to suggest this issue goes away if one employs 2.8 version of Xerces, my experience has been the contrary. I