Lecture 9 - XML and Java Objects Flashcards

1
Q

What is the method to convert XML to java & Java to XML?

A

–SAX or DOM parser
•Method to convert Java to XML
–Done by printing tags

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What could we use to generate XML to Java and vice - versa?

A

We could use:

Java beans - XML encoder

OR

By hand…

XML to Java:

  • Use a parser
  • Read data and create objects

Java to XML:

-Use print to generate XML

BUT… using java beans is just one way and conversion by hand is time consuming to code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What should we use for XML to Java & vice-versa?

A

XML schema
–JAXB (Java Architecture for XML Binding)
•Uses schema to generate XML object code
•Schema is converted to code by special compiler
–Compiler is xjc
•Then we can use “marshalling” and “unmarshalling” to convert from XML to Java and from Java to XML

–Marshalling = Object to XML

–Unmarshing = XML to Objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly