Reading XML file

Hi,

Is there any way to read XML file with Java if i do not have a schema file? SAX?

[97 byte] By [Beanie_0029a] at [2007-11-27 11:22:41]
# 1

>> Is there any way to read XML file with Java if i do not have a schema file?

yes.

>> SAX?

for example.

jwentinga at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 2

I like jdom

manuel.leiriaa at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 3

I was thinking of using StAX or SAX to read XML files. However, i'm not too sure if they require me to provide schema files (which i'm not provided).

Beanie_0029a at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 4

If i'm not wrong, JDOM's cpu and memory is not as efficient as SAX and StAX right? I need one that is efficient in cpu and memory.

Beanie_0029a at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 5

read this

http://totheriver.com/learn/xml/xmltutorial.html#5

java_2006a at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 6

> If i'm not wrong, JDOM's cpu and memory is not as

> efficient as SAX and StAX right? I need one that is

> efficient in cpu and memory.

Why do you think you need one that's "efficient"?

georgemca at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 7

The XML files i'm using are quite large. I saw DOM in memory footprint up to 10x the document size. So i'm not too sure if JDOM is similar in this way.

If i just need to read (and don't need to write), is it ok if i use SAX instead of STAX?

Beanie_0029a at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 8

> The XML files i'm using are quite large. I saw DOM in

> memory footprint up to 10x the document size. So i'm

> not too sure if JDOM is similar in this way.

Depends how you read it in. JDom can use either SAX or DOM, it's up to you

> If i just need to read (and don't need to write), is

> it ok if i use SAX instead of STAX?

If you're just reading, and your document is large, SAX may be better. There is no rule about it, and no way to determine which is better for you other than trying it out

georgemca at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 9

Ok. Thanks a lot! =)

Beanie_0029a at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 10

http://www.c-sharpcorner.com/UploadFile/mahesh/ReadingXmlFile11142005002137AM/ReadingXmlFile.aspx

Prem_Sa at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 11

> http://www.c-sharpcorner.com/UploadFile/mahesh/Reading

> XmlFile11142005002137AM/ReadingXmlFile.aspx

Any reason you're posting links to C# sites in reply to Java questions?

georgemca at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 12

dom4j -- this is the fastest way to read an XML.

Its pretty simple to learn too.

http://www.dom4j.org/index.html

java_queena at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...
# 13

> >

> http://www.c-sharpcorner.com/UploadFile/mahesh/Reading

>

> > XmlFile11142005002137AM/ReadingXmlFile.aspx

>

> Any reason you're posting links to C# sites in reply

> to Java questions?

... And a pretty shtty article at that.

petes1234a at 2007-7-29 14:56:17 > top of Java-index,Java Essentials,New To Java...