Re: Antw: Re: Embedded FOP From fo-Document to PDF

2002-06-05 Thread Juergen Lippold

OK so let's start,

now I have got a Method to create the document, after this part I add some rows and 
colomns to the table.
So I'm allways adding Elements with or without attributes.
The result is the fo-file I already sent.


 protected Document createMyDocument() {
DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
fac.setNamespaceAware(true);
Document doc = null;
try {
  doc = fac.newDocumentBuilder().newDocument();
} catch(ParserConfigurationException e) {
}

Element root = createChild(doc, doc, fo:root);
root.setAttribute(xmlns:fo, http://www.w3.org/1999/XSL/Format;);

Element lms = createChild(root, doc, fo:layout-master-set);
Element spm = createChild(lms, doc, fo:simple-page-master);
... 
return doc;
  }
  private Element createChild(Node node, Document doc, String elm) {
Element element = doc.createElement(elm);
node.appendChild(element);   
return element;
  }
...

Regards 
Juergen Lippold


 [EMAIL PROTECTED] 04.06.2002  20.05 Uhr 
Juergen Lippold wrote:

 namespaceAware doesn't make a differnce. No matter if true or false.
Well, I'm out of ideas, lets go inside - show us how do you build Document.

-- 
Oleg Tkachenko
Multiconn International, Israel


-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, email: [EMAIL PROTECTED] 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Antw: Re: Embedded FOP From fo-Document to PDF

2002-06-05 Thread Keiron Liddle

On Wed, 2002-06-05 at 08:45, Juergen Lippold wrote:
 OK so let's start,
 
 now I have got a Method to create the document, after this part I add some rows and 
colomns to the table.
 So I'm allways adding Elements with or without attributes.
 The result is the fo-file I already sent.
 
 Element root = createChild(doc, doc, fo:root);
 root.setAttribute(xmlns:fo, http://www.w3.org/1999/XSL/Format;);
 ...

According to this:
http://xml.apache.org/xerces2-j/javadocs/api/org/w3c/dom/Element.html#setAttribute(java.lang.String,
 java.lang.String)

you have set the foot element with the attribute name xmlns:fo and
value http://www.w3.org/1999/XSL/Format;.
You want to set the the attribute with the namespace, try
setAttributeNS. You need to set the namespace correctly everywhere.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Antw: Re: Embedded FOP From fo-Document to PDF

2002-06-05 Thread Oleg Tkachenko

Juergen Lippold wrote:

 Element element = doc.createElement(elm);
As Keiron pointed out, it should be
Element element = doc.createElementNS(http://www.w3.org/1999/XSL/Format;, elm);

-- 
Oleg Tkachenko
Multiconn International, Israel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Antw: Re: Embedded FOP From fo-Document to PDF

2002-06-05 Thread Juergen Lippold

Hy, many thank for the help, It's running :-)))

but there are still two more question:
- With the namespace attribute I don't need to specify the attribute xmlns:fo anymore 
right?
  It's running without the setting (uncomment in code.)

  private Element createChildNS(Node node, Document doc, String elm) {
Element element = doc.createElementNS(http://www.w3.org/1999/XSL/Format;, elm);
node.appendChild(element);   
return element;
  }

  protected Document createMyDocument() {
DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
fac.setNamespaceAware(true);
Document doc = null;
try {
  doc = fac.newDocumentBuilder().newDocument();
} catch(ParserConfigurationException e) {}
   
Element root = createChildNS(doc, doc, root);
//root.setAttribute(xmlns:fo, http://www.w3.org/1999/XSL/Format;);
 
Element lms = createChildNS(root, doc, layout-master-set);
Element spm = createChildNS(lms, doc, simple-page-master);
spm.setAttribute(page-width,21cm);
... 
return doc;
  }


- Writing the fo-File to HD with the XML-Serializer I have got the following result, I 
cant find an information about namespaces why? 
Code for output
  org.apache.xalan.serialize.SerializerToXML sss= new 
org.apache.xalan.serialize.SerializerToXML(); 
  sss.setOutputStream(fileOutputStrem);
  sss.serialize(foDocument);
...

Fo-File
?xml version=1.0 encoding=UTF-8?
rootlayout-master-setsimple-page-master margin-left=0.0cm margin-top=0.1cm 
master-name=page page-height=29
...

Thanks 
Juergen Lippold


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Antw: Re: Embedded FOP From fo-Document to PDF

2002-06-05 Thread Oleg Tkachenko

Juergen Lippold wrote:

 - With the namespace attribute I don't need to specify the attribute xmlns:fo 
anymore right?
   It's running without the setting (uncomment in code.)
I think so, because you need namespace, not attribute and imho there is no way 
in dom1/dom2 to set just namespace node.

 - Writing the fo-File to HD with the XML-Serializer I have got the following result, 
I cant find an information about namespaces why? 
It's a bug in the serializer, see 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1831. I'd better try JAXP 
serializing by identity transformation, I believe it's more robust.

-- 
Oleg Tkachenko
Multiconn International, Israel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Antw: Re: Embedded FOP From fo-Document to PDF

2002-06-04 Thread Oleg Tkachenko

Juergen Lippold wrote:

 namespaceAware doesn't make a differnce. No matter if true or false.
Well, I'm out of ideas, lets go inside - show us how do you build Document.

-- 
Oleg Tkachenko
Multiconn International, Israel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]